Skip to content

Function: searchForProjects() ​

ts
function searchForProjects(
   client, 
   parameters?, 
   options?
): Promise<{
[key: string]: unknown;
  header?: string;
  projects?: object[];
  total?: number;
}>;

Defined in: src/server/api/projects.ts:818

Returns a list of projects visible to the user where project name and/or key is matching the given query. Passing an empty (or whitespace only) query will match no projects. The project matches will contain a field with the query highlighted. The number of projects returned can be controlled by passing a value for 'maxResults', but a hard limit of no more than 100 projects is enforced. The projects are wrapped in a single response object that contains a header for use in the picker, specifically 'Showing X of Y matching projects' and the total number of matches for the query.

Parameters ​

ParameterTypeDescription
clientClient-
parameters?{ allowEmptyQuery?: boolean; maxResults?: number; query?: string; }-
parameters.allowEmptyQuery?booleanIf true, and the query is empty, the method will return first results limited to the value of 'maxResults' or default limit of 100.
parameters.maxResults?numberMaximum number of matches to return. Zero means a default limit of 100 and negative numbers return no results.
parameters.query?stringA sequence of characters expected to be found in the word-prefix of project name and/or key.
options?RequestOptions-

Returns ​

Promise<{ [key: string]: unknown; header?: string; projects?: object[]; total?: number; }>