complete method

Future<CompleteQueryResponse> complete(
  1. String name, {
  2. String? companyName,
  3. String? languageCode,
  4. List<String>? languageCodes,
  5. int? pageSize,
  6. String? query,
  7. String? scope,
  8. String? type,
  9. String? $fields,
})

Completes the specified prefix with keyword suggestions.

Intended for use by a job search auto-complete search box.

Request parameters:

name - Required. Resource name of project the completion is performed within. The format is "projects/{project_id}", for example, "projects/api-test-project". Value must have pattern ^projects/\[^/\]+$.

companyName - Optional. If provided, restricts completion to specified company. The format is "projects/{project_id}/companies/{company_id}", for example, "projects/api-test-project/companies/foo".

languageCode - Deprecated. Use language_codes instead. Optional. The language 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. For CompletionType.JOB_TITLE type, only open jobs with the same language_code are returned. For CompletionType.COMPANY_NAME type, only companies having open jobs with the same language_code are returned. For CompletionType.COMBINED type, only open jobs with the same language_code or companies having open jobs with the same language_code are returned. The maximum number of allowed characters is 255.

languageCodes - Optional. 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. For CompletionType.JOB_TITLE type, only open jobs with the same language_codes are returned. For CompletionType.COMPANY_NAME type, only companies having open jobs with the same language_codes are returned. For CompletionType.COMBINED type, only open jobs with the same language_codes or companies having open jobs with the same language_codes are returned. 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 - Optional. 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 - Optional. The completion topic. The default is CompletionType.COMBINED. Possible string values are:

  • "COMPLETION_TYPE_UNSPECIFIED" : Default value.
  • "JOB_TITLE" : Only suggest job titles.
  • "COMPANY_NAME" : Only suggest company names.
  • "COMBINED" : Suggest both job titles and company names.

$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> complete(
  core.String name, {
  core.String? companyName,
  core.String? languageCode,
  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 (companyName != null) 'companyName': [companyName],
    if (languageCode != null) 'languageCode': [languageCode],
    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_ = 'v3/' + core.Uri.encodeFull('$name') + ':complete';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return CompleteQueryResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}