@google-shopping/lfp 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +7 -0
  2. package/build/protos/google/shopping/merchant/lfp/v1/lfpinventory.proto +152 -0
  3. package/build/protos/google/shopping/merchant/lfp/v1/lfpmerchantstate.proto +209 -0
  4. package/build/protos/google/shopping/merchant/lfp/v1/lfpsale.proto +125 -0
  5. package/build/protos/google/shopping/merchant/lfp/v1/lfpstore.proto +252 -0
  6. package/build/protos/protos.d.ts +2717 -20
  7. package/build/protos/protos.js +9197 -1880
  8. package/build/protos/protos.json +1049 -22
  9. package/build/src/index.d.ts +3 -1
  10. package/build/src/index.js +4 -2
  11. package/build/src/index.js.map +1 -1
  12. package/build/src/v1/gapic_metadata.json +139 -0
  13. package/build/src/v1/index.d.ts +4 -0
  14. package/build/src/v1/index.js +29 -0
  15. package/build/src/v1/index.js.map +1 -0
  16. package/build/src/v1/lfp_inventory_service_client.d.ts +292 -0
  17. package/build/src/v1/lfp_inventory_service_client.js +527 -0
  18. package/build/src/v1/lfp_inventory_service_client.js.map +1 -0
  19. package/build/src/v1/lfp_inventory_service_client_config.json +43 -0
  20. package/build/src/v1/lfp_inventory_service_proto_list.json +7 -0
  21. package/build/src/v1/lfp_merchant_state_service_client.d.ts +277 -0
  22. package/build/src/v1/lfp_merchant_state_service_client.js +508 -0
  23. package/build/src/v1/lfp_merchant_state_service_client.js.map +1 -0
  24. package/build/src/v1/lfp_merchant_state_service_client_config.json +43 -0
  25. package/build/src/v1/lfp_merchant_state_service_proto_list.json +7 -0
  26. package/build/src/v1/lfp_sale_service_client.d.ts +275 -0
  27. package/build/src/v1/lfp_sale_service_client.js +505 -0
  28. package/build/src/v1/lfp_sale_service_client.js.map +1 -0
  29. package/build/src/v1/lfp_sale_service_client_config.json +43 -0
  30. package/build/src/v1/lfp_sale_service_proto_list.json +7 -0
  31. package/build/src/v1/lfp_store_service_client.d.ts +454 -0
  32. package/build/src/v1/lfp_store_service_client.js +734 -0
  33. package/build/src/v1/lfp_store_service_client.js.map +1 -0
  34. package/build/src/v1/lfp_store_service_client_config.json +58 -0
  35. package/build/src/v1/lfp_store_service_proto_list.json +7 -0
  36. package/package.json +1 -1
@@ -0,0 +1,734 @@
1
+ "use strict";
2
+ // Copyright 2025 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.LfpStoreServiceClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
23
+ /**
24
+ * Client JSON configuration object, loaded from
25
+ * `src/v1/lfp_store_service_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./lfp_store_service_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * Service for a [LFP
32
+ * partner](https://support.google.com/merchants/answer/7676652) to submit local
33
+ * stores for a merchant.
34
+ * @class
35
+ * @memberof v1
36
+ */
37
+ class LfpStoreServiceClient {
38
+ _terminated = false;
39
+ _opts;
40
+ _providedCustomServicePath;
41
+ _gaxModule;
42
+ _gaxGrpc;
43
+ _protos;
44
+ _defaults;
45
+ _universeDomain;
46
+ _servicePath;
47
+ _log = google_gax_1.loggingUtils.log('lfp');
48
+ auth;
49
+ descriptors = {
50
+ page: {},
51
+ stream: {},
52
+ longrunning: {},
53
+ batching: {},
54
+ };
55
+ warn;
56
+ innerApiCalls;
57
+ pathTemplates;
58
+ lfpStoreServiceStub;
59
+ /**
60
+ * Construct an instance of LfpStoreServiceClient.
61
+ *
62
+ * @param {object} [options] - The configuration object.
63
+ * The options accepted by the constructor are described in detail
64
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
65
+ * The common options are:
66
+ * @param {object} [options.credentials] - Credentials object.
67
+ * @param {string} [options.credentials.client_email]
68
+ * @param {string} [options.credentials.private_key]
69
+ * @param {string} [options.email] - Account email address. Required when
70
+ * using a .pem or .p12 keyFilename.
71
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
72
+ * .p12 key downloaded from the Google Developers Console. If you provide
73
+ * a path to a JSON file, the projectId option below is not necessary.
74
+ * NOTE: .pem and .p12 require you to specify options.email as well.
75
+ * @param {number} [options.port] - The port on which to connect to
76
+ * the remote host.
77
+ * @param {string} [options.projectId] - The project ID from the Google
78
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
79
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
80
+ * app is running in an environment which supports
81
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
82
+ * your project ID will be detected automatically.
83
+ * @param {string} [options.apiEndpoint] - The domain name of the
84
+ * API remote host.
85
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
86
+ * Follows the structure of {@link gapicConfig}.
87
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
88
+ * For more information, please check the
89
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
90
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
91
+ * need to avoid loading the default gRPC version and want to use the fallback
92
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
93
+ * ```
94
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
95
+ * const client = new LfpStoreServiceClient({fallback: true}, gax);
96
+ * ```
97
+ */
98
+ constructor(opts, gaxInstance) {
99
+ // Ensure that options include all the required fields.
100
+ const staticMembers = this.constructor;
101
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
102
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
103
+ }
104
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
105
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
106
+ this._servicePath = 'merchantapi.' + this._universeDomain;
107
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
108
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
109
+ const port = opts?.port || staticMembers.port;
110
+ const clientConfig = opts?.clientConfig ?? {};
111
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
112
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
113
+ // Request numeric enum values if REST transport is used.
114
+ opts.numericEnums = true;
115
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
116
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
117
+ opts['scopes'] = staticMembers.scopes;
118
+ }
119
+ // Load google-gax module synchronously if needed
120
+ if (!gaxInstance) {
121
+ gaxInstance = require('google-gax');
122
+ }
123
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
124
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
125
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
126
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
127
+ // Save options to use in initialize() method.
128
+ this._opts = opts;
129
+ // Save the auth object to the client, for use by other methods.
130
+ this.auth = this._gaxGrpc.auth;
131
+ // Set useJWTAccessWithScope on the auth object.
132
+ this.auth.useJWTAccessWithScope = true;
133
+ // Set defaultServicePath on the auth object.
134
+ this.auth.defaultServicePath = this._servicePath;
135
+ // Set the default scopes in auth client if needed.
136
+ if (servicePath === this._servicePath) {
137
+ this.auth.defaultScopes = staticMembers.scopes;
138
+ }
139
+ // Determine the client header string.
140
+ const clientHeader = [
141
+ `gax/${this._gaxModule.version}`,
142
+ `gapic/${version}`,
143
+ ];
144
+ if (typeof process === 'object' && 'versions' in process) {
145
+ clientHeader.push(`gl-node/${process.versions.node}`);
146
+ }
147
+ else {
148
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
149
+ }
150
+ if (!opts.fallback) {
151
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
152
+ }
153
+ else {
154
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
155
+ }
156
+ if (opts.libName && opts.libVersion) {
157
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
158
+ }
159
+ // Load the applicable protos.
160
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
161
+ // This API contains "path templates"; forward-slash-separated
162
+ // identifiers to uniquely identify resources within the API.
163
+ // Create useful helper objects for these.
164
+ this.pathTemplates = {
165
+ accountPathTemplate: new this._gaxModule.PathTemplate('accounts/{account}'),
166
+ lfpInventoryPathTemplate: new this._gaxModule.PathTemplate('accounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}'),
167
+ lfpMerchantStatePathTemplate: new this._gaxModule.PathTemplate('accounts/{account}/lfpMerchantStates/{lfp_merchant_state}'),
168
+ lfpSalePathTemplate: new this._gaxModule.PathTemplate('accounts/{account}/lfpSales/{sale}'),
169
+ lfpStorePathTemplate: new this._gaxModule.PathTemplate('accounts/{account}/lfpStores/{target_merchant}~{store_code}'),
170
+ };
171
+ // Some of the methods on this service return "paged" results,
172
+ // (e.g. 50 results at a time, with tokens to get subsequent
173
+ // pages). Denote the keys used for pagination and results.
174
+ this.descriptors.page = {
175
+ listLfpStores: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'lfpStores')
176
+ };
177
+ // Put together the default options sent with requests.
178
+ this._defaults = this._gaxGrpc.constructSettings('google.shopping.merchant.lfp.v1.LfpStoreService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
179
+ // Set up a dictionary of "inner API calls"; the core implementation
180
+ // of calling the API is handled in `google-gax`, with this code
181
+ // merely providing the destination and request information.
182
+ this.innerApiCalls = {};
183
+ // Add a warn function to the client constructor so it can be easily tested.
184
+ this.warn = this._gaxModule.warn;
185
+ }
186
+ /**
187
+ * Initialize the client.
188
+ * Performs asynchronous operations (such as authentication) and prepares the client.
189
+ * This function will be called automatically when any class method is called for the
190
+ * first time, but if you need to initialize it before calling an actual method,
191
+ * feel free to call initialize() directly.
192
+ *
193
+ * You can await on this method if you want to make sure the client is initialized.
194
+ *
195
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
196
+ */
197
+ initialize() {
198
+ // If the client stub promise is already initialized, return immediately.
199
+ if (this.lfpStoreServiceStub) {
200
+ return this.lfpStoreServiceStub;
201
+ }
202
+ // Put together the "service stub" for
203
+ // google.shopping.merchant.lfp.v1.LfpStoreService.
204
+ this.lfpStoreServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
205
+ this._protos.lookupService('google.shopping.merchant.lfp.v1.LfpStoreService') :
206
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
207
+ this._protos.google.shopping.merchant.lfp.v1.LfpStoreService, this._opts, this._providedCustomServicePath);
208
+ // Iterate over each of the methods that the service provides
209
+ // and create an API call method for each.
210
+ const lfpStoreServiceStubMethods = ['getLfpStore', 'insertLfpStore', 'deleteLfpStore', 'listLfpStores'];
211
+ for (const methodName of lfpStoreServiceStubMethods) {
212
+ const callPromise = this.lfpStoreServiceStub.then(stub => (...args) => {
213
+ if (this._terminated) {
214
+ return Promise.reject('The client has already been closed.');
215
+ }
216
+ const func = stub[methodName];
217
+ return func.apply(stub, args);
218
+ }, (err) => () => {
219
+ throw err;
220
+ });
221
+ const descriptor = this.descriptors.page[methodName] ||
222
+ undefined;
223
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
224
+ this.innerApiCalls[methodName] = apiCall;
225
+ }
226
+ return this.lfpStoreServiceStub;
227
+ }
228
+ /**
229
+ * The DNS address for this API service.
230
+ * @deprecated Use the apiEndpoint method of the client instance.
231
+ * @returns {string} The DNS address for this service.
232
+ */
233
+ static get servicePath() {
234
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
235
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
236
+ }
237
+ return 'merchantapi.googleapis.com';
238
+ }
239
+ /**
240
+ * The DNS address for this API service - same as servicePath.
241
+ * @deprecated Use the apiEndpoint method of the client instance.
242
+ * @returns {string} The DNS address for this service.
243
+ */
244
+ static get apiEndpoint() {
245
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
246
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
247
+ }
248
+ return 'merchantapi.googleapis.com';
249
+ }
250
+ /**
251
+ * The DNS address for this API service.
252
+ * @returns {string} The DNS address for this service.
253
+ */
254
+ get apiEndpoint() {
255
+ return this._servicePath;
256
+ }
257
+ get universeDomain() {
258
+ return this._universeDomain;
259
+ }
260
+ /**
261
+ * The port for this API service.
262
+ * @returns {number} The default port for this service.
263
+ */
264
+ static get port() {
265
+ return 443;
266
+ }
267
+ /**
268
+ * The scopes needed to make gRPC calls for every method defined
269
+ * in this service.
270
+ * @returns {string[]} List of default scopes.
271
+ */
272
+ static get scopes() {
273
+ return [
274
+ 'https://www.googleapis.com/auth/content'
275
+ ];
276
+ }
277
+ /**
278
+ * Return the project ID used by this class.
279
+ * @returns {Promise} A promise that resolves to string containing the project ID.
280
+ */
281
+ getProjectId(callback) {
282
+ if (callback) {
283
+ this.auth.getProjectId(callback);
284
+ return;
285
+ }
286
+ return this.auth.getProjectId();
287
+ }
288
+ getLfpStore(request, optionsOrCallback, callback) {
289
+ request = request || {};
290
+ let options;
291
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
292
+ callback = optionsOrCallback;
293
+ options = {};
294
+ }
295
+ else {
296
+ options = optionsOrCallback;
297
+ }
298
+ options = options || {};
299
+ options.otherArgs = options.otherArgs || {};
300
+ options.otherArgs.headers = options.otherArgs.headers || {};
301
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
302
+ 'name': request.name ?? '',
303
+ });
304
+ this.initialize().catch(err => { throw err; });
305
+ this._log.info('getLfpStore request %j', request);
306
+ const wrappedCallback = callback
307
+ ? (error, response, options, rawResponse) => {
308
+ this._log.info('getLfpStore response %j', response);
309
+ callback(error, response, options, rawResponse); // We verified callback above.
310
+ }
311
+ : undefined;
312
+ return this.innerApiCalls.getLfpStore(request, options, wrappedCallback)
313
+ ?.then(([response, options, rawResponse]) => {
314
+ this._log.info('getLfpStore response %j', response);
315
+ return [response, options, rawResponse];
316
+ }).catch((error) => {
317
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
318
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
319
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
320
+ }
321
+ throw error;
322
+ });
323
+ }
324
+ insertLfpStore(request, optionsOrCallback, callback) {
325
+ request = request || {};
326
+ let options;
327
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
328
+ callback = optionsOrCallback;
329
+ options = {};
330
+ }
331
+ else {
332
+ options = optionsOrCallback;
333
+ }
334
+ options = options || {};
335
+ options.otherArgs = options.otherArgs || {};
336
+ options.otherArgs.headers = options.otherArgs.headers || {};
337
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
338
+ 'parent': request.parent ?? '',
339
+ });
340
+ this.initialize().catch(err => { throw err; });
341
+ this._log.info('insertLfpStore request %j', request);
342
+ const wrappedCallback = callback
343
+ ? (error, response, options, rawResponse) => {
344
+ this._log.info('insertLfpStore response %j', response);
345
+ callback(error, response, options, rawResponse); // We verified callback above.
346
+ }
347
+ : undefined;
348
+ return this.innerApiCalls.insertLfpStore(request, options, wrappedCallback)
349
+ ?.then(([response, options, rawResponse]) => {
350
+ this._log.info('insertLfpStore response %j', response);
351
+ return [response, options, rawResponse];
352
+ }).catch((error) => {
353
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
354
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
355
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
356
+ }
357
+ throw error;
358
+ });
359
+ }
360
+ deleteLfpStore(request, optionsOrCallback, callback) {
361
+ request = request || {};
362
+ let options;
363
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
364
+ callback = optionsOrCallback;
365
+ options = {};
366
+ }
367
+ else {
368
+ options = optionsOrCallback;
369
+ }
370
+ options = options || {};
371
+ options.otherArgs = options.otherArgs || {};
372
+ options.otherArgs.headers = options.otherArgs.headers || {};
373
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
374
+ 'name': request.name ?? '',
375
+ });
376
+ this.initialize().catch(err => { throw err; });
377
+ this._log.info('deleteLfpStore request %j', request);
378
+ const wrappedCallback = callback
379
+ ? (error, response, options, rawResponse) => {
380
+ this._log.info('deleteLfpStore response %j', response);
381
+ callback(error, response, options, rawResponse); // We verified callback above.
382
+ }
383
+ : undefined;
384
+ return this.innerApiCalls.deleteLfpStore(request, options, wrappedCallback)
385
+ ?.then(([response, options, rawResponse]) => {
386
+ this._log.info('deleteLfpStore response %j', response);
387
+ return [response, options, rawResponse];
388
+ }).catch((error) => {
389
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
390
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
391
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
392
+ }
393
+ throw error;
394
+ });
395
+ }
396
+ listLfpStores(request, optionsOrCallback, callback) {
397
+ request = request || {};
398
+ let options;
399
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
400
+ callback = optionsOrCallback;
401
+ options = {};
402
+ }
403
+ else {
404
+ options = optionsOrCallback;
405
+ }
406
+ options = options || {};
407
+ options.otherArgs = options.otherArgs || {};
408
+ options.otherArgs.headers = options.otherArgs.headers || {};
409
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
410
+ 'parent': request.parent ?? '',
411
+ });
412
+ this.initialize().catch(err => { throw err; });
413
+ const wrappedCallback = callback
414
+ ? (error, values, nextPageRequest, rawResponse) => {
415
+ this._log.info('listLfpStores values %j', values);
416
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
417
+ }
418
+ : undefined;
419
+ this._log.info('listLfpStores request %j', request);
420
+ return this.innerApiCalls
421
+ .listLfpStores(request, options, wrappedCallback)
422
+ ?.then(([response, input, output]) => {
423
+ this._log.info('listLfpStores values %j', response);
424
+ return [response, input, output];
425
+ });
426
+ }
427
+ /**
428
+ * Equivalent to `listLfpStores`, but returns a NodeJS Stream object.
429
+ * @param {Object} request
430
+ * The request object that will be sent.
431
+ * @param {string} request.parent
432
+ * Required. The LFP partner.
433
+ * Format: `accounts/{account}`
434
+ * @param {number} request.targetAccount
435
+ * Required. The Merchant Center id of the merchant to list stores for.
436
+ * @param {number} [request.pageSize]
437
+ * Optional. The maximum number of `LfpStore` resources for the given account
438
+ * to return. The service returns fewer than this value if the number of
439
+ * stores for the given account is less than the `pageSize`. The default value
440
+ * is 250. The maximum value is 1000; If a value higher than the maximum is
441
+ * specified, then the `pageSize` will default to the maximum.
442
+ * @param {string} [request.pageToken]
443
+ * Optional. A page token, received from a previous `ListLfpStoresRequest`
444
+ * call. Provide the page token to retrieve the subsequent page. When
445
+ * paginating, all other parameters provided to `ListLfpStoresRequest` must
446
+ * match the call that provided the page token. The token returned as
447
+ * {@link protos.google.shopping.merchant.lfp.v1.ListLfpStoresResponse.next_page_token|nextPageToken}
448
+ * in the response to the previous request.
449
+ * @param {object} [options]
450
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
451
+ * @returns {Stream}
452
+ * An object stream which emits an object representing {@link protos.google.shopping.merchant.lfp.v1.LfpStore|LfpStore} on 'data' event.
453
+ * The client library will perform auto-pagination by default: it will call the API as many
454
+ * times as needed. Note that it can affect your quota.
455
+ * We recommend using `listLfpStoresAsync()`
456
+ * method described below for async iteration which you can stop as needed.
457
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
458
+ * for more details and examples.
459
+ */
460
+ listLfpStoresStream(request, options) {
461
+ request = request || {};
462
+ options = options || {};
463
+ options.otherArgs = options.otherArgs || {};
464
+ options.otherArgs.headers = options.otherArgs.headers || {};
465
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
466
+ 'parent': request.parent ?? '',
467
+ });
468
+ const defaultCallSettings = this._defaults['listLfpStores'];
469
+ const callSettings = defaultCallSettings.merge(options);
470
+ this.initialize().catch(err => { throw err; });
471
+ this._log.info('listLfpStores stream %j', request);
472
+ return this.descriptors.page.listLfpStores.createStream(this.innerApiCalls.listLfpStores, request, callSettings);
473
+ }
474
+ /**
475
+ * Equivalent to `listLfpStores`, but returns an iterable object.
476
+ *
477
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
478
+ * @param {Object} request
479
+ * The request object that will be sent.
480
+ * @param {string} request.parent
481
+ * Required. The LFP partner.
482
+ * Format: `accounts/{account}`
483
+ * @param {number} request.targetAccount
484
+ * Required. The Merchant Center id of the merchant to list stores for.
485
+ * @param {number} [request.pageSize]
486
+ * Optional. The maximum number of `LfpStore` resources for the given account
487
+ * to return. The service returns fewer than this value if the number of
488
+ * stores for the given account is less than the `pageSize`. The default value
489
+ * is 250. The maximum value is 1000; If a value higher than the maximum is
490
+ * specified, then the `pageSize` will default to the maximum.
491
+ * @param {string} [request.pageToken]
492
+ * Optional. A page token, received from a previous `ListLfpStoresRequest`
493
+ * call. Provide the page token to retrieve the subsequent page. When
494
+ * paginating, all other parameters provided to `ListLfpStoresRequest` must
495
+ * match the call that provided the page token. The token returned as
496
+ * {@link protos.google.shopping.merchant.lfp.v1.ListLfpStoresResponse.next_page_token|nextPageToken}
497
+ * in the response to the previous request.
498
+ * @param {object} [options]
499
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
500
+ * @returns {Object}
501
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
502
+ * When you iterate the returned iterable, each element will be an object representing
503
+ * {@link protos.google.shopping.merchant.lfp.v1.LfpStore|LfpStore}. The API will be called under the hood as needed, once per the page,
504
+ * so you can stop the iteration when you don't need more results.
505
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
506
+ * for more details and examples.
507
+ * @example <caption>include:samples/generated/v1/lfp_store_service.list_lfp_stores.js</caption>
508
+ * region_tag:merchantapi_v1_generated_LfpStoreService_ListLfpStores_async
509
+ */
510
+ listLfpStoresAsync(request, options) {
511
+ request = request || {};
512
+ options = options || {};
513
+ options.otherArgs = options.otherArgs || {};
514
+ options.otherArgs.headers = options.otherArgs.headers || {};
515
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
516
+ 'parent': request.parent ?? '',
517
+ });
518
+ const defaultCallSettings = this._defaults['listLfpStores'];
519
+ const callSettings = defaultCallSettings.merge(options);
520
+ this.initialize().catch(err => { throw err; });
521
+ this._log.info('listLfpStores iterate %j', request);
522
+ return this.descriptors.page.listLfpStores.asyncIterate(this.innerApiCalls['listLfpStores'], request, callSettings);
523
+ }
524
+ // --------------------
525
+ // -- Path templates --
526
+ // --------------------
527
+ /**
528
+ * Return a fully-qualified account resource name string.
529
+ *
530
+ * @param {string} account
531
+ * @returns {string} Resource name string.
532
+ */
533
+ accountPath(account) {
534
+ return this.pathTemplates.accountPathTemplate.render({
535
+ account: account,
536
+ });
537
+ }
538
+ /**
539
+ * Parse the account from Account resource.
540
+ *
541
+ * @param {string} accountName
542
+ * A fully-qualified path representing Account resource.
543
+ * @returns {string} A string representing the account.
544
+ */
545
+ matchAccountFromAccountName(accountName) {
546
+ return this.pathTemplates.accountPathTemplate.match(accountName).account;
547
+ }
548
+ /**
549
+ * Return a fully-qualified lfpInventory resource name string.
550
+ *
551
+ * @param {string} account
552
+ * @param {string} target_merchant
553
+ * @param {string} store_code
554
+ * @param {string} offer
555
+ * @returns {string} Resource name string.
556
+ */
557
+ lfpInventoryPath(account, targetMerchant, storeCode, offer) {
558
+ return this.pathTemplates.lfpInventoryPathTemplate.render({
559
+ account: account,
560
+ target_merchant: targetMerchant,
561
+ store_code: storeCode,
562
+ offer: offer,
563
+ });
564
+ }
565
+ /**
566
+ * Parse the account from LfpInventory resource.
567
+ *
568
+ * @param {string} lfpInventoryName
569
+ * A fully-qualified path representing LfpInventory resource.
570
+ * @returns {string} A string representing the account.
571
+ */
572
+ matchAccountFromLfpInventoryName(lfpInventoryName) {
573
+ return this.pathTemplates.lfpInventoryPathTemplate.match(lfpInventoryName).account;
574
+ }
575
+ /**
576
+ * Parse the target_merchant from LfpInventory resource.
577
+ *
578
+ * @param {string} lfpInventoryName
579
+ * A fully-qualified path representing LfpInventory resource.
580
+ * @returns {string} A string representing the target_merchant.
581
+ */
582
+ matchTargetMerchantFromLfpInventoryName(lfpInventoryName) {
583
+ return this.pathTemplates.lfpInventoryPathTemplate.match(lfpInventoryName).target_merchant;
584
+ }
585
+ /**
586
+ * Parse the store_code from LfpInventory resource.
587
+ *
588
+ * @param {string} lfpInventoryName
589
+ * A fully-qualified path representing LfpInventory resource.
590
+ * @returns {string} A string representing the store_code.
591
+ */
592
+ matchStoreCodeFromLfpInventoryName(lfpInventoryName) {
593
+ return this.pathTemplates.lfpInventoryPathTemplate.match(lfpInventoryName).store_code;
594
+ }
595
+ /**
596
+ * Parse the offer from LfpInventory resource.
597
+ *
598
+ * @param {string} lfpInventoryName
599
+ * A fully-qualified path representing LfpInventory resource.
600
+ * @returns {string} A string representing the offer.
601
+ */
602
+ matchOfferFromLfpInventoryName(lfpInventoryName) {
603
+ return this.pathTemplates.lfpInventoryPathTemplate.match(lfpInventoryName).offer;
604
+ }
605
+ /**
606
+ * Return a fully-qualified lfpMerchantState resource name string.
607
+ *
608
+ * @param {string} account
609
+ * @param {string} lfp_merchant_state
610
+ * @returns {string} Resource name string.
611
+ */
612
+ lfpMerchantStatePath(account, lfpMerchantState) {
613
+ return this.pathTemplates.lfpMerchantStatePathTemplate.render({
614
+ account: account,
615
+ lfp_merchant_state: lfpMerchantState,
616
+ });
617
+ }
618
+ /**
619
+ * Parse the account from LfpMerchantState resource.
620
+ *
621
+ * @param {string} lfpMerchantStateName
622
+ * A fully-qualified path representing LfpMerchantState resource.
623
+ * @returns {string} A string representing the account.
624
+ */
625
+ matchAccountFromLfpMerchantStateName(lfpMerchantStateName) {
626
+ return this.pathTemplates.lfpMerchantStatePathTemplate.match(lfpMerchantStateName).account;
627
+ }
628
+ /**
629
+ * Parse the lfp_merchant_state from LfpMerchantState resource.
630
+ *
631
+ * @param {string} lfpMerchantStateName
632
+ * A fully-qualified path representing LfpMerchantState resource.
633
+ * @returns {string} A string representing the lfp_merchant_state.
634
+ */
635
+ matchLfpMerchantStateFromLfpMerchantStateName(lfpMerchantStateName) {
636
+ return this.pathTemplates.lfpMerchantStatePathTemplate.match(lfpMerchantStateName).lfp_merchant_state;
637
+ }
638
+ /**
639
+ * Return a fully-qualified lfpSale resource name string.
640
+ *
641
+ * @param {string} account
642
+ * @param {string} sale
643
+ * @returns {string} Resource name string.
644
+ */
645
+ lfpSalePath(account, sale) {
646
+ return this.pathTemplates.lfpSalePathTemplate.render({
647
+ account: account,
648
+ sale: sale,
649
+ });
650
+ }
651
+ /**
652
+ * Parse the account from LfpSale resource.
653
+ *
654
+ * @param {string} lfpSaleName
655
+ * A fully-qualified path representing LfpSale resource.
656
+ * @returns {string} A string representing the account.
657
+ */
658
+ matchAccountFromLfpSaleName(lfpSaleName) {
659
+ return this.pathTemplates.lfpSalePathTemplate.match(lfpSaleName).account;
660
+ }
661
+ /**
662
+ * Parse the sale from LfpSale resource.
663
+ *
664
+ * @param {string} lfpSaleName
665
+ * A fully-qualified path representing LfpSale resource.
666
+ * @returns {string} A string representing the sale.
667
+ */
668
+ matchSaleFromLfpSaleName(lfpSaleName) {
669
+ return this.pathTemplates.lfpSalePathTemplate.match(lfpSaleName).sale;
670
+ }
671
+ /**
672
+ * Return a fully-qualified lfpStore resource name string.
673
+ *
674
+ * @param {string} account
675
+ * @param {string} target_merchant
676
+ * @param {string} store_code
677
+ * @returns {string} Resource name string.
678
+ */
679
+ lfpStorePath(account, targetMerchant, storeCode) {
680
+ return this.pathTemplates.lfpStorePathTemplate.render({
681
+ account: account,
682
+ target_merchant: targetMerchant,
683
+ store_code: storeCode,
684
+ });
685
+ }
686
+ /**
687
+ * Parse the account from LfpStore resource.
688
+ *
689
+ * @param {string} lfpStoreName
690
+ * A fully-qualified path representing LfpStore resource.
691
+ * @returns {string} A string representing the account.
692
+ */
693
+ matchAccountFromLfpStoreName(lfpStoreName) {
694
+ return this.pathTemplates.lfpStorePathTemplate.match(lfpStoreName).account;
695
+ }
696
+ /**
697
+ * Parse the target_merchant from LfpStore resource.
698
+ *
699
+ * @param {string} lfpStoreName
700
+ * A fully-qualified path representing LfpStore resource.
701
+ * @returns {string} A string representing the target_merchant.
702
+ */
703
+ matchTargetMerchantFromLfpStoreName(lfpStoreName) {
704
+ return this.pathTemplates.lfpStorePathTemplate.match(lfpStoreName).target_merchant;
705
+ }
706
+ /**
707
+ * Parse the store_code from LfpStore resource.
708
+ *
709
+ * @param {string} lfpStoreName
710
+ * A fully-qualified path representing LfpStore resource.
711
+ * @returns {string} A string representing the store_code.
712
+ */
713
+ matchStoreCodeFromLfpStoreName(lfpStoreName) {
714
+ return this.pathTemplates.lfpStorePathTemplate.match(lfpStoreName).store_code;
715
+ }
716
+ /**
717
+ * Terminate the gRPC channel and close the client.
718
+ *
719
+ * The client will no longer be usable and all future behavior is undefined.
720
+ * @returns {Promise} A promise that resolves when the client is closed.
721
+ */
722
+ close() {
723
+ if (this.lfpStoreServiceStub && !this._terminated) {
724
+ return this.lfpStoreServiceStub.then(stub => {
725
+ this._log.info('ending gRPC channel');
726
+ this._terminated = true;
727
+ stub.close();
728
+ });
729
+ }
730
+ return Promise.resolve();
731
+ }
732
+ }
733
+ exports.LfpStoreServiceClient = LfpStoreServiceClient;
734
+ //# sourceMappingURL=lfp_store_service_client.js.map