completeQuery method
Completes the specified prefix with keyword suggestions.
Intended for use by a job search auto-complete search box.
Request parameters:
tenant
- Required. Resource name of tenant the completion is performed
within. The format is "projects/{project_id}/tenants/{tenant_id}", for
example, "projects/foo/tenants/bar".
Value must have pattern ^projects/\[^/\]+/tenants/\[^/\]+$
.
company
- If provided, restricts completion to specified company. The
format is
"projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for
example, "projects/foo/tenants/bar/companies/baz".
languageCodes
- The list of languages of the query. This is the BCP-47
language code, such as "en-US" or "sr-Latn". For more information, see
Tags for Identifying Languages. The
maximum number of allowed characters is 255.
pageSize
- Required. Completion result count. The maximum allowed page
size is 10.
query
- Required. The query used to generate suggestions. The maximum
number of allowed characters is 255.
scope
- The scope of the completion. The defaults is
CompletionScope.PUBLIC.
Possible string values are:
- "COMPLETION_SCOPE_UNSPECIFIED" : Default value.
- "TENANT" : Suggestions are based only on the data provided by the client.
- "PUBLIC" : Suggestions are based on all jobs data in the system that's visible to the client
type
- The completion topic. The default is CompletionType.COMBINED.
Possible string values are:
- "COMPLETION_TYPE_UNSPECIFIED" : Default value.
- "JOB_TITLE" : Suggest job titles for jobs autocomplete. For CompletionType.JOB_TITLE type, only open jobs with the same language_codes are returned.
- "COMPANY_NAME" : Suggest company names for jobs autocomplete. For CompletionType.COMPANY_NAME type, only companies having open jobs with the same language_codes are returned.
- "COMBINED" : Suggest both job titles and company names for jobs autocomplete. For CompletionType.COMBINED type, only open jobs with the same language_codes or companies having open jobs with the same language_codes are returned.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a CompleteQueryResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<CompleteQueryResponse> completeQuery(
core.String tenant, {
core.String? company,
core.List<core.String>? languageCodes,
core.int? pageSize,
core.String? query,
core.String? scope,
core.String? type,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (company != null) 'company': [company],
if (languageCodes != null) 'languageCodes': languageCodes,
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (query != null) 'query': [query],
if (scope != null) 'scope': [scope],
if (type != null) 'type': [type],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v4/' + core.Uri.encodeFull('$tenant') + ':completeQuery';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return CompleteQueryResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}