From 9e4d28f6692a00469d6694e524bd39c99c662ba9 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 29 Feb 2020 11:01:07 -0800 Subject: [PATCH] feat!: removed auto-pagination from searchJobs --- packages/google-cloud-talent/.jsdoc.js | 31 +- packages/google-cloud-talent/src/index.ts | 2 + .../src/v4beta1/job_service_client.ts | 1105 ++++++----------- .../src/v4beta1/profile_service_client.ts | 567 +++------ packages/google-cloud-talent/synth.metadata | 7 +- .../test/gapic-job_service-v4beta1.ts | 107 +- .../test/gapic-profile_service-v4beta1.ts | 83 +- 7 files changed, 687 insertions(+), 1215 deletions(-) diff --git a/packages/google-cloud-talent/.jsdoc.js b/packages/google-cloud-talent/.jsdoc.js index a465429f1cf..449c77f8435 100644 --- a/packages/google-cloud-talent/.jsdoc.js +++ b/packages/google-cloud-talent/.jsdoc.js @@ -1,26 +1,26 @@ -/*! - * Copyright 2019 Google LLC. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// // ** This file is automatically generated by gapic-generator-typescript. ** // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** - */ 'use strict'; module.exports = { opts: { + readme: './README.md', package: './package.json', template: './node_modules/jsdoc-fresh', recurse: true, @@ -32,6 +32,7 @@ module.exports = { 'jsdoc-region-tag' ], source: { + excludePattern: '(^|\\/|\\\\)[._]', include: [ 'build/src', 'protos' diff --git a/packages/google-cloud-talent/src/index.ts b/packages/google-cloud-talent/src/index.ts index 04b9210671d..934c2146786 100644 --- a/packages/google-cloud-talent/src/index.ts +++ b/packages/google-cloud-talent/src/index.ts @@ -46,3 +46,5 @@ export default { ProfileServiceClient, TenantServiceClient, }; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-talent/src/v4beta1/job_service_client.ts b/packages/google-cloud-talent/src/v4beta1/job_service_client.ts index 10cf6e7fbbe..7ca3476974a 100644 --- a/packages/google-cloud-talent/src/v4beta1/job_service_client.ts +++ b/packages/google-cloud-talent/src/v4beta1/job_service_client.ts @@ -177,11 +177,6 @@ export class JobServiceClient { 'nextPageToken', 'jobs' ), - searchJobs: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'matchingJobs' - ), searchJobsForAlert: new gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', @@ -770,477 +765,79 @@ export class JobServiceClient { }); return this._innerApiCalls.batchDeleteJobs(request, options, callback); } - - batchCreateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + searchJobs( + request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest, options?: gax.CallOptions ): Promise< [ - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | undefined, {} | undefined ] >; - batchCreateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + searchJobs( + request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest, options: gax.CallOptions, callback: Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | undefined, {} | undefined > ): void; /** - * Begins executing a batch create jobs operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant under which the job is created. + * Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - * is created. For example, "projects/foo". - * @param {number[]} request.jobs - * Required. The jobs to be created. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - batchCreateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - >, - callback?: Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - > - ): Promise< - [ - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - return this._innerApiCalls.batchCreateJobs(request, options, callback); - } - batchUpdateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, - options?: gax.CallOptions - ): Promise< - [ - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - ] - >; - batchUpdateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, - options: gax.CallOptions, - callback: Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - > - ): void; - /** - * Begins executing a batch update jobs operation. + * This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + * present in the database, and only returns jobs that the caller has + * permission to search against. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the tenant under which the job is created. + * Required. The resource name of the tenant to search within. * * The format is "projects/{project_id}/tenants/{tenant_id}". For example, * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant * is created. For example, "projects/foo". - * @param {number[]} request.jobs - * Required. The jobs to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * Strongly recommended for the best service experience. Be aware that it will - * also increase latency when checking the status of a batch operation. + * @param {google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode} request.searchMode + * Mode of a search. * - * If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, only the specified fields in - * [Job][google.cloud.talent.v4beta1.Job] are updated. Otherwise all the fields are updated. + * Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. + * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata + * Required. The meta information collected about the job searcher, used to improve the + * search quality of the service. The identifiers (such as `user_id`) are + * provided by users, and must be unique and consistent. + * @param {google.cloud.talent.v4beta1.JobQuery} request.jobQuery + * Query used to search against jobs, such as keyword, location filters, etc. + * @param {boolean} request.enableBroadening + * Controls whether to broaden the search when it produces sparse results. + * Broadened queries append results to the end of the matching results + * list. * - * A field mask to restrict the fields that are updated. Only - * top level fields of [Job][google.cloud.talent.v4beta1.Job] are supported. + * Defaults to false. + * @param {boolean} request.requirePreciseResultSize + * Controls if the search job request requires the return of a precise + * count of the first 300 results. Setting this to `true` ensures + * consistency in the number of results per page. Best practice is to set this + * value to true if a client allows users to jump directly to a + * non-sequential search results page. * - * If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, The [Job][google.cloud.talent.v4beta1.Job] inside - * [JobResult][google.cloud.talent.v4beta1.JobOperationResult.JobResult] - * will only contains fields that is updated, plus the Id of the Job. - * Otherwise, [Job][google.cloud.talent.v4beta1.Job] will include all fields, which can yield a very - * large response. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - batchUpdateJobs( - request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - >, - callback?: Callback< - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - > - ): Promise< - [ - LROperation< - protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, - protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata - >, - protosTypes.google.longrunning.IOperation | undefined, - {} | undefined - ] - > | void { - request = request || {}; - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - return this._innerApiCalls.batchUpdateJobs(request, options, callback); - } - listJobs( - request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, - options?: gax.CallOptions - ): Promise< - [ - protosTypes.google.cloud.talent.v4beta1.IJob[], - protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListJobsResponse - ] - >; - listJobs( - request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, - options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.talent.v4beta1.IJob[], - protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListJobsResponse - > - ): void; - /** - * Lists jobs by filter. + * Enabling this flag may adversely impact performance. * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant under which the job is created. + * Defaults to false. + * @param {number[]} request.histogramQueries + * An expression specifies a histogram request against matching jobs. * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - * is created. For example, "projects/foo". - * @param {string} request.filter - * Required. The filter string specifies the jobs to be enumerated. + * Expression syntax is an aggregation function call with histogram facets and + * other options. * - * Supported operator: =, AND + * Available aggregation function calls are: + * * `count(string_histogram_facet)`: Count the number of matching entities, + * for each distinct attribute value. + * * `count(numeric_histogram_facet, list of buckets)`: Count the number of + * matching entities within each bucket. * - * The fields eligible for filtering are: - * - * * `companyName` (Required) - * * `requisitionId` - * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to - * OPEN if no value is specified. - * - * Sample Query: - * - * * companyName = "projects/foo/tenants/bar/companies/baz" - * * companyName = "projects/foo/tenants/bar/companies/baz" AND - * requisitionId = "req-1" - * * companyName = "projects/foo/tenants/bar/companies/baz" AND - * status = "EXPIRED" - * @param {string} request.pageToken - * The starting point of a query result. - * @param {number} request.pageSize - * The maximum number of jobs to be returned per page of results. - * - * If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed - * page size is 1000. Otherwise, the maximum allowed page size is 100. - * - * Default is 100 if empty or a number < 1 is specified. - * @param {google.cloud.talent.v4beta1.JobView} request.jobView - * The desired job attributes returned for jobs in the - * search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] if no value is - * specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Job]{@link google.cloud.talent.v4beta1.Job}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Job]{@link google.cloud.talent.v4beta1.Job} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListJobsRequest]{@link google.cloud.talent.v4beta1.ListJobsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListJobsResponse]{@link google.cloud.talent.v4beta1.ListJobsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - listJobs( - request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protosTypes.google.cloud.talent.v4beta1.IJob[], - protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListJobsResponse - >, - callback?: Callback< - protosTypes.google.cloud.talent.v4beta1.IJob[], - protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListJobsResponse - > - ): Promise< - [ - protosTypes.google.cloud.talent.v4beta1.IJob[], - protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListJobsResponse - ] - > | void { - request = request || {}; - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - return this._innerApiCalls.listJobs(request, options, callback); - } - - /** - * Equivalent to {@link listJobs}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listJobs} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant under which the job is created. - * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - * is created. For example, "projects/foo". - * @param {string} request.filter - * Required. The filter string specifies the jobs to be enumerated. - * - * Supported operator: =, AND - * - * The fields eligible for filtering are: - * - * * `companyName` (Required) - * * `requisitionId` - * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to - * OPEN if no value is specified. - * - * Sample Query: - * - * * companyName = "projects/foo/tenants/bar/companies/baz" - * * companyName = "projects/foo/tenants/bar/companies/baz" AND - * requisitionId = "req-1" - * * companyName = "projects/foo/tenants/bar/companies/baz" AND - * status = "EXPIRED" - * @param {string} request.pageToken - * The starting point of a query result. - * @param {number} request.pageSize - * The maximum number of jobs to be returned per page of results. - * - * If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed - * page size is 1000. Otherwise, the maximum allowed page size is 100. - * - * Default is 100 if empty or a number < 1 is specified. - * @param {google.cloud.talent.v4beta1.JobView} request.jobView - * The desired job attributes returned for jobs in the - * search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] if no value is - * specified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Job]{@link google.cloud.talent.v4beta1.Job} on 'data' event. - */ - listJobsStream( - request?: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, - options?: gax.CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - return this._descriptors.page.listJobs.createStream( - this._innerApiCalls.listJobs as gax.GaxCall, - request, - callSettings - ); - } - searchJobs( - request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest, - options?: gax.CallOptions - ): Promise< - [ - protosTypes.google.cloud.talent.v4beta1.SearchJobsResponse.IMatchingJob[], - protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse - ] - >; - searchJobs( - request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest, - options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.talent.v4beta1.SearchJobsResponse.IMatchingJob[], - protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse - > - ): void; - /** - * Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - * - * This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs - * present in the database, and only returns jobs that the caller has - * permission to search against. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant to search within. - * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - * is created. For example, "projects/foo". - * @param {google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode} request.searchMode - * Mode of a search. - * - * Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. - * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata - * Required. The meta information collected about the job searcher, used to improve the - * search quality of the service. The identifiers (such as `user_id`) are - * provided by users, and must be unique and consistent. - * @param {google.cloud.talent.v4beta1.JobQuery} request.jobQuery - * Query used to search against jobs, such as keyword, location filters, etc. - * @param {boolean} request.enableBroadening - * Controls whether to broaden the search when it produces sparse results. - * Broadened queries append results to the end of the matching results - * list. - * - * Defaults to false. - * @param {boolean} request.requirePreciseResultSize - * Controls if the search job request requires the return of a precise - * count of the first 300 results. Setting this to `true` ensures - * consistency in the number of results per page. Best practice is to set this - * value to true if a client allows users to jump directly to a - * non-sequential search results page. - * - * Enabling this flag may adversely impact performance. - * - * Defaults to false. - * @param {number[]} request.histogramQueries - * An expression specifies a histogram request against matching jobs. - * - * Expression syntax is an aggregation function call with histogram facets and - * other options. - * - * Available aggregation function calls are: - * * `count(string_histogram_facet)`: Count the number of matching entities, - * for each distinct attribute value. - * * `count(numeric_histogram_facet, list of buckets)`: Count the number of - * matching entities within each bucket. - * - * Data types: + * Data types: * * * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. * * String: string like "any string with backslash escape for quote(\")." @@ -1431,19 +1028,7 @@ export class JobServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [MatchingJob]{@link google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [MatchingJob]{@link google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [SearchJobsRequest]{@link google.cloud.talent.v4beta1.SearchJobsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [SearchJobsResponse]{@link google.cloud.talent.v4beta1.SearchJobsResponse}. - * + * The first element of the array is an object representing [SearchJobsResponse]{@link google.cloud.talent.v4beta1.SearchJobsResponse}. * The promise has a method named "cancel" which cancels the ongoing API call. */ searchJobs( @@ -1451,20 +1036,340 @@ export class JobServiceClient { optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.talent.v4beta1.SearchJobsResponse.IMatchingJob[], - protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse + protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse, + | protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest + | undefined, + {} | undefined >, callback?: Callback< - protosTypes.google.cloud.talent.v4beta1.SearchJobsResponse.IMatchingJob[], - protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse + protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | undefined, + {} | undefined > ): Promise< [ - protosTypes.google.cloud.talent.v4beta1.SearchJobsResponse.IMatchingJob[], - protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse + protosTypes.google.cloud.talent.v4beta1.ISearchJobsResponse, + protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.searchJobs(request, options, callback); + } + + batchCreateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchCreateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Begins executing a batch create jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {number[]} request.jobs + * Required. The jobs to be created. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchCreateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchCreateJobsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.batchCreateJobs(request, options, callback); + } + batchUpdateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Begins executing a batch update jobs operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {number[]} request.jobs + * Required. The jobs to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Strongly recommended for the best service experience. Be aware that it will + * also increase latency when checking the status of a batch operation. + * + * If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, only the specified fields in + * [Job][google.cloud.talent.v4beta1.Job] are updated. Otherwise all the fields are updated. + * + * A field mask to restrict the fields that are updated. Only + * top level fields of [Job][google.cloud.talent.v4beta1.Job] are supported. + * + * If [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] is provided, The [Job][google.cloud.talent.v4beta1.Job] inside + * [JobResult][google.cloud.talent.v4beta1.JobOperationResult.JobResult] + * will only contains fields that is updated, plus the Id of the Job. + * Otherwise, [Job][google.cloud.talent.v4beta1.Job] will include all fields, which can yield a very + * large response. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchUpdateJobs( + request: protosTypes.google.cloud.talent.v4beta1.IBatchUpdateJobsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.talent.v4beta1.IJobOperationResult, + protosTypes.google.cloud.talent.v4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.batchUpdateJobs(request, options, callback); + } + listJobs( + request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.talent.v4beta1.IJob[], + protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListJobsResponse + ] + >; + listJobs( + request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.talent.v4beta1.IJob[], + protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListJobsResponse + > + ): void; + /** + * Lists jobs by filter. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the job is created. + * + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant + * is created. For example, "projects/foo". + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. + * + * Supported operator: =, AND + * + * The fields eligible for filtering are: + * + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. + * + * Sample Query: + * + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" + * @param {string} request.pageToken + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. + * + * If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. + * + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] if no value is + * specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Job]{@link google.cloud.talent.v4beta1.Job}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Job]{@link google.cloud.talent.v4beta1.Job} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListJobsRequest]{@link google.cloud.talent.v4beta1.ListJobsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListJobsResponse]{@link google.cloud.talent.v4beta1.ListJobsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listJobs( + request: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.talent.v4beta1.IJob[], + protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListJobsResponse + >, + callback?: Callback< + protosTypes.google.cloud.talent.v4beta1.IJob[], + protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListJobsResponse + > + ): Promise< + [ + protosTypes.google.cloud.talent.v4beta1.IJob[], + protosTypes.google.cloud.talent.v4beta1.IListJobsRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListJobsResponse ] > | void { request = request || {}; @@ -1483,13 +1388,13 @@ export class JobServiceClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); - return this._innerApiCalls.searchJobs(request, options, callback); + return this._innerApiCalls.listJobs(request, options, callback); } /** - * Equivalent to {@link searchJobs}, but returns a NodeJS Stream object. + * Equivalent to {@link listJobs}, but returns a NodeJS Stream object. * - * This fetches the paged responses for {@link searchJobs} continuously + * This fetches the paged responses for {@link listJobs} continuously * and invokes the callback registered for 'data' event for each element in the * responses. * @@ -1502,244 +1407,50 @@ export class JobServiceClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the tenant to search within. + * Required. The resource name of the tenant under which the job is created. * * The format is "projects/{project_id}/tenants/{tenant_id}". For example, * "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant * is created. For example, "projects/foo". - * @param {google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode} request.searchMode - * Mode of a search. - * - * Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. - * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata - * Required. The meta information collected about the job searcher, used to improve the - * search quality of the service. The identifiers (such as `user_id`) are - * provided by users, and must be unique and consistent. - * @param {google.cloud.talent.v4beta1.JobQuery} request.jobQuery - * Query used to search against jobs, such as keyword, location filters, etc. - * @param {boolean} request.enableBroadening - * Controls whether to broaden the search when it produces sparse results. - * Broadened queries append results to the end of the matching results - * list. - * - * Defaults to false. - * @param {boolean} request.requirePreciseResultSize - * Controls if the search job request requires the return of a precise - * count of the first 300 results. Setting this to `true` ensures - * consistency in the number of results per page. Best practice is to set this - * value to true if a client allows users to jump directly to a - * non-sequential search results page. - * - * Enabling this flag may adversely impact performance. - * - * Defaults to false. - * @param {number[]} request.histogramQueries - * An expression specifies a histogram request against matching jobs. - * - * Expression syntax is an aggregation function call with histogram facets and - * other options. - * - * Available aggregation function calls are: - * * `count(string_histogram_facet)`: Count the number of matching entities, - * for each distinct attribute value. - * * `count(numeric_histogram_facet, list of buckets)`: Count the number of - * matching entities within each bucket. - * - * Data types: - * - * * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. - * * String: string like "any string with backslash escape for quote(\")." - * * Number: whole number and floating point number like 10, -1 and -0.01. - * * List: list of elements with comma(,) separator surrounded by square - * brackets, for example, [1, 2, 3] and ["one", "two", "three"]. - * - * Built-in constants: - * - * * MIN (minimum number similar to java Double.MIN_VALUE) - * * MAX (maximum number similar to java Double.MAX_VALUE) - * - * Built-in functions: - * - * * bucket(start, end[, label]): bucket built-in function creates a bucket - * with range of [start, end). Note that the end is exclusive, for example, - * bucket(1, MAX, "positive number") or bucket(1, 10). - * - * Job histogram facets: - * - * * company_display_name: histogram by [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name]. - * * employment_type: histogram by [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types], for example, - * "FULL_TIME", "PART_TIME". - * * company_size: histogram by [CompanySize][google.cloud.talent.v4beta1.CompanySize], for example, "SMALL", - * "MEDIUM", "BIG". - * * publish_time_in_month: histogram by the [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] - * in months. - * Must specify list of numeric buckets in spec. - * * publish_time_in_year: histogram by the [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] - * in years. - * Must specify list of numeric buckets in spec. - * * degree_types: histogram by the [Job.degree_types][google.cloud.talent.v4beta1.Job.degree_types], for example, - * "Bachelors", "Masters". - * * job_level: histogram by the [Job.job_level][google.cloud.talent.v4beta1.Job.job_level], for example, "Entry - * Level". - * * country: histogram by the country code of jobs, for example, "US", "FR". - * * admin1: histogram by the admin1 code of jobs, which is a global - * placeholder referring to the state, province, or the particular term a - * country uses to define the geographic structure below the country level, - * for example, "CA", "IL". - * * city: histogram by a combination of the "city name, admin1 code". For - * example, "Mountain View, CA", "New York, NY". - * * admin1_country: histogram by a combination of the "admin1 code, country", - * for example, "CA, US", "IL, US". - * * city_coordinate: histogram by the city center's GPS coordinates (latitude - * and longitude), for example, 37.4038522,-122.0987765. Since the - * coordinates of a city center can change, customers may need to refresh - * them periodically. - * * locale: histogram by the [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], for example, "en-US", - * "fr-FR". - * * language: histogram by the language subtag of the [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], - * for example, "en", "fr". - * * category: histogram by the [JobCategory][google.cloud.talent.v4beta1.JobCategory], for example, - * "COMPUTER_AND_IT", "HEALTHCARE". - * * base_compensation_unit: histogram by the - * [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit] of base - * salary, for example, "WEEKLY", "MONTHLY". - * * base_compensation: histogram by the base salary. Must specify list of - * numeric buckets to group results by. - * * annualized_base_compensation: histogram by the base annualized salary. - * Must specify list of numeric buckets to group results by. - * * annualized_total_compensation: histogram by the total annualized salary. - * Must specify list of numeric buckets to group results by. - * * string_custom_attribute: histogram by string [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. - * Values can be accessed via square bracket notations like - * string_custom_attribute["key1"]. - * * numeric_custom_attribute: histogram by numeric [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. - * Values can be accessed via square bracket notations like - * numeric_custom_attribute["key1"]. Must specify list of numeric buckets to - * group results by. + * @param {string} request.filter + * Required. The filter string specifies the jobs to be enumerated. * - * Example expressions: + * Supported operator: =, AND * - * * `count(admin1)` - * * `count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), - * bucket(100000, MAX)])` - * * `count(string_custom_attribute["some-string-custom-attribute"])` - * * `count(numeric_custom_attribute["some-numeric-custom-attribute"], - * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])` - * @param {google.cloud.talent.v4beta1.JobView} request.jobView - * The desired job attributes returned for jobs in the search response. - * Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL] if no value is specified. - * @param {number} request.offset - * An integer that specifies the current offset (that is, starting result - * location, amongst the jobs deemed by the API as relevant) in search - * results. This field is only considered if [page_token][google.cloud.talent.v4beta1.SearchJobsRequest.page_token] is unset. + * The fields eligible for filtering are: * - * The maximum allowed value is 5000. Otherwise an error is thrown. + * * `companyName` (Required) + * * `requisitionId` + * * `status` Available values: OPEN, EXPIRED, ALL. Defaults to + * OPEN if no value is specified. * - * The maximum allowed value is 5000. Otherwise an error is thrown. + * Sample Query: * - * For example, 0 means to return results starting from the first matching - * job, and 10 means to return from the 11th job. This can be used for - * pagination, (for example, pageSize = 10 and offset = 10 means to return - * from the second page). - * @param {number} request.pageSize - * A limit on the number of jobs returned in the search results. - * Increasing this value above the default value of 10 can increase search - * response time. The value can be between 1 and 100. + * * companyName = "projects/foo/tenants/bar/companies/baz" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * requisitionId = "req-1" + * * companyName = "projects/foo/tenants/bar/companies/baz" AND + * status = "EXPIRED" * @param {string} request.pageToken - * The token specifying the current offset within - * search results. See [SearchJobsResponse.next_page_token][google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token] for - * an explanation of how to obtain the next set of query results. - * @param {string} request.orderBy - * The criteria determining how search results are sorted. Default is - * `"relevance desc"`. - * - * Supported options are: - * - * * `"relevance desc"`: By relevance descending, as determined by the API - * algorithms. Relevance thresholding of query results is only available - * with this ordering. - * * `"posting_publish_time desc"`: By [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] - * descending. - * * `"posting_update_time desc"`: By [Job.posting_update_time][google.cloud.talent.v4beta1.Job.posting_update_time] - * descending. - * * `"title"`: By [Job.title][google.cloud.talent.v4beta1.Job.title] ascending. - * * `"title desc"`: By [Job.title][google.cloud.talent.v4beta1.Job.title] descending. - * * `"annualized_base_compensation"`: By job's - * [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] ascending. Jobs - * whose annualized base compensation is unspecified are put at the end of - * search results. - * * `"annualized_base_compensation desc"`: By job's - * [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] descending. Jobs - * whose annualized base compensation is unspecified are put at the end of - * search results. - * * `"annualized_total_compensation"`: By job's - * [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] ascending. Jobs - * whose annualized base compensation is unspecified are put at the end of - * search results. - * * `"annualized_total_compensation desc"`: By job's - * [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] descending. Jobs - * whose annualized base compensation is unspecified are put at the end of - * search results. - * * `"custom_ranking desc"`: By the relevance score adjusted to the - * [SearchJobsRequest.CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression] with weight - * factor assigned by - * [SearchJobsRequest.CustomRankingInfo.importance_level][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level] in descending - * order. - * * Location sorting: Use the special syntax to order jobs by distance:
- * `"distance_from('Hawaii')"`: Order by distance from Hawaii.
- * `"distance_from(19.89, 155.5)"`: Order by distance from a coordinate.
- * `"distance_from('Hawaii'), distance_from('Puerto Rico')"`: Order by - * multiple locations. See details below.
- * `"distance_from('Hawaii'), distance_from(19.89, 155.5)"`: Order by - * multiple locations. See details below.
- * The string can have a maximum of 256 characters. When multiple distance - * centers are provided, a job that is close to any of the distance centers - * would have a high rank. When a job has multiple locations, the job - * location closest to one of the distance centers will be used. Jobs that - * don't have locations will be ranked at the bottom. Distance is calculated - * with a precision of 11.3 meters (37.4 feet). Diversification strategy is - * still applied unless explicitly disabled in - * [diversification_level][google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level]. - * @param {google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel} request.diversificationLevel - * Controls whether highly similar jobs are returned next to each other in - * the search results. Jobs are identified as highly similar based on - * their titles, job categories, and locations. Highly similar results are - * clustered so that only one representative job of the cluster is - * displayed to the job seeker higher up in the results, with the other jobs - * being displayed lower down in the results. - * - * Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value - * is specified. - * @param {google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo} request.customRankingInfo - * Controls over how job documents get ranked on top of existing relevance - * score (determined by API algorithm). - * @param {boolean} request.disableKeywordMatch - * Controls whether to disable exact keyword match on [Job.title][google.cloud.talent.v4beta1.Job.title], - * [Job.description][google.cloud.talent.v4beta1.Job.description], [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name], [Job.addresses][google.cloud.talent.v4beta1.Job.addresses], - * [Job.qualifications][google.cloud.talent.v4beta1.Job.qualifications]. When disable keyword match is turned off, a - * keyword match returns jobs that do not match given category filters when - * there are matching keywords. For example, for the query "program manager," - * a result is returned even if the job posting has the title "software - * developer," which doesn't fall into "program manager" ontology, but does - * have "program manager" appearing in its description. - * - * For queries like "cloud" that don't contain title or - * location specific ontology, jobs with "cloud" keyword matches are returned - * regardless of this flag's value. + * The starting point of a query result. + * @param {number} request.pageSize + * The maximum number of jobs to be returned per page of results. * - * Use [Company.keyword_searchable_job_custom_attributes][google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes] if - * company-specific globally matched custom field/attribute string values are - * needed. Enabling keyword match improves recall of subsequent search - * requests. + * If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed + * page size is 1000. Otherwise, the maximum allowed page size is 100. * - * Defaults to false. + * Default is 100 if empty or a number < 1 is specified. + * @param {google.cloud.talent.v4beta1.JobView} request.jobView + * The desired job attributes returned for jobs in the + * search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] if no value is + * specified. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing [MatchingJob]{@link google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob} on 'data' event. + * An object stream which emits an object representing [Job]{@link google.cloud.talent.v4beta1.Job} on 'data' event. */ - searchJobsStream( - request?: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest, + listJobsStream( + request?: protosTypes.google.cloud.talent.v4beta1.IListJobsRequest, options?: gax.CallOptions ): Transform { request = request || {}; @@ -1752,8 +1463,8 @@ export class JobServiceClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); - return this._descriptors.page.searchJobs.createStream( - this._innerApiCalls.searchJobs as gax.GaxCall, + return this._descriptors.page.listJobs.createStream( + this._innerApiCalls.listJobs as gax.GaxCall, request, callSettings ); diff --git a/packages/google-cloud-talent/src/v4beta1/profile_service_client.ts b/packages/google-cloud-talent/src/v4beta1/profile_service_client.ts index c605ef946c4..fefdc06e3a0 100644 --- a/packages/google-cloud-talent/src/v4beta1/profile_service_client.ts +++ b/packages/google-cloud-talent/src/v4beta1/profile_service_client.ts @@ -175,11 +175,6 @@ export class ProfileServiceClient { 'nextPageToken', 'profiles' ), - searchProfiles: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'histogramQueryResults' - ), }; // Put together the default options sent with requests. @@ -658,224 +653,27 @@ export class ProfileServiceClient { }); return this._innerApiCalls.deleteProfile(request, options, callback); } - - listProfiles( - request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, - options?: gax.CallOptions - ): Promise< - [ - protosTypes.google.cloud.talent.v4beta1.IProfile[], - protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse - ] - >; - listProfiles( - request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, - options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.talent.v4beta1.IProfile[], - protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse - > - ): void; - /** - * Lists profiles by filter. The order is unspecified. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant under which the profile is created. - * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenants/bar". - * @param {string} request.filter - * The filter string specifies the profiles to be enumerated. - * - * Supported operator: =, AND - * - * The field(s) eligible for filtering are: - * - * * `externalId` - * * `groupId` - * - * externalId and groupId cannot be specified at the same time. If both - * externalId and groupId are provided, the API will return a bad request - * error. - * - * Sample Query: - * - * * externalId = "externalId-1" - * * groupId = "groupId-1" - * @param {string} request.pageToken - * The token that specifies the current offset (that is, starting result). - * - * Please set the value to [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] to - * continue the list. - * @param {number} request.pageSize - * The maximum number of profiles to be returned, at most 100. - * - * Default is 100 unless a positive number smaller than 100 is specified. - * @param {google.protobuf.FieldMask} request.readMask - * A field mask to specify the profile fields to be listed in response. - * All fields are listed if it is unset. - * - * Valid values are: - * - * * name - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Profile]{@link google.cloud.talent.v4beta1.Profile}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Profile]{@link google.cloud.talent.v4beta1.Profile} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListProfilesRequest]{@link google.cloud.talent.v4beta1.ListProfilesRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListProfilesResponse]{@link google.cloud.talent.v4beta1.ListProfilesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - listProfiles( - request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protosTypes.google.cloud.talent.v4beta1.IProfile[], - protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse - >, - callback?: Callback< - protosTypes.google.cloud.talent.v4beta1.IProfile[], - protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse - > - ): Promise< - [ - protosTypes.google.cloud.talent.v4beta1.IProfile[], - protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse - ] - > | void { - request = request || {}; - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - return this._innerApiCalls.listProfiles(request, options, callback); - } - - /** - * Equivalent to {@link listProfiles}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProfiles} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the tenant under which the profile is created. - * - * The format is "projects/{project_id}/tenants/{tenant_id}". For example, - * "projects/foo/tenants/bar". - * @param {string} request.filter - * The filter string specifies the profiles to be enumerated. - * - * Supported operator: =, AND - * - * The field(s) eligible for filtering are: - * - * * `externalId` - * * `groupId` - * - * externalId and groupId cannot be specified at the same time. If both - * externalId and groupId are provided, the API will return a bad request - * error. - * - * Sample Query: - * - * * externalId = "externalId-1" - * * groupId = "groupId-1" - * @param {string} request.pageToken - * The token that specifies the current offset (that is, starting result). - * - * Please set the value to [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] to - * continue the list. - * @param {number} request.pageSize - * The maximum number of profiles to be returned, at most 100. - * - * Default is 100 unless a positive number smaller than 100 is specified. - * @param {google.protobuf.FieldMask} request.readMask - * A field mask to specify the profile fields to be listed in response. - * All fields are listed if it is unset. - * - * Valid values are: - * - * * name - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile} on 'data' event. - */ - listProfilesStream( - request?: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, - options?: gax.CallOptions - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); - const callSettings = new gax.CallSettings(options); - return this._descriptors.page.listProfiles.createStream( - this._innerApiCalls.listProfiles as gax.GaxCall, - request, - callSettings - ); - } searchProfiles( request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.talent.v4beta1.IHistogramQueryResult[], - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse + protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse, + ( + | protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest + | undefined + ), + {} | undefined ] >; searchProfiles( request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.talent.v4beta1.IHistogramQueryResult[], - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse + protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse, + | protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest + | undefined, + {} | undefined > ): void; /** @@ -1063,19 +861,7 @@ export class ProfileServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [HistogramQueryResult]{@link google.cloud.talent.v4beta1.HistogramQueryResult}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [HistogramQueryResult]{@link google.cloud.talent.v4beta1.HistogramQueryResult} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [SearchProfilesRequest]{@link google.cloud.talent.v4beta1.SearchProfilesRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [SearchProfilesResponse]{@link google.cloud.talent.v4beta1.SearchProfilesResponse}. - * + * The first element of the array is an object representing [SearchProfilesResponse]{@link google.cloud.talent.v4beta1.SearchProfilesResponse}. * The promise has a method named "cancel" which cancels the ongoing API call. */ searchProfiles( @@ -1083,20 +869,25 @@ export class ProfileServiceClient { optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.talent.v4beta1.IHistogramQueryResult[], - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse + protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse, + | protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest + | undefined, + {} | undefined >, callback?: Callback< - protosTypes.google.cloud.talent.v4beta1.IHistogramQueryResult[], - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse + protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse, + | protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest + | undefined, + {} | undefined > ): Promise< [ - protosTypes.google.cloud.talent.v4beta1.IHistogramQueryResult[], - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest | null, - protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse + protosTypes.google.cloud.talent.v4beta1.ISearchProfilesResponse, + ( + | protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest + | undefined + ), + {} | undefined ] > | void { request = request || {}; @@ -1118,200 +909,188 @@ export class ProfileServiceClient { return this._innerApiCalls.searchProfiles(request, options, callback); } + listProfiles( + request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.talent.v4beta1.IProfile[], + protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse + ] + >; + listProfiles( + request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.talent.v4beta1.IProfile[], + protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse + > + ): void; /** - * Equivalent to {@link searchProfiles}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link searchProfiles} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} + * Lists profiles by filter. The order is unspecified. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The resource name of the tenant to search within. + * Required. The resource name of the tenant under which the profile is created. * * The format is "projects/{project_id}/tenants/{tenant_id}". For example, * "projects/foo/tenants/bar". - * @param {google.cloud.talent.v4beta1.RequestMetadata} request.requestMetadata - * Required. The meta information collected about the profile search user. This is used - * to improve the search quality of the service. These values are provided by - * users, and must be precise and consistent. - * @param {google.cloud.talent.v4beta1.ProfileQuery} request.profileQuery - * Search query to execute. See [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for more details. - * @param {number} request.pageSize - * A limit on the number of profiles returned in the search results. - * A value above the default value 10 can increase search response time. + * @param {string} request.filter + * The filter string specifies the profiles to be enumerated. * - * The maximum value allowed is 100. Otherwise an error is thrown. + * Supported operator: =, AND + * + * The field(s) eligible for filtering are: + * + * * `externalId` + * * `groupId` + * + * externalId and groupId cannot be specified at the same time. If both + * externalId and groupId are provided, the API will return a bad request + * error. + * + * Sample Query: + * + * * externalId = "externalId-1" + * * groupId = "groupId-1" * @param {string} request.pageToken - * The pageToken, similar to offset enables users of the API to paginate - * through the search results. To retrieve the first page of results, set the - * pageToken to empty. The search response includes a - * [nextPageToken][google.cloud.talent.v4beta1.SearchProfilesResponse.next_page_token] field that can be - * used to populate the pageToken field for the next page of results. Using - * pageToken instead of offset increases the performance of the API, - * especially compared to larger offset values. - * @param {number} request.offset - * An integer that specifies the current offset (that is, starting result) in - * search results. This field is only considered if [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] is unset. + * The token that specifies the current offset (that is, starting result). * - * The maximum allowed value is 5000. Otherwise an error is thrown. + * Please set the value to [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] to + * continue the list. + * @param {number} request.pageSize + * The maximum number of profiles to be returned, at most 100. * - * For example, 0 means to search from the first profile, and 10 means to - * search from the 11th profile. This can be used for pagination, for example - * pageSize = 10 and offset = 10 means to search from the second page. - * @param {boolean} request.disableSpellCheck - * This flag controls the spell-check feature. If `false`, the - * service attempts to correct a misspelled query. + * Default is 100 unless a positive number smaller than 100 is specified. + * @param {google.protobuf.FieldMask} request.readMask + * A field mask to specify the profile fields to be listed in response. + * All fields are listed if it is unset. * - * For example, "enginee" is corrected to "engineer". - * @param {string} request.orderBy - * The criteria that determines how search results are sorted. - * Defaults is "relevance desc" if no value is specified. + * Valid values are: * - * Supported options are: + * * name + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Profile]{@link google.cloud.talent.v4beta1.Profile}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. * - * * "relevance desc": By descending relevance, as determined by the API - * algorithms. - * * "update_date desc": Sort by [Profile.update_time][google.cloud.talent.v4beta1.Profile.update_time] in descending order - * (recently updated profiles first). - * * "create_date desc": Sort by [Profile.create_time][google.cloud.talent.v4beta1.Profile.create_time] in descending order - * (recently created profiles first). - * * "first_name": Sort by [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] in - * ascending order. - * * "first_name desc": Sort by [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] - * in descending order. - * * "last_name": Sort by [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] in - * ascending order. - * * "last_name desc": Sort by [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] - * in ascending order. - * @param {boolean} request.caseSensitiveSort - * When sort by field is based on alphabetical order, sort values case - * sensitively (based on ASCII) when the value is set to true. Default value - * is case in-sensitive sort (false). - * @param {number[]} request.histogramQueries - * A list of expressions specifies histogram requests against matching - * profiles for [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Profile]{@link google.cloud.talent.v4beta1.Profile} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProfilesRequest]{@link google.cloud.talent.v4beta1.ListProfilesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProfilesResponse]{@link google.cloud.talent.v4beta1.ListProfilesResponse}. * - * The expression syntax looks like a function definition with parameters. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProfiles( + request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.talent.v4beta1.IProfile[], + protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse + >, + callback?: Callback< + protosTypes.google.cloud.talent.v4beta1.IProfile[], + protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse + > + ): Promise< + [ + protosTypes.google.cloud.talent.v4beta1.IProfile[], + protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest | null, + protosTypes.google.cloud.talent.v4beta1.IListProfilesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProfiles(request, options, callback); + } + + /** + * Equivalent to {@link listProfiles}, but returns a NodeJS Stream object. * - * Function syntax: function_name(histogram_facet[, list of buckets]) + * This fetches the paged responses for {@link listProfiles} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. * - * Data types: + * The returned object has 'end' method when no more elements are required. * - * * Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+. - * * String: string like "any string with backslash escape for quote(\")." - * * Number: whole number and floating point number like 10, -1 and -0.01. - * * List: list of elements with comma(,) separator surrounded by square - * brackets. For example, [1, 2, 3] and ["one", "two", "three"]. + * autoPaginate option will be ignored. * - * Built-in constants: + * @see {@link https://nodejs.org/api/stream.html} * - * * MIN (minimum number similar to java Double.MIN_VALUE) - * * MAX (maximum number similar to java Double.MAX_VALUE) + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the tenant under which the profile is created. * - * Built-in functions: + * The format is "projects/{project_id}/tenants/{tenant_id}". For example, + * "projects/foo/tenants/bar". + * @param {string} request.filter + * The filter string specifies the profiles to be enumerated. * - * * bucket(start, end[, label]) - * Bucket build-in function creates a bucket with range of [start, end). Note - * that the end is exclusive. - * For example, bucket(1, MAX, "positive number") or bucket(1, 10). + * Supported operator: =, AND * - * Histogram Facets: + * The field(s) eligible for filtering are: * - * * admin1: Admin1 is a global placeholder for referring to state, province, - * or the particular term a country uses to define the geographic structure - * below the country level. Examples include states codes such as "CA", "IL", - * "NY", and provinces, such as "BC". - * * locality: Locality is a global placeholder for referring to city, town, - * or the particular term a country uses to define the geographic structure - * below the admin1 level. Examples include city names such as - * "Mountain View" and "New York". - * * extended_locality: Extended locality is concatenated version of admin1 - * and locality with comma separator. For example, "Mountain View, CA" and - * "New York, NY". - * * postal_code: Postal code of profile which follows locale code. - * * country: Country code (ISO-3166-1 alpha-2 code) of profile, such as US, - * JP, GB. - * * job_title: Normalized job titles specified in EmploymentHistory. - * * company_name: Normalized company name of profiles to match on. - * * institution: The school name. For example, "MIT", - * "University of California, Berkeley" - * * degree: Highest education degree in ISCED code. Each value in degree - * covers a specific level of education, without any expansion to upper nor - * lower levels of education degree. - * * experience_in_months: experience in months. 0 means 0 month to 1 month - * (exclusive). - * * application_date: The application date specifies application start dates. - * See [ApplicationDateFilter][google.cloud.talent.v4beta1.ApplicationDateFilter] for more details. - * * application_outcome_notes: The application outcome reason specifies the - * reasons behind the outcome of the job application. - * See [ApplicationOutcomeNotesFilter][google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter] for more details. - * * application_job_title: The application job title specifies the job - * applied for in the application. - * See [ApplicationJobFilter][google.cloud.talent.v4beta1.ApplicationJobFilter] for more details. - * * hirable_status: Hirable status specifies the profile's hirable status. - * * string_custom_attribute: String custom attributes. Values can be accessed - * via square bracket notation like string_custom_attribute["key1"]. - * * numeric_custom_attribute: Numeric custom attributes. Values can be - * accessed via square bracket notation like numeric_custom_attribute["key1"]. + * * `externalId` + * * `groupId` * - * Example expressions: + * externalId and groupId cannot be specified at the same time. If both + * externalId and groupId are provided, the API will return a bad request + * error. * - * * count(admin1) - * * count(experience_in_months, [bucket(0, 12, "1 year"), - * bucket(12, 36, "1-3 years"), bucket(36, MAX, "3+ years")]) - * * count(string_custom_attribute["assigned_recruiter"]) - * * count(numeric_custom_attribute["favorite_number"], - * [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative")]) - * @param {string} request.resultSetId - * An id that uniquely identifies the result set of a - * [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles] call. The id should be - * retrieved from the - * [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] message returned from a previous - * invocation of [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles]. + * Sample Query: * - * A result set is an ordered list of search results. + * * externalId = "externalId-1" + * * groupId = "groupId-1" + * @param {string} request.pageToken + * The token that specifies the current offset (that is, starting result). * - * If this field is not set, a new result set is computed based on the - * [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query]. A new [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] is returned as a handle to - * access this result set. + * Please set the value to [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] to + * continue the list. + * @param {number} request.pageSize + * The maximum number of profiles to be returned, at most 100. * - * If this field is set, the service will ignore the resource and - * [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query] values, and simply retrieve a page of results from the - * corresponding result set. In this case, one and only one of [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] - * or [offset][google.cloud.talent.v4beta1.SearchProfilesRequest.offset] must be set. + * Default is 100 unless a positive number smaller than 100 is specified. + * @param {google.protobuf.FieldMask} request.readMask + * A field mask to specify the profile fields to be listed in response. + * All fields are listed if it is unset. * - * A typical use case is to invoke [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] without this - * field, then use the resulting [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] in - * [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] to page through the results. - * @param {boolean} request.strictKeywordsSearch - * This flag is used to indicate whether the service will attempt to - * understand synonyms and terms related to the search query or treat the - * query "as is" when it generates a set of results. By default this flag is - * set to false, thus allowing expanded results to also be returned. For - * example a search for "software engineer" might also return candidates who - * have experience in jobs similar to software engineer positions. By setting - * this flag to true, the service will only attempt to deliver candidates has - * software engineer in his/her global fields by treating "software engineer" - * as a keyword. + * Valid values are: * - * It is recommended to provide a feature in the UI (such as a checkbox) to - * allow recruiters to set this flag to true if they intend to search for - * longer boolean strings. + * * name * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} - * An object stream which emits an object representing [HistogramQueryResult]{@link google.cloud.talent.v4beta1.HistogramQueryResult} on 'data' event. + * An object stream which emits an object representing [Profile]{@link google.cloud.talent.v4beta1.Profile} on 'data' event. */ - searchProfilesStream( - request?: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest, + listProfilesStream( + request?: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest, options?: gax.CallOptions ): Transform { request = request || {}; @@ -1324,8 +1103,8 @@ export class ProfileServiceClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); - return this._descriptors.page.searchProfiles.createStream( - this._innerApiCalls.searchProfiles as gax.GaxCall, + return this._descriptors.page.listProfiles.createStream( + this._innerApiCalls.listProfiles as gax.GaxCall, request, callSettings ); diff --git a/packages/google-cloud-talent/synth.metadata b/packages/google-cloud-talent/synth.metadata index 4d4eac05fa6..625f8d18f6c 100644 --- a/packages/google-cloud-talent/synth.metadata +++ b/packages/google-cloud-talent/synth.metadata @@ -1,12 +1,13 @@ { - "updateTime": "2020-02-27T03:28:38.073716Z", + "updateTime": "2020-02-29T12:45:30.182209Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dafc905f71e5d46f500b41ed715aad585be062c3", - "internalRef": "297486523" + "sha": "83c6f84035ee0f80eaa44d8b688a010461cc4080", + "internalRef": "297918498", + "log": "83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\ne9e90a787703ec5d388902e2cb796aaed3a385b4\nDialogflow weekly v2/v2beta1 library update:\n - adding get validation result\n - adding field mask override control for output audio config\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 297671458\n\n1a2b05cc3541a5f7714529c665aecc3ea042c646\nAdding .yaml and .json config files.\n\nPiperOrigin-RevId: 297570622\n\ndfe1cf7be44dee31d78f78e485d8c95430981d6e\nPublish `QueryOptions` proto.\n\nIntroduced a `query_options` input in `ExecuteSqlRequest`.\n\nPiperOrigin-RevId: 297497710\n\n" } }, { diff --git a/packages/google-cloud-talent/test/gapic-job_service-v4beta1.ts b/packages/google-cloud-talent/test/gapic-job_service-v4beta1.ts index 34320682fdd..b823311cf66 100644 --- a/packages/google-cloud-talent/test/gapic-job_service-v4beta1.ts +++ b/packages/google-cloud-talent/test/gapic-job_service-v4beta1.ts @@ -340,6 +340,54 @@ describe('v4beta1.JobServiceClient', () => { }); }); }); + describe('searchJobs', () => { + it('invokes searchJobs without error', done => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.searchJobs = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.searchJobs(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes searchJobs with error', done => { + const client = new jobserviceModule.v4beta1.JobServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.searchJobs = mockSimpleGrpcMethod( + request, + null, + error + ); + client.searchJobs(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); describe('batchCreateJobs', () => { it('invokes batchCreateJobs without error', done => { const client = new jobserviceModule.v4beta1.JobServiceClient({ @@ -525,65 +573,6 @@ describe('v4beta1.JobServiceClient', () => { stream.write(expectedResponse); }); }); - describe('searchJobs', () => { - it('invokes searchJobs without error', done => { - const client = new jobserviceModule.v4beta1.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.searchJobs = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.searchJobs(request, (err: FakeError, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - }); - describe('searchJobsStream', () => { - it('invokes searchJobsStream without error', done => { - const client = new jobserviceModule.v4beta1.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.ISearchJobsRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.searchJobs = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .searchJobsStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); - }); - }); describe('searchJobsForAlert', () => { it('invokes searchJobsForAlert without error', done => { const client = new jobserviceModule.v4beta1.JobServiceClient({ diff --git a/packages/google-cloud-talent/test/gapic-profile_service-v4beta1.ts b/packages/google-cloud-talent/test/gapic-profile_service-v4beta1.ts index 3eb295ae896..0fa46de23e4 100644 --- a/packages/google-cloud-talent/test/gapic-profile_service-v4beta1.ts +++ b/packages/google-cloud-talent/test/gapic-profile_service-v4beta1.ts @@ -277,78 +277,67 @@ describe('v4beta1.ProfileServiceClient', () => { }); }); }); - describe('listProfiles', () => { - it('invokes listProfiles without error', done => { + describe('searchProfiles', () => { + it('invokes searchProfiles without error', done => { const client = new profileserviceModule.v4beta1.ProfileServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest = {}; + const request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest = {}; request.parent = ''; // Mock response const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.listProfiles = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.listProfiles(request, (err: FakeError, response: {}) => { + // Mock gRPC layer + client._innerApiCalls.searchProfiles = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.searchProfiles(request, (err: {}, response: {}) => { assert.ifError(err); assert.deepStrictEqual(response, expectedResponse); done(); }); }); - }); - describe('listProfilesStream', () => { - it('invokes listProfilesStream without error', done => { + + it('invokes searchProfiles with error', done => { const client = new profileserviceModule.v4beta1.ProfileServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest = {}; + const request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest = {}; request.parent = ''; // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.listProfiles = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .listProfilesStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.searchProfiles = mockSimpleGrpcMethod( + request, + null, + error + ); + client.searchProfiles(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); }); }); - describe('searchProfiles', () => { - it('invokes searchProfiles without error', done => { + describe('listProfiles', () => { + it('invokes listProfiles without error', done => { const client = new profileserviceModule.v4beta1.ProfileServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest = {}; + const request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest = {}; request.parent = ''; // Mock response const expectedResponse = {}; // Mock Grpc layer - client._innerApiCalls.searchProfiles = ( + client._innerApiCalls.listProfiles = ( actualRequest: {}, options: {}, callback: Callback @@ -356,26 +345,26 @@ describe('v4beta1.ProfileServiceClient', () => { assert.deepStrictEqual(actualRequest, request); callback(null, expectedResponse); }; - client.searchProfiles(request, (err: FakeError, response: {}) => { + client.listProfiles(request, (err: FakeError, response: {}) => { assert.ifError(err); assert.deepStrictEqual(response, expectedResponse); done(); }); }); }); - describe('searchProfilesStream', () => { - it('invokes searchProfilesStream without error', done => { + describe('listProfilesStream', () => { + it('invokes listProfilesStream without error', done => { const client = new profileserviceModule.v4beta1.ProfileServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - const request: protosTypes.google.cloud.talent.v4beta1.ISearchProfilesRequest = {}; + const request: protosTypes.google.cloud.talent.v4beta1.IListProfilesRequest = {}; request.parent = ''; // Mock response const expectedResponse = {response: 'data'}; // Mock Grpc layer - client._innerApiCalls.searchProfiles = ( + client._innerApiCalls.listProfiles = ( actualRequest: {}, options: {}, callback: Callback @@ -384,7 +373,7 @@ describe('v4beta1.ProfileServiceClient', () => { callback(null, expectedResponse); }; const stream = client - .searchProfilesStream(request, {}) + .listProfilesStream(request, {}) .on('data', (response: {}) => { assert.deepStrictEqual(response, expectedResponse); done();