1 4
// Copyright 2020 Google LLC
2 4
//
3 4
// Licensed under the Apache License, Version 2.0 (the "License");
4 4
// you may not use this file except in compliance with the License.
5 4
// You may obtain a copy of the License at
6 4
//
7 4
//     https://www.apache.org/licenses/LICENSE-2.0
8 4
//
9 4
// Unless required by applicable law or agreed to in writing, software
10 4
// distributed under the License is distributed on an "AS IS" BASIS,
11 4
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 4
// See the License for the specific language governing permissions and
13 4
// limitations under the License.
14 4
//
15 4
// ** This file is automatically generated by gapic-generator-typescript. **
16 4
// ** https://github.com/googleapis/gapic-generator-typescript **
17 4
// ** All changes to this file may be overwritten. **
18 4

19 4
import * as gax from 'google-gax';
20 4
import {
21 4
  Callback,
22 4
  CallOptions,
23 4
  Descriptors,
24 4
  ClientOptions,
25 4
  LROperation,
26 4
  PaginationCallback,
27 4
  GaxCall,
28 4
} from 'google-gax';
29 4
import * as path from 'path';
30 4

31 4
import {Transform} from 'stream';
32 4
import {RequestType} from 'google-gax/build/src/apitypes';
33 4
import * as protos from '../../protos/protos';
34 4
import * as gapicConfig from './product_search_client_config.json';
35 4
import {operationsProtos} from 'google-gax';
36 4
const version = require('../../../package.json').version;
37 4

38 4
/**
39 4
 *  Manages Products and ProductSets of reference images for use in product
40 4
 *  search. It uses the following resource model:
41 4
 *
42 4
 *  - The API has a collection of
43 4
 *  {@link google.cloud.vision.v1p4beta1.ProductSet|ProductSet} resources, named
44 4
 *  `projects/* /locations/* /productSets/*`, which acts as a way to put different
45 4
 *  products into groups to limit identification.
46 4
 *
47 4
 *  In parallel,
48 4
 *
49 4
 *  - The API has a collection of
50 4
 *  {@link google.cloud.vision.v1p4beta1.Product|Product} resources, named
51 4
 *    `projects/* /locations/* /products/*`
52 4
 *
53 4
 *  - Each {@link google.cloud.vision.v1p4beta1.Product|Product} has a collection of
54 4
 *  {@link google.cloud.vision.v1p4beta1.ReferenceImage|ReferenceImage} resources,
55 4
 *  named
56 4
 *    `projects/* /locations/* /products/* /referenceImages/*`
57 4
 * @class
58 4
 * @memberof v1p4beta1
59 4
 */
60 4
export class ProductSearchClient {
61 4
  private _terminated = false;
62 4
  private _opts: ClientOptions;
63 4
  private _gaxModule: typeof gax | typeof gax.fallback;
64 4
  private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
65 4
  private _protos: {};
66 4
  private _defaults: {[method: string]: gax.CallSettings};
67 4
  auth: gax.GoogleAuth;
68 4
  descriptors: Descriptors = {
69 4
    page: {},
70 4
    stream: {},
71 4
    longrunning: {},
72 4
    batching: {},
73 4
  };
74 4
  innerApiCalls: {[name: string]: Function};
75 4
  pathTemplates: {[name: string]: gax.PathTemplate};
76 4
  operationsClient: gax.OperationsClient;
77 4
  productSearchStub?: Promise<{[name: string]: Function}>;
78 4

79 4
  /**
80 4
   * Construct an instance of ProductSearchClient.
81 4
   *
82 4
   * @param {object} [options] - The configuration object. See the subsequent
83 4
   *   parameters for more details.
84 4
   * @param {object} [options.credentials] - Credentials object.
85 4
   * @param {string} [options.credentials.client_email]
86 4
   * @param {string} [options.credentials.private_key]
87 4
   * @param {string} [options.email] - Account email address. Required when
88 4
   *     using a .pem or .p12 keyFilename.
89 4
   * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
90 4
   *     .p12 key downloaded from the Google Developers Console. If you provide
91 4
   *     a path to a JSON file, the projectId option below is not necessary.
92 4
   *     NOTE: .pem and .p12 require you to specify options.email as well.
93 4
   * @param {number} [options.port] - The port on which to connect to
94 4
   *     the remote host.
95 4
   * @param {string} [options.projectId] - The project ID from the Google
96 4
   *     Developer's Console, e.g. 'grape-spaceship-123'. We will also check
97 4
   *     the environment variable GCLOUD_PROJECT for your project ID. If your
98 4
   *     app is running in an environment which supports
99 4
   *     {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
100 4
   *     your project ID will be detected automatically.
101 4
   * @param {string} [options.apiEndpoint] - The domain name of the
102 4
   *     API remote host.
103 4
   */
104 4

105 4
  constructor(opts?: ClientOptions) {
106 4
    // Ensure that options include the service address and port.
107 4
    const staticMembers = this.constructor as typeof ProductSearchClient;
108 4
    const servicePath =
109 4
      opts && opts.servicePath
110 4
        ? opts.servicePath
111 4
        : opts && opts.apiEndpoint
112 4
        ? opts.apiEndpoint
113 4
        : staticMembers.servicePath;
114 4
    const port = opts && opts.port ? opts.port : staticMembers.port;
115 4

116 4
    if (!opts) {
117 4
      opts = {servicePath, port};
118 4
    }
119 4
    opts.servicePath = opts.servicePath || servicePath;
120 4
    opts.port = opts.port || port;
121 4

122 4
    // users can override the config from client side, like retry codes name.
123 4
    // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546
124 4
    // The way to override client config for Showcase API:
125 4
    //
126 4
    // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}}
127 4
    // const showcaseClient = new showcaseClient({ projectId, customConfig });
128 4
    opts.clientConfig = opts.clientConfig || {};
129 4

130 4
    // If we're running in browser, it's OK to omit `fallback` since
131 4
    // google-gax has `browser` field in its `package.json`.
132 4
    // For Electron (which does not respect `browser` field),
133 4
    // pass `{fallback: true}` to the ProductSearchClient constructor.
134 4
    this._gaxModule = opts.fallback ? gax.fallback : gax;
135 4

136 4
    // Create a `gaxGrpc` object, with any grpc-specific options
137 4
    // sent to the client.
138 4
    opts.scopes = (this.constructor as typeof ProductSearchClient).scopes;
139 4
    this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
140 4

141 4
    // Save options to use in initialize() method.
142 4
    this._opts = opts;
143 4

144 4
    // Save the auth object to the client, for use by other methods.
145 4
    this.auth = this._gaxGrpc.auth as gax.GoogleAuth;
146 4

147 4
    // Determine the client header string.
148 4
    const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
149 4
    if (typeof process !== 'undefined' && 'versions' in process) {
150 4
      clientHeader.push(`gl-node/${process.versions.node}`);
151 4
    } else {
152 0
      clientHeader.push(`gl-web/${this._gaxModule.version}`);
153 0
    }
154 4
    if (!opts.fallback) {
155 4
      clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
156 4
    }
157 4
    if (opts.libName && opts.libVersion) {
158 0
      clientHeader.push(`${opts.libName}/${opts.libVersion}`);
159 0
    }
160 4
    // Load the applicable protos.
161 4
    // For Node.js, pass the path to JSON proto file.
162 4
    // For browsers, pass the JSON content.
163 4

164 4
    const nodejsProtoPath = path.join(
165 4
      __dirname,
166 4
      '..',
167 4
      '..',
168 4
      'protos',
169 4
      'protos.json'
170 4
    );
171 4
    this._protos = this._gaxGrpc.loadProto(
172 4
      opts.fallback
173 4
        ? // eslint-disable-next-line @typescript-eslint/no-var-requires
174 4
          require('../../protos/protos.json')
175 4
        : nodejsProtoPath
176 4
    );
177 4

178 4
    // This API contains "path templates"; forward-slash-separated
179 4
    // identifiers to uniquely identify resources within the API.
180 4
    // Create useful helper objects for these.
181 4
    this.pathTemplates = {
182 4
      locationPathTemplate: new this._gaxModule.PathTemplate(
183 4
        'projects/{project}/locations/{location}'
184 4
      ),
185 4
      productPathTemplate: new this._gaxModule.PathTemplate(
186 4
        'projects/{project}/locations/{location}/products/{product}'
187 4
      ),
188 4
      productSetPathTemplate: new this._gaxModule.PathTemplate(
189 4
        'projects/{project}/locations/{location}/productSets/{product_set}'
190 4
      ),
191 4
      referenceImagePathTemplate: new this._gaxModule.PathTemplate(
192 4
        'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}'
193 4
      ),
194 4
    };
195 4

196 4
    // Some of the methods on this service return "paged" results,
197 4
    // (e.g. 50 results at a time, with tokens to get subsequent
198 4
    // pages). Denote the keys used for pagination and results.
199 4
    this.descriptors.page = {
200 4
      listProductSets: new this._gaxModule.PageDescriptor(
201 4
        'pageToken',
202 4
        'nextPageToken',
203 4
        'productSets'
204 4
      ),
205 4
      listProducts: new this._gaxModule.PageDescriptor(
206 4
        'pageToken',
207 4
        'nextPageToken',
208 4
        'products'
209 4
      ),
210 4
      listReferenceImages: new this._gaxModule.PageDescriptor(
211 4
        'pageToken',
212 4
        'nextPageToken',
213 4
        'referenceImages'
214 4
      ),
215 4
      listProductsInProductSet: new this._gaxModule.PageDescriptor(
216 4
        'pageToken',
217 4
        'nextPageToken',
218 4
        'products'
219 4
      ),
220 4
    };
221 4

222 4
    // This API contains "long-running operations", which return a
223 4
    // an Operation object that allows for tracking of the operation,
224 4
    // rather than holding a request open.
225 4
    const protoFilesRoot = opts.fallback
226 4
      ? this._gaxModule.protobuf.Root.fromJSON(
227 4
          // eslint-disable-next-line @typescript-eslint/no-var-requires
228 4
          require('../../protos/protos.json')
229 4
        )
230 4
      : this._gaxModule.protobuf.loadSync(nodejsProtoPath);
231 4

232 4
    this.operationsClient = this._gaxModule
233 4
      .lro({
234 4
        auth: this.auth,
235 4
        grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
236 4
      })
237 4
      .operationsClient(opts);
238 4
    const importProductSetsResponse = protoFilesRoot.lookup(
239 4
      '.google.cloud.vision.v1p4beta1.ImportProductSetsResponse'
240 4
    ) as gax.protobuf.Type;
241 4
    const importProductSetsMetadata = protoFilesRoot.lookup(
242 4
      '.google.cloud.vision.v1p4beta1.BatchOperationMetadata'
243 4
    ) as gax.protobuf.Type;
244 4
    const purgeProductsResponse = protoFilesRoot.lookup(
245 4
      '.google.protobuf.Empty'
246 4
    ) as gax.protobuf.Type;
247 4
    const purgeProductsMetadata = protoFilesRoot.lookup(
248 4
      '.google.cloud.vision.v1p4beta1.BatchOperationMetadata'
249 4
    ) as gax.protobuf.Type;
250 4

251 4
    this.descriptors.longrunning = {
252 4
      importProductSets: new this._gaxModule.LongrunningDescriptor(
253 4
        this.operationsClient,
254 4
        importProductSetsResponse.decode.bind(importProductSetsResponse),
255 4
        importProductSetsMetadata.decode.bind(importProductSetsMetadata)
256 4
      ),
257 4
      purgeProducts: new this._gaxModule.LongrunningDescriptor(
258 4
        this.operationsClient,
259 4
        purgeProductsResponse.decode.bind(purgeProductsResponse),
260 4
        purgeProductsMetadata.decode.bind(purgeProductsMetadata)
261 4
      ),
262 4
    };
263 4

264 4
    // Put together the default options sent with requests.
265 4
    this._defaults = this._gaxGrpc.constructSettings(
266 4
      'google.cloud.vision.v1p4beta1.ProductSearch',
267 4
      gapicConfig as gax.ClientConfig,
268 4
      opts.clientConfig || {},
269 4
      {'x-goog-api-client': clientHeader.join(' ')}
270 4
    );
271 4

272 4
    // Set up a dictionary of "inner API calls"; the core implementation
273 4
    // of calling the API is handled in `google-gax`, with this code
274 4
    // merely providing the destination and request information.
275 4
    this.innerApiCalls = {};
276 4
  }
277 4

278 4
  /**
279 4
   * Initialize the client.
280 4
   * Performs asynchronous operations (such as authentication) and prepares the client.
281 4
   * This function will be called automatically when any class method is called for the
282 4
   * first time, but if you need to initialize it before calling an actual method,
283 4
   * feel free to call initialize() directly.
284 4
   *
285 4
   * You can await on this method if you want to make sure the client is initialized.
286 4
   *
287 4
   * @returns {Promise} A promise that resolves to an authenticated service stub.
288 4
   */
289 4
  initialize() {
290 4
    // If the client stub promise is already initialized, return immediately.
291 4
    if (this.productSearchStub) {
292 4
      return this.productSearchStub;
293 4
    }
294 4

295 4
    // Put together the "service stub" for
296 4
    // google.cloud.vision.v1p4beta1.ProductSearch.
297 4
    this.productSearchStub = this._gaxGrpc.createStub(
298 4
      this._opts.fallback
299 4
        ? (this._protos as protobuf.Root).lookupService(
300 0
            'google.cloud.vision.v1p4beta1.ProductSearch'
301 4
          )
302 4
        : // eslint-disable-next-line @typescript-eslint/no-explicit-any
303 4
          (this._protos as any).google.cloud.vision.v1p4beta1.ProductSearch,
304 4
      this._opts
305 4
    ) as Promise<{[method: string]: Function}>;
306 4

307 4
    // Iterate over each of the methods that the service provides
308 4
    // and create an API call method for each.
309 4
    const productSearchStubMethods = [
310 4
      'createProductSet',
311 4
      'listProductSets',
312 4
      'getProductSet',
313 4
      'updateProductSet',
314 4
      'deleteProductSet',
315 4
      'createProduct',
316 4
      'listProducts',
317 4
      'getProduct',
318 4
      'updateProduct',
319 4
      'deleteProduct',
320 4
      'createReferenceImage',
321 4
      'deleteReferenceImage',
322 4
      'listReferenceImages',
323 4
      'getReferenceImage',
324 4
      'addProductToProductSet',
325 4
      'removeProductFromProductSet',
326 4
      'listProductsInProductSet',
327 4
      'importProductSets',
328 4
      'purgeProducts',
329 4
    ];
330 4
    for (const methodName of productSearchStubMethods) {
331 4
      const callPromise = this.productSearchStub.then(
332 4
        stub => (...args: Array<{}>) => {
333 0
          if (this._terminated) {
334 0
            return Promise.reject('The client has already been closed.');
335 0
          }
336 0
          const func = stub[methodName];
337 0
          return func.apply(stub, args);
338 4
        },
339 4
        (err: Error | null | undefined) => () => {
340 0
          throw err;
341 0
        }
342 4
      );
343 4

344 4
      const descriptor =
345 4
        this.descriptors.page[methodName] ||
346 4
        this.descriptors.longrunning[methodName] ||
347 4
        undefined;
348 4
      const apiCall = this._gaxModule.createApiCall(
349 4
        callPromise,
350 4
        this._defaults[methodName],
351 4
        descriptor
352 4
      );
353 4

354 4
      this.innerApiCalls[methodName] = apiCall;
355 4
    }
356 4

357 4
    return this.productSearchStub;
358 4
  }
359 4

360 4
  /**
361 4
   * The DNS address for this API service.
362 4
   */
363 4
  static get servicePath() {
364 4
    return 'vision.googleapis.com';
365 4
  }
366 4

367 4
  /**
368 4
   * The DNS address for this API service - same as servicePath(),
369 4
   * exists for compatibility reasons.
370 4
   */
371 4
  static get apiEndpoint() {
372 4
    return 'vision.googleapis.com';
373 4
  }
374 4

375 4
  /**
376 4
   * The port for this API service.
377 4
   */
378 4
  static get port() {
379 4
    return 443;
380 4
  }
381 4

382 4
  /**
383 4
   * The scopes needed to make gRPC calls for every method defined
384 4
   * in this service.
385 4
   */
386 4
  static get scopes() {
387 4
    return [
388 4
      'https://www.googleapis.com/auth/cloud-platform',
389 4
      'https://www.googleapis.com/auth/cloud-vision',
390 4
    ];
391 4
  }
392 4

393 4
  getProjectId(): Promise<string>;
394 4
  getProjectId(callback: Callback<string, undefined, undefined>): void;
395 4
  /**
396 4
   * Return the project ID used by this class.
397 4
   * @param {function(Error, string)} callback - the callback to
398 4
   *   be called with the current project Id.
399 4
   */
400 4
  getProjectId(
401 4
    callback?: Callback<string, undefined, undefined>
402 4
  ): Promise<string> | void {
403 4
    if (callback) {
404 4
      this.auth.getProjectId(callback);
405 4
      return;
406 4
    }
407 4
    return this.auth.getProjectId();
408 4
  }
409 4

410 4
  // -------------------
411 4
  // -- Service calls --
412 4
  // -------------------
413 4
  createProductSet(
414 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest,
415 4
    options?: gax.CallOptions
416 4
  ): Promise<
417 4
    [
418 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
419 4
      protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined,
420 4
      {} | undefined
421 4
    ]
422 4
  >;
423 4
  createProductSet(
424 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest,
425 4
    options: gax.CallOptions,
426 4
    callback: Callback<
427 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
428 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest
429 4
      | null
430 4
      | undefined,
431 4
      {} | null | undefined
432 4
    >
433 4
  ): void;
434 4
  createProductSet(
435 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest,
436 4
    callback: Callback<
437 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
438 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest
439 4
      | null
440 4
      | undefined,
441 4
      {} | null | undefined
442 4
    >
443 4
  ): void;
444 4
  /**
445 4
   * Creates and returns a new ProductSet resource.
446 4
   *
447 4
   * Possible errors:
448 4
   *
449 4
   * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than
450 4
   *   4096 characters.
451 4
   *
452 4
   * @param {Object} request
453 4
   *   The request object that will be sent.
454 4
   * @param {string} request.parent
455 4
   *   Required. The project in which the ProductSet should be created.
456 4
   *
457 4
   *   Format is `projects/PROJECT_ID/locations/LOC_ID`.
458 4
   * @param {google.cloud.vision.v1p4beta1.ProductSet} request.productSet
459 4
   *   Required. The ProductSet to create.
460 4
   * @param {string} request.productSetId
461 4
   *   A user-supplied resource id for this ProductSet. If set, the server will
462 4
   *   attempt to use this value as the resource id. If it is already in use, an
463 4
   *   error is returned with code ALREADY_EXISTS. Must be at most 128 characters
464 4
   *   long. It cannot contain the character `/`.
465 4
   * @param {object} [options]
466 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
467 4
   * @returns {Promise} - The promise which resolves to an array.
468 4
   *   The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}.
469 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
470 4
   */
471 4
  createProductSet(
472 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest,
473 4
    optionsOrCallback?:
474 4
      | gax.CallOptions
475 4
      | Callback<
476 4
          protos.google.cloud.vision.v1p4beta1.IProductSet,
477 4
          | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest
478 4
          | null
479 4
          | undefined,
480 4
          {} | null | undefined
481 4
        >,
482 4
    callback?: Callback<
483 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
484 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest
485 4
      | null
486 4
      | undefined,
487 4
      {} | null | undefined
488 4
    >
489 4
  ): Promise<
490 4
    [
491 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
492 4
      protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined,
493 4
      {} | undefined
494 4
    ]
495 4
  > | void {
496 4
    request = request || {};
497 4
    let options: gax.CallOptions;
498 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
499 4
      callback = optionsOrCallback;
500 4
      options = {};
501 4
    } else {
502 4
      options = optionsOrCallback as gax.CallOptions;
503 4
    }
504 4
    options = options || {};
505 4
    options.otherArgs = options.otherArgs || {};
506 4
    options.otherArgs.headers = options.otherArgs.headers || {};
507 4
    options.otherArgs.headers[
508 4
      'x-goog-request-params'
509 4
    ] = gax.routingHeader.fromParams({
510 4
      parent: request.parent || '',
511 4
    });
512 4
    this.initialize();
513 4
    return this.innerApiCalls.createProductSet(request, options, callback);
514 4
  }
515 4
  getProductSet(
516 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest,
517 4
    options?: gax.CallOptions
518 4
  ): Promise<
519 4
    [
520 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
521 4
      protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest | undefined,
522 4
      {} | undefined
523 4
    ]
524 4
  >;
525 4
  getProductSet(
526 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest,
527 4
    options: gax.CallOptions,
528 4
    callback: Callback<
529 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
530 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest
531 4
      | null
532 4
      | undefined,
533 4
      {} | null | undefined
534 4
    >
535 4
  ): void;
536 4
  getProductSet(
537 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest,
538 4
    callback: Callback<
539 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
540 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest
541 4
      | null
542 4
      | undefined,
543 4
      {} | null | undefined
544 4
    >
545 4
  ): void;
546 4
  /**
547 4
   * Gets information associated with a ProductSet.
548 4
   *
549 4
   * Possible errors:
550 4
   *
551 4
   * * Returns NOT_FOUND if the ProductSet does not exist.
552 4
   *
553 4
   * @param {Object} request
554 4
   *   The request object that will be sent.
555 4
   * @param {string} request.name
556 4
   *   Required. Resource name of the ProductSet to get.
557 4
   *
558 4
   *   Format is:
559 4
   *   `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
560 4
   * @param {object} [options]
561 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
562 4
   * @returns {Promise} - The promise which resolves to an array.
563 4
   *   The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}.
564 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
565 4
   */
566 4
  getProductSet(
567 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest,
568 4
    optionsOrCallback?:
569 4
      | gax.CallOptions
570 4
      | Callback<
571 4
          protos.google.cloud.vision.v1p4beta1.IProductSet,
572 4
          | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest
573 4
          | null
574 4
          | undefined,
575 4
          {} | null | undefined
576 4
        >,
577 4
    callback?: Callback<
578 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
579 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest
580 4
      | null
581 4
      | undefined,
582 4
      {} | null | undefined
583 4
    >
584 4
  ): Promise<
585 4
    [
586 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
587 4
      protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest | undefined,
588 4
      {} | undefined
589 4
    ]
590 4
  > | void {
591 4
    request = request || {};
592 4
    let options: gax.CallOptions;
593 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
594 4
      callback = optionsOrCallback;
595 4
      options = {};
596 4
    } else {
597 4
      options = optionsOrCallback as gax.CallOptions;
598 4
    }
599 4
    options = options || {};
600 4
    options.otherArgs = options.otherArgs || {};
601 4
    options.otherArgs.headers = options.otherArgs.headers || {};
602 4
    options.otherArgs.headers[
603 4
      'x-goog-request-params'
604 4
    ] = gax.routingHeader.fromParams({
605 4
      name: request.name || '',
606 4
    });
607 4
    this.initialize();
608 4
    return this.innerApiCalls.getProductSet(request, options, callback);
609 4
  }
610 4
  updateProductSet(
611 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest,
612 4
    options?: gax.CallOptions
613 4
  ): Promise<
614 4
    [
615 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
616 4
      protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest | undefined,
617 4
      {} | undefined
618 4
    ]
619 4
  >;
620 4
  updateProductSet(
621 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest,
622 4
    options: gax.CallOptions,
623 4
    callback: Callback<
624 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
625 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest
626 4
      | null
627 4
      | undefined,
628 4
      {} | null | undefined
629 4
    >
630 4
  ): void;
631 4
  updateProductSet(
632 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest,
633 4
    callback: Callback<
634 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
635 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest
636 4
      | null
637 4
      | undefined,
638 4
      {} | null | undefined
639 4
    >
640 4
  ): void;
641 4
  /**
642 4
   * Makes changes to a ProductSet resource.
643 4
   * Only display_name can be updated currently.
644 4
   *
645 4
   * Possible errors:
646 4
   *
647 4
   * * Returns NOT_FOUND if the ProductSet does not exist.
648 4
   * * Returns INVALID_ARGUMENT if display_name is present in update_mask but
649 4
   *   missing from the request or longer than 4096 characters.
650 4
   *
651 4
   * @param {Object} request
652 4
   *   The request object that will be sent.
653 4
   * @param {google.cloud.vision.v1p4beta1.ProductSet} request.productSet
654 4
   *   Required. The ProductSet resource which replaces the one on the server.
655 4
   * @param {google.protobuf.FieldMask} request.updateMask
656 4
   *   The {@link google.protobuf.FieldMask|FieldMask} that specifies which fields to
657 4
   *   update.
658 4
   *   If update_mask isn't specified, all mutable fields are to be updated.
659 4
   *   Valid mask path is `display_name`.
660 4
   * @param {object} [options]
661 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
662 4
   * @returns {Promise} - The promise which resolves to an array.
663 4
   *   The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}.
664 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
665 4
   */
666 4
  updateProductSet(
667 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest,
668 4
    optionsOrCallback?:
669 4
      | gax.CallOptions
670 4
      | Callback<
671 4
          protos.google.cloud.vision.v1p4beta1.IProductSet,
672 4
          | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest
673 4
          | null
674 4
          | undefined,
675 4
          {} | null | undefined
676 4
        >,
677 4
    callback?: Callback<
678 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
679 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest
680 4
      | null
681 4
      | undefined,
682 4
      {} | null | undefined
683 4
    >
684 4
  ): Promise<
685 4
    [
686 4
      protos.google.cloud.vision.v1p4beta1.IProductSet,
687 4
      protos.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest | undefined,
688 4
      {} | undefined
689 4
    ]
690 4
  > | void {
691 4
    request = request || {};
692 4
    let options: gax.CallOptions;
693 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
694 4
      callback = optionsOrCallback;
695 4
      options = {};
696 4
    } else {
697 4
      options = optionsOrCallback as gax.CallOptions;
698 4
    }
699 4
    options = options || {};
700 4
    options.otherArgs = options.otherArgs || {};
701 4
    options.otherArgs.headers = options.otherArgs.headers || {};
702 4
    options.otherArgs.headers[
703 4
      'x-goog-request-params'
704 4
    ] = gax.routingHeader.fromParams({
705 4
      'product_set.name': request.productSet!.name || '',
706 4
    });
707 4
    this.initialize();
708 4
    return this.innerApiCalls.updateProductSet(request, options, callback);
709 4
  }
710 4
  deleteProductSet(
711 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest,
712 4
    options?: gax.CallOptions
713 4
  ): Promise<
714 4
    [
715 4
      protos.google.protobuf.IEmpty,
716 4
      protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | undefined,
717 4
      {} | undefined
718 4
    ]
719 4
  >;
720 4
  deleteProductSet(
721 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest,
722 4
    options: gax.CallOptions,
723 4
    callback: Callback<
724 4
      protos.google.protobuf.IEmpty,
725 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest
726 4
      | null
727 4
      | undefined,
728 4
      {} | null | undefined
729 4
    >
730 4
  ): void;
731 4
  deleteProductSet(
732 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest,
733 4
    callback: Callback<
734 4
      protos.google.protobuf.IEmpty,
735 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest
736 4
      | null
737 4
      | undefined,
738 4
      {} | null | undefined
739 4
    >
740 4
  ): void;
741 4
  /**
742 4
   * Permanently deletes a ProductSet. Products and ReferenceImages in the
743 4
   * ProductSet are not deleted.
744 4
   *
745 4
   * The actual image files are not deleted from Google Cloud Storage.
746 4
   *
747 4
   * @param {Object} request
748 4
   *   The request object that will be sent.
749 4
   * @param {string} request.name
750 4
   *   Required. Resource name of the ProductSet to delete.
751 4
   *
752 4
   *   Format is:
753 4
   *   `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
754 4
   * @param {object} [options]
755 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
756 4
   * @returns {Promise} - The promise which resolves to an array.
757 4
   *   The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
758 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
759 4
   */
760 4
  deleteProductSet(
761 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest,
762 4
    optionsOrCallback?:
763 4
      | gax.CallOptions
764 4
      | Callback<
765 4
          protos.google.protobuf.IEmpty,
766 4
          | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest
767 4
          | null
768 4
          | undefined,
769 4
          {} | null | undefined
770 4
        >,
771 4
    callback?: Callback<
772 4
      protos.google.protobuf.IEmpty,
773 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest
774 4
      | null
775 4
      | undefined,
776 4
      {} | null | undefined
777 4
    >
778 4
  ): Promise<
779 4
    [
780 4
      protos.google.protobuf.IEmpty,
781 4
      protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | undefined,
782 4
      {} | undefined
783 4
    ]
784 4
  > | void {
785 4
    request = request || {};
786 4
    let options: gax.CallOptions;
787 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
788 4
      callback = optionsOrCallback;
789 4
      options = {};
790 4
    } else {
791 4
      options = optionsOrCallback as gax.CallOptions;
792 4
    }
793 4
    options = options || {};
794 4
    options.otherArgs = options.otherArgs || {};
795 4
    options.otherArgs.headers = options.otherArgs.headers || {};
796 4
    options.otherArgs.headers[
797 4
      'x-goog-request-params'
798 4
    ] = gax.routingHeader.fromParams({
799 4
      name: request.name || '',
800 4
    });
801 4
    this.initialize();
802 4
    return this.innerApiCalls.deleteProductSet(request, options, callback);
803 4
  }
804 4
  createProduct(
805 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest,
806 4
    options?: gax.CallOptions
807 4
  ): Promise<
808 4
    [
809 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
810 4
      protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | undefined,
811 4
      {} | undefined
812 4
    ]
813 4
  >;
814 4
  createProduct(
815 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest,
816 4
    options: gax.CallOptions,
817 4
    callback: Callback<
818 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
819 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest
820 4
      | null
821 4
      | undefined,
822 4
      {} | null | undefined
823 4
    >
824 4
  ): void;
825 4
  createProduct(
826 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest,
827 4
    callback: Callback<
828 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
829 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest
830 4
      | null
831 4
      | undefined,
832 4
      {} | null | undefined
833 4
    >
834 4
  ): void;
835 4
  /**
836 4
   * Creates and returns a new product resource.
837 4
   *
838 4
   * Possible errors:
839 4
   *
840 4
   * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096
841 4
   *   characters.
842 4
   * * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
843 4
   * * Returns INVALID_ARGUMENT if product_category is missing or invalid.
844 4
   *
845 4
   * @param {Object} request
846 4
   *   The request object that will be sent.
847 4
   * @param {string} request.parent
848 4
   *   Required. The project in which the Product should be created.
849 4
   *
850 4
   *   Format is
851 4
   *   `projects/PROJECT_ID/locations/LOC_ID`.
852 4
   * @param {google.cloud.vision.v1p4beta1.Product} request.product
853 4
   *   Required. The product to create.
854 4
   * @param {string} request.productId
855 4
   *   A user-supplied resource id for this Product. If set, the server will
856 4
   *   attempt to use this value as the resource id. If it is already in use, an
857 4
   *   error is returned with code ALREADY_EXISTS. Must be at most 128 characters
858 4
   *   long. It cannot contain the character `/`.
859 4
   * @param {object} [options]
860 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
861 4
   * @returns {Promise} - The promise which resolves to an array.
862 4
   *   The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}.
863 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
864 4
   */
865 4
  createProduct(
866 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest,
867 4
    optionsOrCallback?:
868 4
      | gax.CallOptions
869 4
      | Callback<
870 4
          protos.google.cloud.vision.v1p4beta1.IProduct,
871 4
          | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest
872 4
          | null
873 4
          | undefined,
874 4
          {} | null | undefined
875 4
        >,
876 4
    callback?: Callback<
877 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
878 4
      | protos.google.cloud.vision.v1p4beta1.ICreateProductRequest
879 4
      | null
880 4
      | undefined,
881 4
      {} | null | undefined
882 4
    >
883 4
  ): Promise<
884 4
    [
885 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
886 4
      protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | undefined,
887 4
      {} | undefined
888 4
    ]
889 4
  > | void {
890 4
    request = request || {};
891 4
    let options: gax.CallOptions;
892 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
893 4
      callback = optionsOrCallback;
894 4
      options = {};
895 4
    } else {
896 4
      options = optionsOrCallback as gax.CallOptions;
897 4
    }
898 4
    options = options || {};
899 4
    options.otherArgs = options.otherArgs || {};
900 4
    options.otherArgs.headers = options.otherArgs.headers || {};
901 4
    options.otherArgs.headers[
902 4
      'x-goog-request-params'
903 4
    ] = gax.routingHeader.fromParams({
904 4
      parent: request.parent || '',
905 4
    });
906 4
    this.initialize();
907 4
    return this.innerApiCalls.createProduct(request, options, callback);
908 4
  }
909 4
  getProduct(
910 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest,
911 4
    options?: gax.CallOptions
912 4
  ): Promise<
913 4
    [
914 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
915 4
      protos.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined,
916 4
      {} | undefined
917 4
    ]
918 4
  >;
919 4
  getProduct(
920 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest,
921 4
    options: gax.CallOptions,
922 4
    callback: Callback<
923 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
924 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductRequest
925 4
      | null
926 4
      | undefined,
927 4
      {} | null | undefined
928 4
    >
929 4
  ): void;
930 4
  getProduct(
931 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest,
932 4
    callback: Callback<
933 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
934 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductRequest
935 4
      | null
936 4
      | undefined,
937 4
      {} | null | undefined
938 4
    >
939 4
  ): void;
940 4
  /**
941 4
   * Gets information associated with a Product.
942 4
   *
943 4
   * Possible errors:
944 4
   *
945 4
   * * Returns NOT_FOUND if the Product does not exist.
946 4
   *
947 4
   * @param {Object} request
948 4
   *   The request object that will be sent.
949 4
   * @param {string} request.name
950 4
   *   Required. Resource name of the Product to get.
951 4
   *
952 4
   *   Format is:
953 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
954 4
   * @param {object} [options]
955 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
956 4
   * @returns {Promise} - The promise which resolves to an array.
957 4
   *   The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}.
958 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
959 4
   */
960 4
  getProduct(
961 4
    request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest,
962 4
    optionsOrCallback?:
963 4
      | gax.CallOptions
964 4
      | Callback<
965 4
          protos.google.cloud.vision.v1p4beta1.IProduct,
966 4
          | protos.google.cloud.vision.v1p4beta1.IGetProductRequest
967 4
          | null
968 4
          | undefined,
969 4
          {} | null | undefined
970 4
        >,
971 4
    callback?: Callback<
972 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
973 4
      | protos.google.cloud.vision.v1p4beta1.IGetProductRequest
974 4
      | null
975 4
      | undefined,
976 4
      {} | null | undefined
977 4
    >
978 4
  ): Promise<
979 4
    [
980 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
981 4
      protos.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined,
982 4
      {} | undefined
983 4
    ]
984 4
  > | void {
985 4
    request = request || {};
986 4
    let options: gax.CallOptions;
987 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
988 4
      callback = optionsOrCallback;
989 4
      options = {};
990 4
    } else {
991 4
      options = optionsOrCallback as gax.CallOptions;
992 4
    }
993 4
    options = options || {};
994 4
    options.otherArgs = options.otherArgs || {};
995 4
    options.otherArgs.headers = options.otherArgs.headers || {};
996 4
    options.otherArgs.headers[
997 4
      'x-goog-request-params'
998 4
    ] = gax.routingHeader.fromParams({
999 4
      name: request.name || '',
1000 4
    });
1001 4
    this.initialize();
1002 4
    return this.innerApiCalls.getProduct(request, options, callback);
1003 4
  }
1004 4
  updateProduct(
1005 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest,
1006 4
    options?: gax.CallOptions
1007 4
  ): Promise<
1008 4
    [
1009 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
1010 4
      protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest | undefined,
1011 4
      {} | undefined
1012 4
    ]
1013 4
  >;
1014 4
  updateProduct(
1015 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest,
1016 4
    options: gax.CallOptions,
1017 4
    callback: Callback<
1018 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
1019 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest
1020 4
      | null
1021 4
      | undefined,
1022 4
      {} | null | undefined
1023 4
    >
1024 4
  ): void;
1025 4
  updateProduct(
1026 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest,
1027 4
    callback: Callback<
1028 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
1029 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest
1030 4
      | null
1031 4
      | undefined,
1032 4
      {} | null | undefined
1033 4
    >
1034 4
  ): void;
1035 4
  /**
1036 4
   * Makes changes to a Product resource.
1037 4
   * Only the `display_name`, `description`, and `labels` fields can be updated
1038 4
   * right now.
1039 4
   *
1040 4
   * If labels are updated, the change will not be reflected in queries until
1041 4
   * the next index time.
1042 4
   *
1043 4
   * Possible errors:
1044 4
   *
1045 4
   * * Returns NOT_FOUND if the Product does not exist.
1046 4
   * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is
1047 4
   *   missing from the request or longer than 4096 characters.
1048 4
   * * Returns INVALID_ARGUMENT if description is present in update_mask but is
1049 4
   *   longer than 4096 characters.
1050 4
   * * Returns INVALID_ARGUMENT if product_category is present in update_mask.
1051 4
   *
1052 4
   * @param {Object} request
1053 4
   *   The request object that will be sent.
1054 4
   * @param {google.cloud.vision.v1p4beta1.Product} request.product
1055 4
   *   Required. The Product resource which replaces the one on the server.
1056 4
   *   product.name is immutable.
1057 4
   * @param {google.protobuf.FieldMask} request.updateMask
1058 4
   *   The {@link google.protobuf.FieldMask|FieldMask} that specifies which fields
1059 4
   *   to update.
1060 4
   *   If update_mask isn't specified, all mutable fields are to be updated.
1061 4
   *   Valid mask paths include `product_labels`, `display_name`, and
1062 4
   *   `description`.
1063 4
   * @param {object} [options]
1064 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1065 4
   * @returns {Promise} - The promise which resolves to an array.
1066 4
   *   The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}.
1067 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1068 4
   */
1069 4
  updateProduct(
1070 4
    request: protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest,
1071 4
    optionsOrCallback?:
1072 4
      | gax.CallOptions
1073 4
      | Callback<
1074 4
          protos.google.cloud.vision.v1p4beta1.IProduct,
1075 4
          | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest
1076 4
          | null
1077 4
          | undefined,
1078 4
          {} | null | undefined
1079 4
        >,
1080 4
    callback?: Callback<
1081 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
1082 4
      | protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest
1083 4
      | null
1084 4
      | undefined,
1085 4
      {} | null | undefined
1086 4
    >
1087 4
  ): Promise<
1088 4
    [
1089 4
      protos.google.cloud.vision.v1p4beta1.IProduct,
1090 4
      protos.google.cloud.vision.v1p4beta1.IUpdateProductRequest | undefined,
1091 4
      {} | undefined
1092 4
    ]
1093 4
  > | void {
1094 4
    request = request || {};
1095 4
    let options: gax.CallOptions;
1096 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1097 4
      callback = optionsOrCallback;
1098 4
      options = {};
1099 4
    } else {
1100 4
      options = optionsOrCallback as gax.CallOptions;
1101 4
    }
1102 4
    options = options || {};
1103 4
    options.otherArgs = options.otherArgs || {};
1104 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1105 4
    options.otherArgs.headers[
1106 4
      'x-goog-request-params'
1107 4
    ] = gax.routingHeader.fromParams({
1108 4
      'product.name': request.product!.name || '',
1109 4
    });
1110 4
    this.initialize();
1111 4
    return this.innerApiCalls.updateProduct(request, options, callback);
1112 4
  }
1113 4
  deleteProduct(
1114 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest,
1115 4
    options?: gax.CallOptions
1116 4
  ): Promise<
1117 4
    [
1118 4
      protos.google.protobuf.IEmpty,
1119 4
      protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | undefined,
1120 4
      {} | undefined
1121 4
    ]
1122 4
  >;
1123 4
  deleteProduct(
1124 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest,
1125 4
    options: gax.CallOptions,
1126 4
    callback: Callback<
1127 4
      protos.google.protobuf.IEmpty,
1128 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest
1129 4
      | null
1130 4
      | undefined,
1131 4
      {} | null | undefined
1132 4
    >
1133 4
  ): void;
1134 4
  deleteProduct(
1135 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest,
1136 4
    callback: Callback<
1137 4
      protos.google.protobuf.IEmpty,
1138 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest
1139 4
      | null
1140 4
      | undefined,
1141 4
      {} | null | undefined
1142 4
    >
1143 4
  ): void;
1144 4
  /**
1145 4
   * Permanently deletes a product and its reference images.
1146 4
   *
1147 4
   * Metadata of the product and all its images will be deleted right away, but
1148 4
   * search queries against ProductSets containing the product may still work
1149 4
   * until all related caches are refreshed.
1150 4
   *
1151 4
   * @param {Object} request
1152 4
   *   The request object that will be sent.
1153 4
   * @param {string} request.name
1154 4
   *   Required. Resource name of product to delete.
1155 4
   *
1156 4
   *   Format is:
1157 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1158 4
   * @param {object} [options]
1159 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1160 4
   * @returns {Promise} - The promise which resolves to an array.
1161 4
   *   The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
1162 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1163 4
   */
1164 4
  deleteProduct(
1165 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest,
1166 4
    optionsOrCallback?:
1167 4
      | gax.CallOptions
1168 4
      | Callback<
1169 4
          protos.google.protobuf.IEmpty,
1170 4
          | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest
1171 4
          | null
1172 4
          | undefined,
1173 4
          {} | null | undefined
1174 4
        >,
1175 4
    callback?: Callback<
1176 4
      protos.google.protobuf.IEmpty,
1177 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest
1178 4
      | null
1179 4
      | undefined,
1180 4
      {} | null | undefined
1181 4
    >
1182 4
  ): Promise<
1183 4
    [
1184 4
      protos.google.protobuf.IEmpty,
1185 4
      protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | undefined,
1186 4
      {} | undefined
1187 4
    ]
1188 4
  > | void {
1189 4
    request = request || {};
1190 4
    let options: gax.CallOptions;
1191 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1192 4
      callback = optionsOrCallback;
1193 4
      options = {};
1194 4
    } else {
1195 4
      options = optionsOrCallback as gax.CallOptions;
1196 4
    }
1197 4
    options = options || {};
1198 4
    options.otherArgs = options.otherArgs || {};
1199 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1200 4
    options.otherArgs.headers[
1201 4
      'x-goog-request-params'
1202 4
    ] = gax.routingHeader.fromParams({
1203 4
      name: request.name || '',
1204 4
    });
1205 4
    this.initialize();
1206 4
    return this.innerApiCalls.deleteProduct(request, options, callback);
1207 4
  }
1208 4
  createReferenceImage(
1209 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest,
1210 4
    options?: gax.CallOptions
1211 4
  ): Promise<
1212 4
    [
1213 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1214 4
      (
1215 4
        | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1216 4
        | undefined
1217 4
      ),
1218 4
      {} | undefined
1219 4
    ]
1220 4
  >;
1221 4
  createReferenceImage(
1222 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest,
1223 4
    options: gax.CallOptions,
1224 4
    callback: Callback<
1225 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1226 4
      | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1227 4
      | null
1228 4
      | undefined,
1229 4
      {} | null | undefined
1230 4
    >
1231 4
  ): void;
1232 4
  createReferenceImage(
1233 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest,
1234 4
    callback: Callback<
1235 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1236 4
      | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1237 4
      | null
1238 4
      | undefined,
1239 4
      {} | null | undefined
1240 4
    >
1241 4
  ): void;
1242 4
  /**
1243 4
   * Creates and returns a new ReferenceImage resource.
1244 4
   *
1245 4
   * The `bounding_poly` field is optional. If `bounding_poly` is not specified,
1246 4
   * the system will try to detect regions of interest in the image that are
1247 4
   * compatible with the product_category on the parent product. If it is
1248 4
   * specified, detection is ALWAYS skipped. The system converts polygons into
1249 4
   * non-rotated rectangles.
1250 4
   *
1251 4
   * Note that the pipeline will resize the image if the image resolution is too
1252 4
   * large to process (above 50MP).
1253 4
   *
1254 4
   * Possible errors:
1255 4
   *
1256 4
   * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096
1257 4
   *   characters.
1258 4
   * * Returns INVALID_ARGUMENT if the product does not exist.
1259 4
   * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing
1260 4
   *   compatible with the parent product's product_category is detected.
1261 4
   * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
1262 4
   *
1263 4
   * @param {Object} request
1264 4
   *   The request object that will be sent.
1265 4
   * @param {string} request.parent
1266 4
   *   Required. Resource name of the product in which to create the reference
1267 4
   *   image.
1268 4
   *
1269 4
   *   Format is
1270 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1271 4
   * @param {google.cloud.vision.v1p4beta1.ReferenceImage} request.referenceImage
1272 4
   *   Required. The reference image to create.
1273 4
   *   If an image ID is specified, it is ignored.
1274 4
   * @param {string} request.referenceImageId
1275 4
   *   A user-supplied resource id for the ReferenceImage to be added. If set,
1276 4
   *   the server will attempt to use this value as the resource id. If it is
1277 4
   *   already in use, an error is returned with code ALREADY_EXISTS. Must be at
1278 4
   *   most 128 characters long. It cannot contain the character `/`.
1279 4
   * @param {object} [options]
1280 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1281 4
   * @returns {Promise} - The promise which resolves to an array.
1282 4
   *   The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}.
1283 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1284 4
   */
1285 4
  createReferenceImage(
1286 4
    request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest,
1287 4
    optionsOrCallback?:
1288 4
      | gax.CallOptions
1289 4
      | Callback<
1290 4
          protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1291 4
          | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1292 4
          | null
1293 4
          | undefined,
1294 4
          {} | null | undefined
1295 4
        >,
1296 4
    callback?: Callback<
1297 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1298 4
      | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1299 4
      | null
1300 4
      | undefined,
1301 4
      {} | null | undefined
1302 4
    >
1303 4
  ): Promise<
1304 4
    [
1305 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1306 4
      (
1307 4
        | protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest
1308 4
        | undefined
1309 4
      ),
1310 4
      {} | undefined
1311 4
    ]
1312 4
  > | void {
1313 4
    request = request || {};
1314 4
    let options: gax.CallOptions;
1315 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1316 4
      callback = optionsOrCallback;
1317 4
      options = {};
1318 4
    } else {
1319 4
      options = optionsOrCallback as gax.CallOptions;
1320 4
    }
1321 4
    options = options || {};
1322 4
    options.otherArgs = options.otherArgs || {};
1323 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1324 4
    options.otherArgs.headers[
1325 4
      'x-goog-request-params'
1326 4
    ] = gax.routingHeader.fromParams({
1327 4
      parent: request.parent || '',
1328 4
    });
1329 4
    this.initialize();
1330 4
    return this.innerApiCalls.createReferenceImage(request, options, callback);
1331 4
  }
1332 4
  deleteReferenceImage(
1333 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest,
1334 4
    options?: gax.CallOptions
1335 4
  ): Promise<
1336 4
    [
1337 4
      protos.google.protobuf.IEmpty,
1338 4
      (
1339 4
        | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1340 4
        | undefined
1341 4
      ),
1342 4
      {} | undefined
1343 4
    ]
1344 4
  >;
1345 4
  deleteReferenceImage(
1346 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest,
1347 4
    options: gax.CallOptions,
1348 4
    callback: Callback<
1349 4
      protos.google.protobuf.IEmpty,
1350 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1351 4
      | null
1352 4
      | undefined,
1353 4
      {} | null | undefined
1354 4
    >
1355 4
  ): void;
1356 4
  deleteReferenceImage(
1357 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest,
1358 4
    callback: Callback<
1359 4
      protos.google.protobuf.IEmpty,
1360 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1361 4
      | null
1362 4
      | undefined,
1363 4
      {} | null | undefined
1364 4
    >
1365 4
  ): void;
1366 4
  /**
1367 4
   * Permanently deletes a reference image.
1368 4
   *
1369 4
   * The image metadata will be deleted right away, but search queries
1370 4
   * against ProductSets containing the image may still work until all related
1371 4
   * caches are refreshed.
1372 4
   *
1373 4
   * The actual image files are not deleted from Google Cloud Storage.
1374 4
   *
1375 4
   * @param {Object} request
1376 4
   *   The request object that will be sent.
1377 4
   * @param {string} request.name
1378 4
   *   Required. The resource name of the reference image to delete.
1379 4
   *
1380 4
   *   Format is:
1381 4
   *
1382 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
1383 4
   * @param {object} [options]
1384 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1385 4
   * @returns {Promise} - The promise which resolves to an array.
1386 4
   *   The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
1387 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1388 4
   */
1389 4
  deleteReferenceImage(
1390 4
    request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest,
1391 4
    optionsOrCallback?:
1392 4
      | gax.CallOptions
1393 4
      | Callback<
1394 4
          protos.google.protobuf.IEmpty,
1395 4
          | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1396 4
          | null
1397 4
          | undefined,
1398 4
          {} | null | undefined
1399 4
        >,
1400 4
    callback?: Callback<
1401 4
      protos.google.protobuf.IEmpty,
1402 4
      | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1403 4
      | null
1404 4
      | undefined,
1405 4
      {} | null | undefined
1406 4
    >
1407 4
  ): Promise<
1408 4
    [
1409 4
      protos.google.protobuf.IEmpty,
1410 4
      (
1411 4
        | protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest
1412 4
        | undefined
1413 4
      ),
1414 4
      {} | undefined
1415 4
    ]
1416 4
  > | void {
1417 4
    request = request || {};
1418 4
    let options: gax.CallOptions;
1419 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1420 4
      callback = optionsOrCallback;
1421 4
      options = {};
1422 4
    } else {
1423 4
      options = optionsOrCallback as gax.CallOptions;
1424 4
    }
1425 4
    options = options || {};
1426 4
    options.otherArgs = options.otherArgs || {};
1427 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1428 4
    options.otherArgs.headers[
1429 4
      'x-goog-request-params'
1430 4
    ] = gax.routingHeader.fromParams({
1431 4
      name: request.name || '',
1432 4
    });
1433 4
    this.initialize();
1434 4
    return this.innerApiCalls.deleteReferenceImage(request, options, callback);
1435 4
  }
1436 4
  getReferenceImage(
1437 4
    request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest,
1438 4
    options?: gax.CallOptions
1439 4
  ): Promise<
1440 4
    [
1441 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1442 4
      (
1443 4
        | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1444 4
        | undefined
1445 4
      ),
1446 4
      {} | undefined
1447 4
    ]
1448 4
  >;
1449 4
  getReferenceImage(
1450 4
    request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest,
1451 4
    options: gax.CallOptions,
1452 4
    callback: Callback<
1453 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1454 4
      | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1455 4
      | null
1456 4
      | undefined,
1457 4
      {} | null | undefined
1458 4
    >
1459 4
  ): void;
1460 4
  getReferenceImage(
1461 4
    request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest,
1462 4
    callback: Callback<
1463 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1464 4
      | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1465 4
      | null
1466 4
      | undefined,
1467 4
      {} | null | undefined
1468 4
    >
1469 4
  ): void;
1470 4
  /**
1471 4
   * Gets information associated with a ReferenceImage.
1472 4
   *
1473 4
   * Possible errors:
1474 4
   *
1475 4
   * * Returns NOT_FOUND if the specified image does not exist.
1476 4
   *
1477 4
   * @param {Object} request
1478 4
   *   The request object that will be sent.
1479 4
   * @param {string} request.name
1480 4
   *   Required. The resource name of the ReferenceImage to get.
1481 4
   *
1482 4
   *   Format is:
1483 4
   *
1484 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
1485 4
   * @param {object} [options]
1486 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1487 4
   * @returns {Promise} - The promise which resolves to an array.
1488 4
   *   The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}.
1489 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1490 4
   */
1491 4
  getReferenceImage(
1492 4
    request: protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest,
1493 4
    optionsOrCallback?:
1494 4
      | gax.CallOptions
1495 4
      | Callback<
1496 4
          protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1497 4
          | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1498 4
          | null
1499 4
          | undefined,
1500 4
          {} | null | undefined
1501 4
        >,
1502 4
    callback?: Callback<
1503 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1504 4
      | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1505 4
      | null
1506 4
      | undefined,
1507 4
      {} | null | undefined
1508 4
    >
1509 4
  ): Promise<
1510 4
    [
1511 4
      protos.google.cloud.vision.v1p4beta1.IReferenceImage,
1512 4
      (
1513 4
        | protos.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest
1514 4
        | undefined
1515 4
      ),
1516 4
      {} | undefined
1517 4
    ]
1518 4
  > | void {
1519 4
    request = request || {};
1520 4
    let options: gax.CallOptions;
1521 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1522 4
      callback = optionsOrCallback;
1523 4
      options = {};
1524 4
    } else {
1525 4
      options = optionsOrCallback as gax.CallOptions;
1526 4
    }
1527 4
    options = options || {};
1528 4
    options.otherArgs = options.otherArgs || {};
1529 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1530 4
    options.otherArgs.headers[
1531 4
      'x-goog-request-params'
1532 4
    ] = gax.routingHeader.fromParams({
1533 4
      name: request.name || '',
1534 4
    });
1535 4
    this.initialize();
1536 4
    return this.innerApiCalls.getReferenceImage(request, options, callback);
1537 4
  }
1538 4
  addProductToProductSet(
1539 4
    request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest,
1540 4
    options?: gax.CallOptions
1541 4
  ): Promise<
1542 4
    [
1543 4
      protos.google.protobuf.IEmpty,
1544 4
      (
1545 4
        | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1546 4
        | undefined
1547 4
      ),
1548 4
      {} | undefined
1549 4
    ]
1550 4
  >;
1551 4
  addProductToProductSet(
1552 4
    request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest,
1553 4
    options: gax.CallOptions,
1554 4
    callback: Callback<
1555 4
      protos.google.protobuf.IEmpty,
1556 4
      | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1557 4
      | null
1558 4
      | undefined,
1559 4
      {} | null | undefined
1560 4
    >
1561 4
  ): void;
1562 4
  addProductToProductSet(
1563 4
    request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest,
1564 4
    callback: Callback<
1565 4
      protos.google.protobuf.IEmpty,
1566 4
      | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1567 4
      | null
1568 4
      | undefined,
1569 4
      {} | null | undefined
1570 4
    >
1571 4
  ): void;
1572 4
  /**
1573 4
   * Adds a Product to the specified ProductSet. If the Product is already
1574 4
   * present, no change is made.
1575 4
   *
1576 4
   * One Product can be added to at most 100 ProductSets.
1577 4
   *
1578 4
   * Possible errors:
1579 4
   *
1580 4
   * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
1581 4
   *
1582 4
   * @param {Object} request
1583 4
   *   The request object that will be sent.
1584 4
   * @param {string} request.name
1585 4
   *   Required. The resource name for the ProductSet to modify.
1586 4
   *
1587 4
   *   Format is:
1588 4
   *   `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
1589 4
   * @param {string} request.product
1590 4
   *   Required. The resource name for the Product to be added to this ProductSet.
1591 4
   *
1592 4
   *   Format is:
1593 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1594 4
   * @param {object} [options]
1595 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1596 4
   * @returns {Promise} - The promise which resolves to an array.
1597 4
   *   The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
1598 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1599 4
   */
1600 4
  addProductToProductSet(
1601 4
    request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest,
1602 4
    optionsOrCallback?:
1603 4
      | gax.CallOptions
1604 4
      | Callback<
1605 4
          protos.google.protobuf.IEmpty,
1606 4
          | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1607 4
          | null
1608 4
          | undefined,
1609 4
          {} | null | undefined
1610 4
        >,
1611 4
    callback?: Callback<
1612 4
      protos.google.protobuf.IEmpty,
1613 4
      | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1614 4
      | null
1615 4
      | undefined,
1616 4
      {} | null | undefined
1617 4
    >
1618 4
  ): Promise<
1619 4
    [
1620 4
      protos.google.protobuf.IEmpty,
1621 4
      (
1622 4
        | protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest
1623 4
        | undefined
1624 4
      ),
1625 4
      {} | undefined
1626 4
    ]
1627 4
  > | void {
1628 4
    request = request || {};
1629 4
    let options: gax.CallOptions;
1630 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1631 4
      callback = optionsOrCallback;
1632 4
      options = {};
1633 4
    } else {
1634 4
      options = optionsOrCallback as gax.CallOptions;
1635 4
    }
1636 4
    options = options || {};
1637 4
    options.otherArgs = options.otherArgs || {};
1638 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1639 4
    options.otherArgs.headers[
1640 4
      'x-goog-request-params'
1641 4
    ] = gax.routingHeader.fromParams({
1642 4
      name: request.name || '',
1643 4
    });
1644 4
    this.initialize();
1645 4
    return this.innerApiCalls.addProductToProductSet(
1646 4
      request,
1647 4
      options,
1648 4
      callback
1649 4
    );
1650 4
  }
1651 4
  removeProductFromProductSet(
1652 4
    request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest,
1653 4
    options?: gax.CallOptions
1654 4
  ): Promise<
1655 4
    [
1656 4
      protos.google.protobuf.IEmpty,
1657 4
      (
1658 4
        | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1659 4
        | undefined
1660 4
      ),
1661 4
      {} | undefined
1662 4
    ]
1663 4
  >;
1664 4
  removeProductFromProductSet(
1665 4
    request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest,
1666 4
    options: gax.CallOptions,
1667 4
    callback: Callback<
1668 4
      protos.google.protobuf.IEmpty,
1669 4
      | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1670 4
      | null
1671 4
      | undefined,
1672 4
      {} | null | undefined
1673 4
    >
1674 4
  ): void;
1675 4
  removeProductFromProductSet(
1676 4
    request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest,
1677 4
    callback: Callback<
1678 4
      protos.google.protobuf.IEmpty,
1679 4
      | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1680 4
      | null
1681 4
      | undefined,
1682 4
      {} | null | undefined
1683 4
    >
1684 4
  ): void;
1685 4
  /**
1686 4
   * Removes a Product from the specified ProductSet.
1687 4
   *
1688 4
   * @param {Object} request
1689 4
   *   The request object that will be sent.
1690 4
   * @param {string} request.name
1691 4
   *   Required. The resource name for the ProductSet to modify.
1692 4
   *
1693 4
   *   Format is:
1694 4
   *   `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
1695 4
   * @param {string} request.product
1696 4
   *   Required. The resource name for the Product to be removed from this
1697 4
   *   ProductSet.
1698 4
   *
1699 4
   *   Format is:
1700 4
   *   `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
1701 4
   * @param {object} [options]
1702 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1703 4
   * @returns {Promise} - The promise which resolves to an array.
1704 4
   *   The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
1705 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1706 4
   */
1707 4
  removeProductFromProductSet(
1708 4
    request: protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest,
1709 4
    optionsOrCallback?:
1710 4
      | gax.CallOptions
1711 4
      | Callback<
1712 4
          protos.google.protobuf.IEmpty,
1713 4
          | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1714 4
          | null
1715 4
          | undefined,
1716 4
          {} | null | undefined
1717 4
        >,
1718 4
    callback?: Callback<
1719 4
      protos.google.protobuf.IEmpty,
1720 4
      | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1721 4
      | null
1722 4
      | undefined,
1723 4
      {} | null | undefined
1724 4
    >
1725 4
  ): Promise<
1726 4
    [
1727 4
      protos.google.protobuf.IEmpty,
1728 4
      (
1729 4
        | protos.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest
1730 4
        | undefined
1731 4
      ),
1732 4
      {} | undefined
1733 4
    ]
1734 4
  > | void {
1735 4
    request = request || {};
1736 4
    let options: gax.CallOptions;
1737 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1738 4
      callback = optionsOrCallback;
1739 4
      options = {};
1740 4
    } else {
1741 4
      options = optionsOrCallback as gax.CallOptions;
1742 4
    }
1743 4
    options = options || {};
1744 4
    options.otherArgs = options.otherArgs || {};
1745 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1746 4
    options.otherArgs.headers[
1747 4
      'x-goog-request-params'
1748 4
    ] = gax.routingHeader.fromParams({
1749 4
      name: request.name || '',
1750 4
    });
1751 4
    this.initialize();
1752 4
    return this.innerApiCalls.removeProductFromProductSet(
1753 4
      request,
1754 4
      options,
1755 4
      callback
1756 4
    );
1757 4
  }
1758 4

1759 4
  importProductSets(
1760 4
    request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest,
1761 4
    options?: gax.CallOptions
1762 4
  ): Promise<
1763 4
    [
1764 4
      LROperation<
1765 4
        protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1766 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1767 4
      >,
1768 4
      protos.google.longrunning.IOperation | undefined,
1769 4
      {} | undefined
1770 4
    ]
1771 4
  >;
1772 4
  importProductSets(
1773 4
    request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest,
1774 4
    options: gax.CallOptions,
1775 4
    callback: Callback<
1776 4
      LROperation<
1777 4
        protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1778 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1779 4
      >,
1780 4
      protos.google.longrunning.IOperation | null | undefined,
1781 4
      {} | null | undefined
1782 4
    >
1783 4
  ): void;
1784 4
  importProductSets(
1785 4
    request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest,
1786 4
    callback: Callback<
1787 4
      LROperation<
1788 4
        protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1789 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1790 4
      >,
1791 4
      protos.google.longrunning.IOperation | null | undefined,
1792 4
      {} | null | undefined
1793 4
    >
1794 4
  ): void;
1795 4
  /**
1796 4
   * Asynchronous API that imports a list of reference images to specified
1797 4
   * product sets based on a list of image information.
1798 4
   *
1799 4
   * The {@link google.longrunning.Operation|google.longrunning.Operation} API can be
1800 4
   * used to keep track of the progress and results of the request.
1801 4
   * `Operation.metadata` contains `BatchOperationMetadata`. (progress)
1802 4
   * `Operation.response` contains `ImportProductSetsResponse`. (results)
1803 4
   *
1804 4
   * The input source of this method is a csv file on Google Cloud Storage.
1805 4
   * For the format of the csv file please see
1806 4
   * {@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri|ImportProductSetsGcsSource.csv_file_uri}.
1807 4
   *
1808 4
   * @param {Object} request
1809 4
   *   The request object that will be sent.
1810 4
   * @param {string} request.parent
1811 4
   *   Required. The project in which the ProductSets should be imported.
1812 4
   *
1813 4
   *   Format is `projects/PROJECT_ID/locations/LOC_ID`.
1814 4
   * @param {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} request.inputConfig
1815 4
   *   Required. The input content for the list of requests.
1816 4
   * @param {object} [options]
1817 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1818 4
   * @returns {Promise} - The promise which resolves to an array.
1819 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
1820 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1821 4
   */
1822 4
  importProductSets(
1823 4
    request: protos.google.cloud.vision.v1p4beta1.IImportProductSetsRequest,
1824 4
    optionsOrCallback?:
1825 4
      | gax.CallOptions
1826 4
      | Callback<
1827 4
          LROperation<
1828 4
            protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1829 4
            protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1830 4
          >,
1831 4
          protos.google.longrunning.IOperation | null | undefined,
1832 4
          {} | null | undefined
1833 4
        >,
1834 4
    callback?: Callback<
1835 4
      LROperation<
1836 4
        protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1837 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1838 4
      >,
1839 4
      protos.google.longrunning.IOperation | null | undefined,
1840 4
      {} | null | undefined
1841 4
    >
1842 4
  ): Promise<
1843 4
    [
1844 4
      LROperation<
1845 4
        protos.google.cloud.vision.v1p4beta1.IImportProductSetsResponse,
1846 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1847 4
      >,
1848 4
      protos.google.longrunning.IOperation | undefined,
1849 4
      {} | undefined
1850 4
    ]
1851 4
  > | void {
1852 4
    request = request || {};
1853 4
    let options: gax.CallOptions;
1854 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
1855 4
      callback = optionsOrCallback;
1856 4
      options = {};
1857 4
    } else {
1858 4
      options = optionsOrCallback as gax.CallOptions;
1859 4
    }
1860 4
    options = options || {};
1861 4
    options.otherArgs = options.otherArgs || {};
1862 4
    options.otherArgs.headers = options.otherArgs.headers || {};
1863 4
    options.otherArgs.headers[
1864 4
      'x-goog-request-params'
1865 4
    ] = gax.routingHeader.fromParams({
1866 4
      parent: request.parent || '',
1867 4
    });
1868 4
    this.initialize();
1869 4
    return this.innerApiCalls.importProductSets(request, options, callback);
1870 4
  }
1871 4
  /**
1872 4
   * Check the status of the long running operation returned by the importProductSets() method.
1873 4
   * @param {String} name
1874 4
   *   The operation name that will be passed.
1875 4
   * @returns {Promise} - The promise which resolves to an object.
1876 4
   *   The decoded operation object has result and metadata field to get information from.
1877 4
   *
1878 4
   * @example:
1879 4
   *   const decodedOperation = await checkImportProductSetsProgress(name);
1880 4
   *   console.log(decodedOperation.result);
1881 4
   *   console.log(decodedOperation.done);
1882 4
   *   console.log(decodedOperation.metadata);
1883 4
   *
1884 4
   */
1885 4
  async checkImportProductSetsProgress(
1886 4
    name: string
1887 4
  ): Promise<
1888 4
    LROperation<
1889 4
      protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse,
1890 4
      protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata
1891 4
    >
1892 4
  > {
1893 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
1894 4
      {name}
1895 4
    );
1896 4
    const [operation] = await this.operationsClient.getOperation(request);
1897 4
    const decodeOperation = new gax.Operation(
1898 4
      operation,
1899 4
      this.descriptors.longrunning.importProductSets,
1900 4
      gax.createDefaultBackoffSettings()
1901 4
    );
1902 4
    return decodeOperation as LROperation<
1903 4
      protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse,
1904 4
      protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata
1905 4
    >;
1906 1
  }
1907 4
  purgeProducts(
1908 4
    request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest,
1909 4
    options?: gax.CallOptions
1910 4
  ): Promise<
1911 4
    [
1912 4
      LROperation<
1913 4
        protos.google.protobuf.IEmpty,
1914 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1915 4
      >,
1916 4
      protos.google.longrunning.IOperation | undefined,
1917 4
      {} | undefined
1918 4
    ]
1919 4
  >;
1920 4
  purgeProducts(
1921 4
    request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest,
1922 4
    options: gax.CallOptions,
1923 4
    callback: Callback<
1924 4
      LROperation<
1925 4
        protos.google.protobuf.IEmpty,
1926 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1927 4
      >,
1928 4
      protos.google.longrunning.IOperation | null | undefined,
1929 4
      {} | null | undefined
1930 4
    >
1931 4
  ): void;
1932 4
  purgeProducts(
1933 4
    request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest,
1934 4
    callback: Callback<
1935 4
      LROperation<
1936 4
        protos.google.protobuf.IEmpty,
1937 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1938 4
      >,
1939 4
      protos.google.longrunning.IOperation | null | undefined,
1940 4
      {} | null | undefined
1941 4
    >
1942 4
  ): void;
1943 4
  /**
1944 4
   * Asynchronous API to delete all Products in a ProductSet or all Products
1945 4
   * that are in no ProductSet.
1946 4
   *
1947 4
   * If a Product is a member of the specified ProductSet in addition to other
1948 4
   * ProductSets, the Product will still be deleted.
1949 4
   *
1950 4
   * It is recommended to not delete the specified ProductSet until after this
1951 4
   * operation has completed. It is also recommended to not add any of the
1952 4
   * Products involved in the batch delete to a new ProductSet while this
1953 4
   * operation is running because those Products may still end up deleted.
1954 4
   *
1955 4
   * It's not possible to undo the PurgeProducts operation. Therefore, it is
1956 4
   * recommended to keep the csv files used in ImportProductSets (if that was
1957 4
   * how you originally built the Product Set) before starting PurgeProducts, in
1958 4
   * case you need to re-import the data after deletion.
1959 4
   *
1960 4
   * If the plan is to purge all of the Products from a ProductSet and then
1961 4
   * re-use the empty ProductSet to re-import new Products into the empty
1962 4
   * ProductSet, you must wait until the PurgeProducts operation has finished
1963 4
   * for that ProductSet.
1964 4
   *
1965 4
   * The {@link google.longrunning.Operation|google.longrunning.Operation} API can be
1966 4
   * used to keep track of the progress and results of the request.
1967 4
   * `Operation.metadata` contains `BatchOperationMetadata`. (progress)
1968 4
   *
1969 4
   * @param {Object} request
1970 4
   *   The request object that will be sent.
1971 4
   * @param {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} request.productSetPurgeConfig
1972 4
   *   Specify which ProductSet contains the Products to be deleted.
1973 4
   * @param {boolean} request.deleteOrphanProducts
1974 4
   *   If delete_orphan_products is true, all Products that are not in any
1975 4
   *   ProductSet will be deleted.
1976 4
   * @param {string} request.parent
1977 4
   *   Required. The project and location in which the Products should be deleted.
1978 4
   *
1979 4
   *   Format is `projects/PROJECT_ID/locations/LOC_ID`.
1980 4
   * @param {boolean} request.force
1981 4
   *   The default value is false. Override this value to true to actually perform
1982 4
   *   the purge.
1983 4
   * @param {object} [options]
1984 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1985 4
   * @returns {Promise} - The promise which resolves to an array.
1986 4
   *   The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}.
1987 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
1988 4
   */
1989 4
  purgeProducts(
1990 4
    request: protos.google.cloud.vision.v1p4beta1.IPurgeProductsRequest,
1991 4
    optionsOrCallback?:
1992 4
      | gax.CallOptions
1993 4
      | Callback<
1994 4
          LROperation<
1995 4
            protos.google.protobuf.IEmpty,
1996 4
            protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
1997 4
          >,
1998 4
          protos.google.longrunning.IOperation | null | undefined,
1999 4
          {} | null | undefined
2000 4
        >,
2001 4
    callback?: Callback<
2002 4
      LROperation<
2003 4
        protos.google.protobuf.IEmpty,
2004 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
2005 4
      >,
2006 4
      protos.google.longrunning.IOperation | null | undefined,
2007 4
      {} | null | undefined
2008 4
    >
2009 4
  ): Promise<
2010 4
    [
2011 4
      LROperation<
2012 4
        protos.google.protobuf.IEmpty,
2013 4
        protos.google.cloud.vision.v1p4beta1.IBatchOperationMetadata
2014 4
      >,
2015 4
      protos.google.longrunning.IOperation | undefined,
2016 4
      {} | undefined
2017 4
    ]
2018 4
  > | void {
2019 4
    request = request || {};
2020 4
    let options: gax.CallOptions;
2021 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
2022 4
      callback = optionsOrCallback;
2023 4
      options = {};
2024 4
    } else {
2025 4
      options = optionsOrCallback as gax.CallOptions;
2026 4
    }
2027 4
    options = options || {};
2028 4
    options.otherArgs = options.otherArgs || {};
2029 4
    options.otherArgs.headers = options.otherArgs.headers || {};
2030 4
    options.otherArgs.headers[
2031 4
      'x-goog-request-params'
2032 4
    ] = gax.routingHeader.fromParams({
2033 4
      parent: request.parent || '',
2034 4
    });
2035 4
    this.initialize();
2036 4
    return this.innerApiCalls.purgeProducts(request, options, callback);
2037 4
  }
2038 4
  /**
2039 4
   * Check the status of the long running operation returned by the purgeProducts() method.
2040 4
   * @param {String} name
2041 4
   *   The operation name that will be passed.
2042 4
   * @returns {Promise} - The promise which resolves to an object.
2043 4
   *   The decoded operation object has result and metadata field to get information from.
2044 4
   *
2045 4
   * @example:
2046 4
   *   const decodedOperation = await checkPurgeProductsProgress(name);
2047 4
   *   console.log(decodedOperation.result);
2048 4
   *   console.log(decodedOperation.done);
2049 4
   *   console.log(decodedOperation.metadata);
2050 4
   *
2051 4
   */
2052 4
  async checkPurgeProductsProgress(
2053 4
    name: string
2054 4
  ): Promise<
2055 4
    LROperation<
2056 4
      protos.google.protobuf.Empty,
2057 4
      protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata
2058 4
    >
2059 4
  > {
2060 4
    const request = new operationsProtos.google.longrunning.GetOperationRequest(
2061 4
      {name}
2062 4
    );
2063 4
    const [operation] = await this.operationsClient.getOperation(request);
2064 4
    const decodeOperation = new gax.Operation(
2065 4
      operation,
2066 4
      this.descriptors.longrunning.purgeProducts,
2067 4
      gax.createDefaultBackoffSettings()
2068 4
    );
2069 4
    return decodeOperation as LROperation<
2070 4
      protos.google.protobuf.Empty,
2071 4
      protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata
2072 4
    >;
2073 1
  }
2074 4
  listProductSets(
2075 4
    request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2076 4
    options?: gax.CallOptions
2077 4
  ): Promise<
2078 4
    [
2079 4
      protos.google.cloud.vision.v1p4beta1.IProductSet[],
2080 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null,
2081 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2082 4
    ]
2083 4
  >;
2084 4
  listProductSets(
2085 4
    request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2086 4
    options: gax.CallOptions,
2087 4
    callback: PaginationCallback<
2088 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2089 4
      | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2090 4
      | null
2091 4
      | undefined,
2092 4
      protos.google.cloud.vision.v1p4beta1.IProductSet
2093 4
    >
2094 4
  ): void;
2095 4
  listProductSets(
2096 4
    request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2097 4
    callback: PaginationCallback<
2098 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2099 4
      | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2100 4
      | null
2101 4
      | undefined,
2102 4
      protos.google.cloud.vision.v1p4beta1.IProductSet
2103 4
    >
2104 4
  ): void;
2105 4
  /**
2106 4
   * Lists ProductSets in an unspecified order.
2107 4
   *
2108 4
   * Possible errors:
2109 4
   *
2110 4
   * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less
2111 4
   *   than 1.
2112 4
   *
2113 4
   * @param {Object} request
2114 4
   *   The request object that will be sent.
2115 4
   * @param {string} request.parent
2116 4
   *   Required. The project from which ProductSets should be listed.
2117 4
   *
2118 4
   *   Format is `projects/PROJECT_ID/locations/LOC_ID`.
2119 4
   * @param {number} request.pageSize
2120 4
   *   The maximum number of items to return. Default 10, maximum 100.
2121 4
   * @param {string} request.pageToken
2122 4
   *   The next_page_token returned from a previous List request, if any.
2123 4
   * @param {object} [options]
2124 4
   *   Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2125 4
   * @returns {Promise} - The promise which resolves to an array.
2126 4
   *   The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}.
2127 4
   *   The client library support auto-pagination by default: it will call the API as many
2128 4
   *   times as needed and will merge results from all the pages into this array.
2129 4
   *
2130 4
   *   When autoPaginate: false is specified through options, the array has three elements.
2131 4
   *   The first element is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} that corresponds to
2132 4
   *   the one page received from the API server.
2133 4
   *   If the second element is not null it contains the request object of type [ListProductSetsRequest]{@link google.cloud.vision.v1p4beta1.ListProductSetsRequest}
2134 4
   *   that can be used to obtain the next page of the results.
2135 4
   *   If it is null, the next page does not exist.
2136 4
   *   The third element contains the raw response received from the API server. Its type is
2137 4
   *   [ListProductSetsResponse]{@link google.cloud.vision.v1p4beta1.ListProductSetsResponse}.
2138 4
   *
2139 4
   *   The promise has a method named "cancel" which cancels the ongoing API call.
2140 4
   */
2141 4
  listProductSets(
2142 4
    request: protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2143 4
    optionsOrCallback?:
2144 4
      | gax.CallOptions
2145 4
      | PaginationCallback<
2146 4
          protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2147 4
          | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2148 4
          | null
2149 4
          | undefined,
2150 4
          protos.google.cloud.vision.v1p4beta1.IProductSet
2151 4
        >,
2152 4
    callback?: PaginationCallback<
2153 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest,
2154 4
      | protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2155 4
      | null
2156 4
      | undefined,
2157 4
      protos.google.cloud.vision.v1p4beta1.IProductSet
2158 4
    >
2159 4
  ): Promise<
2160 4
    [
2161 4
      protos.google.cloud.vision.v1p4beta1.IProductSet[],
2162 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null,
2163 4
      protos.google.cloud.vision.v1p4beta1.IListProductSetsResponse
2164 4
    ]
2165 4
  > | void {
2166 4
    request = request || {};
2167 4
    let options: gax.CallOptions;
2168 4
    if (typeof optionsOrCallback === 'function' && callback === undefined) {
2169 4
      callback = optionsOrCallback;
2170 4
      options = {};
2171 4
    } else {
2172 4
      options = optionsOrCallback as gax.CallOptions;
2173 4
    }
2174 4
    options = options || {};
2175 4
    options.otherArgs = options.otherArgs || {};
2176 4
    options.otherArgs.headers = options.otherArgs.headers || {};
2177 4
    options.otherArgs.headers[
2178 4
      'x-goog-request-params'
2179 4
    ] = gax.routingHeader.fromParams({
2180 4
      parent: request.parent || '',
2181 4
    });
2182 4
    this.initialize();
2183 4
    return this.innerApiCalls.listProductSets(request, options, callback);
2184 4
  }
2185 4

2186 4
  /**
2187 4
   * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object.
2188 4
   *
2189 4
   * This fetches the paged responses for {@link listProductSets} continuously
2190 4
   * and invokes the callback registered for 'data' event for each element in the
2191 4
   * responses.
2192 4
   *
2193 4
   * The returned object has 'end' method when no more elements are required.
2194 4
   *
2195 4
   * autoPaginate option will be ignored.
2196 4
   *
2197 4
   * @see {@link https://nodejs.org/api/stream.html}
2198 4
   *
2199 4
   * @param {Object} request
2200 4
   *   The request object that will be sent.
2201 4
   * @param {string} request.parent
2202 4
   *   Required. The project from which ProductSets should be listed.
2203 4
   *
2204 4
   *   Format is `projects/PROJECT_ID/locations/LOC_ID`.
2205 4
   * @param {number} request.pageSize
2206 4
   *   The maximum number of items to return. Default 10, maximum 100.
2207