@google-analytics/data 4.2.0 → 4.4.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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ class BetaAnalyticsDataClient {
72
72
  * ```
73
73
  */
74
74
  constructor(opts, gaxInstance) {
75
- var _a, _b;
75
+ var _a, _b, _c, _d;
76
76
  this._terminated = false;
77
77
  this.descriptors = {
78
78
  page: {},
@@ -82,16 +82,24 @@ class BetaAnalyticsDataClient {
82
82
  };
83
83
  // Ensure that options include all the required fields.
84
84
  const staticMembers = this.constructor;
85
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
85
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
86
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
87
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
88
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
+ }
90
+ this._universeDomain =
91
+ (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
92
+ this._servicePath = 'analyticsdata.' + this._universeDomain;
93
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
86
94
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
87
95
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
88
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
89
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
96
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
97
+ const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
90
98
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
91
99
  // Request numeric enum values if REST transport is used.
92
100
  opts.numericEnums = true;
93
101
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
94
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
102
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
95
103
  opts['scopes'] = staticMembers.scopes;
96
104
  }
97
105
  // Load google-gax module synchronously if needed
@@ -109,9 +117,9 @@ class BetaAnalyticsDataClient {
109
117
  // Set useJWTAccessWithScope on the auth object.
110
118
  this.auth.useJWTAccessWithScope = true;
111
119
  // Set defaultServicePath on the auth object.
112
- this.auth.defaultServicePath = staticMembers.servicePath;
120
+ this.auth.defaultServicePath = this._servicePath;
113
121
  // Set the default scopes in auth client if needed.
114
- if (servicePath === staticMembers.servicePath) {
122
+ if (servicePath === this._servicePath) {
115
123
  this.auth.defaultScopes = staticMembers.scopes;
116
124
  }
117
125
  // Determine the client header string.
@@ -137,7 +145,35 @@ class BetaAnalyticsDataClient {
137
145
  // identifiers to uniquely identify resources within the API.
138
146
  // Create useful helper objects for these.
139
147
  this.pathTemplates = {
148
+ audienceExportPathTemplate: new this._gaxModule.PathTemplate('properties/{property}/audienceExports/{audience_export}'),
140
149
  metadataPathTemplate: new this._gaxModule.PathTemplate('properties/{property}/metadata'),
150
+ propertyPathTemplate: new this._gaxModule.PathTemplate('properties/{property}'),
151
+ };
152
+ // Some of the methods on this service return "paged" results,
153
+ // (e.g. 50 results at a time, with tokens to get subsequent
154
+ // pages). Denote the keys used for pagination and results.
155
+ this.descriptors.page = {
156
+ listAudienceExports: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'audienceExports'),
157
+ };
158
+ const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
159
+ // This API contains "long-running operations", which return a
160
+ // an Operation object that allows for tracking of the operation,
161
+ // rather than holding a request open.
162
+ const lroOptions = {
163
+ auth: this.auth,
164
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
165
+ };
166
+ if (opts.fallback) {
167
+ lroOptions.protoJson = protoFilesRoot;
168
+ lroOptions.httpRules = [];
169
+ }
170
+ this.operationsClient = this._gaxModule
171
+ .lro(lroOptions)
172
+ .operationsClient(opts);
173
+ const createAudienceExportResponse = protoFilesRoot.lookup('.google.analytics.data.v1beta.AudienceExport');
174
+ const createAudienceExportMetadata = protoFilesRoot.lookup('.google.analytics.data.v1beta.AudienceExportMetadata');
175
+ this.descriptors.longrunning = {
176
+ createAudienceExport: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createAudienceExportResponse.decode.bind(createAudienceExportResponse), createAudienceExportMetadata.decode.bind(createAudienceExportMetadata)),
141
177
  };
142
178
  // Put together the default options sent with requests.
143
179
  this._defaults = this._gaxGrpc.constructSettings('google.analytics.data.v1beta.BetaAnalyticsData', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -180,6 +216,10 @@ class BetaAnalyticsDataClient {
180
216
  'getMetadata',
181
217
  'runRealtimeReport',
182
218
  'checkCompatibility',
219
+ 'createAudienceExport',
220
+ 'queryAudienceExport',
221
+ 'getAudienceExport',
222
+ 'listAudienceExports',
183
223
  ];
184
224
  for (const methodName of betaAnalyticsDataStubMethods) {
185
225
  const callPromise = this.betaAnalyticsDataStub.then(stub => (...args) => {
@@ -191,7 +231,9 @@ class BetaAnalyticsDataClient {
191
231
  }, (err) => () => {
192
232
  throw err;
193
233
  });
194
- const descriptor = undefined;
234
+ const descriptor = this.descriptors.page[methodName] ||
235
+ this.descriptors.longrunning[methodName] ||
236
+ undefined;
195
237
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
196
238
  this.innerApiCalls[methodName] = apiCall;
197
239
  }
@@ -199,19 +241,38 @@ class BetaAnalyticsDataClient {
199
241
  }
200
242
  /**
201
243
  * The DNS address for this API service.
244
+ * @deprecated Use the apiEndpoint method of the client instance.
202
245
  * @returns {string} The DNS address for this service.
203
246
  */
204
247
  static get servicePath() {
248
+ if (typeof process !== undefined &&
249
+ typeof process.emitWarning === 'function') {
250
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
251
+ }
205
252
  return 'analyticsdata.googleapis.com';
206
253
  }
207
254
  /**
208
- * The DNS address for this API service - same as servicePath(),
209
- * exists for compatibility reasons.
255
+ * The DNS address for this API service - same as servicePath.
256
+ * @deprecated Use the apiEndpoint method of the client instance.
210
257
  * @returns {string} The DNS address for this service.
211
258
  */
212
259
  static get apiEndpoint() {
260
+ if (typeof process !== undefined &&
261
+ typeof process.emitWarning === 'function') {
262
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
263
+ }
213
264
  return 'analyticsdata.googleapis.com';
214
265
  }
266
+ /**
267
+ * The DNS address for this API service.
268
+ * @returns {string} The DNS address for this service.
269
+ */
270
+ get apiEndpoint() {
271
+ return this._servicePath;
272
+ }
273
+ get universeDomain() {
274
+ return this._universeDomain;
275
+ }
215
276
  /**
216
277
  * The port for this API service.
217
278
  * @returns {number} The default port for this service.
@@ -388,9 +449,362 @@ class BetaAnalyticsDataClient {
388
449
  this.initialize();
389
450
  return this.innerApiCalls.checkCompatibility(request, options, callback);
390
451
  }
452
+ queryAudienceExport(request, optionsOrCallback, callback) {
453
+ var _a;
454
+ request = request || {};
455
+ let options;
456
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
457
+ callback = optionsOrCallback;
458
+ options = {};
459
+ }
460
+ else {
461
+ options = optionsOrCallback;
462
+ }
463
+ options = options || {};
464
+ options.otherArgs = options.otherArgs || {};
465
+ options.otherArgs.headers = options.otherArgs.headers || {};
466
+ options.otherArgs.headers['x-goog-request-params'] =
467
+ this._gaxModule.routingHeader.fromParams({
468
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
469
+ });
470
+ this.initialize();
471
+ return this.innerApiCalls.queryAudienceExport(request, options, callback);
472
+ }
473
+ getAudienceExport(request, optionsOrCallback, callback) {
474
+ var _a;
475
+ request = request || {};
476
+ let options;
477
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
478
+ callback = optionsOrCallback;
479
+ options = {};
480
+ }
481
+ else {
482
+ options = optionsOrCallback;
483
+ }
484
+ options = options || {};
485
+ options.otherArgs = options.otherArgs || {};
486
+ options.otherArgs.headers = options.otherArgs.headers || {};
487
+ options.otherArgs.headers['x-goog-request-params'] =
488
+ this._gaxModule.routingHeader.fromParams({
489
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
490
+ });
491
+ this.initialize();
492
+ return this.innerApiCalls.getAudienceExport(request, options, callback);
493
+ }
494
+ createAudienceExport(request, optionsOrCallback, callback) {
495
+ var _a;
496
+ request = request || {};
497
+ let options;
498
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
499
+ callback = optionsOrCallback;
500
+ options = {};
501
+ }
502
+ else {
503
+ options = optionsOrCallback;
504
+ }
505
+ options = options || {};
506
+ options.otherArgs = options.otherArgs || {};
507
+ options.otherArgs.headers = options.otherArgs.headers || {};
508
+ options.otherArgs.headers['x-goog-request-params'] =
509
+ this._gaxModule.routingHeader.fromParams({
510
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
511
+ });
512
+ this.initialize();
513
+ return this.innerApiCalls.createAudienceExport(request, options, callback);
514
+ }
515
+ /**
516
+ * Check the status of the long running operation returned by `createAudienceExport()`.
517
+ * @param {String} name
518
+ * The operation name that will be passed.
519
+ * @returns {Promise} - The promise which resolves to an object.
520
+ * The decoded operation object has result and metadata field to get information from.
521
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
522
+ * for more details and examples.
523
+ * @example <caption>include:samples/generated/v1beta/beta_analytics_data.create_audience_export.js</caption>
524
+ * region_tag:analyticsdata_v1beta_generated_BetaAnalyticsData_CreateAudienceExport_async
525
+ */
526
+ async checkCreateAudienceExportProgress(name) {
527
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
528
+ const [operation] = await this.operationsClient.getOperation(request);
529
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAudienceExport, this._gaxModule.createDefaultBackoffSettings());
530
+ return decodeOperation;
531
+ }
532
+ listAudienceExports(request, optionsOrCallback, callback) {
533
+ var _a;
534
+ request = request || {};
535
+ let options;
536
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
537
+ callback = optionsOrCallback;
538
+ options = {};
539
+ }
540
+ else {
541
+ options = optionsOrCallback;
542
+ }
543
+ options = options || {};
544
+ options.otherArgs = options.otherArgs || {};
545
+ options.otherArgs.headers = options.otherArgs.headers || {};
546
+ options.otherArgs.headers['x-goog-request-params'] =
547
+ this._gaxModule.routingHeader.fromParams({
548
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
549
+ });
550
+ this.initialize();
551
+ return this.innerApiCalls.listAudienceExports(request, options, callback);
552
+ }
553
+ /**
554
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
555
+ * @param {Object} request
556
+ * The request object that will be sent.
557
+ * @param {string} request.parent
558
+ * Required. All audience exports for this property will be listed in the
559
+ * response. Format: `properties/{property}`
560
+ * @param {number} [request.pageSize]
561
+ * Optional. The maximum number of audience exports to return. The service may
562
+ * return fewer than this value. If unspecified, at most 200 audience exports
563
+ * will be returned. The maximum value is 1000 (higher values will be coerced
564
+ * to the maximum).
565
+ * @param {string} [request.pageToken]
566
+ * Optional. A page token, received from a previous `ListAudienceExports`
567
+ * call. Provide this to retrieve the subsequent page.
568
+ *
569
+ * When paginating, all other parameters provided to `ListAudienceExports`
570
+ * must match the call that provided the page token.
571
+ * @param {object} [options]
572
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
573
+ * @returns {Stream}
574
+ * An object stream which emits an object representing {@link protos.google.analytics.data.v1beta.AudienceExport|AudienceExport} on 'data' event.
575
+ * The client library will perform auto-pagination by default: it will call the API as many
576
+ * times as needed. Note that it can affect your quota.
577
+ * We recommend using `listAudienceExportsAsync()`
578
+ * method described below for async iteration which you can stop as needed.
579
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
580
+ * for more details and examples.
581
+ */
582
+ listAudienceExportsStream(request, options) {
583
+ var _a;
584
+ request = request || {};
585
+ options = options || {};
586
+ options.otherArgs = options.otherArgs || {};
587
+ options.otherArgs.headers = options.otherArgs.headers || {};
588
+ options.otherArgs.headers['x-goog-request-params'] =
589
+ this._gaxModule.routingHeader.fromParams({
590
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
591
+ });
592
+ const defaultCallSettings = this._defaults['listAudienceExports'];
593
+ const callSettings = defaultCallSettings.merge(options);
594
+ this.initialize();
595
+ return this.descriptors.page.listAudienceExports.createStream(this.innerApiCalls.listAudienceExports, request, callSettings);
596
+ }
597
+ /**
598
+ * Equivalent to `listAudienceExports`, but returns an iterable object.
599
+ *
600
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
601
+ * @param {Object} request
602
+ * The request object that will be sent.
603
+ * @param {string} request.parent
604
+ * Required. All audience exports for this property will be listed in the
605
+ * response. Format: `properties/{property}`
606
+ * @param {number} [request.pageSize]
607
+ * Optional. The maximum number of audience exports to return. The service may
608
+ * return fewer than this value. If unspecified, at most 200 audience exports
609
+ * will be returned. The maximum value is 1000 (higher values will be coerced
610
+ * to the maximum).
611
+ * @param {string} [request.pageToken]
612
+ * Optional. A page token, received from a previous `ListAudienceExports`
613
+ * call. Provide this to retrieve the subsequent page.
614
+ *
615
+ * When paginating, all other parameters provided to `ListAudienceExports`
616
+ * must match the call that provided the page token.
617
+ * @param {object} [options]
618
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
619
+ * @returns {Object}
620
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
621
+ * When you iterate the returned iterable, each element will be an object representing
622
+ * {@link protos.google.analytics.data.v1beta.AudienceExport|AudienceExport}. The API will be called under the hood as needed, once per the page,
623
+ * so you can stop the iteration when you don't need more results.
624
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
625
+ * for more details and examples.
626
+ * @example <caption>include:samples/generated/v1beta/beta_analytics_data.list_audience_exports.js</caption>
627
+ * region_tag:analyticsdata_v1beta_generated_BetaAnalyticsData_ListAudienceExports_async
628
+ */
629
+ listAudienceExportsAsync(request, options) {
630
+ var _a;
631
+ request = request || {};
632
+ options = options || {};
633
+ options.otherArgs = options.otherArgs || {};
634
+ options.otherArgs.headers = options.otherArgs.headers || {};
635
+ options.otherArgs.headers['x-goog-request-params'] =
636
+ this._gaxModule.routingHeader.fromParams({
637
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
638
+ });
639
+ const defaultCallSettings = this._defaults['listAudienceExports'];
640
+ const callSettings = defaultCallSettings.merge(options);
641
+ this.initialize();
642
+ return this.descriptors.page.listAudienceExports.asyncIterate(this.innerApiCalls['listAudienceExports'], request, callSettings);
643
+ }
644
+ /**
645
+ * Gets the latest state of a long-running operation. Clients can use this
646
+ * method to poll the operation result at intervals as recommended by the API
647
+ * service.
648
+ *
649
+ * @param {Object} request - The request object that will be sent.
650
+ * @param {string} request.name - The name of the operation resource.
651
+ * @param {Object=} options
652
+ * Optional parameters. You can override the default settings for this call,
653
+ * e.g, timeout, retries, paginations, etc. See {@link
654
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
655
+ * for the details.
656
+ * @param {function(?Error, ?Object)=} callback
657
+ * The function which will be called with the result of the API call.
658
+ *
659
+ * The second parameter to the callback is an object representing
660
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
661
+ * @return {Promise} - The promise which resolves to an array.
662
+ * The first element of the array is an object representing
663
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
664
+ * The promise has a method named "cancel" which cancels the ongoing API call.
665
+ *
666
+ * @example
667
+ * ```
668
+ * const client = longrunning.operationsClient();
669
+ * const name = '';
670
+ * const [response] = await client.getOperation({name});
671
+ * // doThingsWith(response)
672
+ * ```
673
+ */
674
+ getOperation(request, options, callback) {
675
+ return this.operationsClient.getOperation(request, options, callback);
676
+ }
677
+ /**
678
+ * Lists operations that match the specified filter in the request. If the
679
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
680
+ *
681
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
682
+ *
683
+ * @param {Object} request - The request object that will be sent.
684
+ * @param {string} request.name - The name of the operation collection.
685
+ * @param {string} request.filter - The standard list filter.
686
+ * @param {number=} request.pageSize -
687
+ * The maximum number of resources contained in the underlying API
688
+ * response. If page streaming is performed per-resource, this
689
+ * parameter does not affect the return value. If page streaming is
690
+ * performed per-page, this determines the maximum number of
691
+ * resources in a page.
692
+ * @param {Object=} options
693
+ * Optional parameters. You can override the default settings for this call,
694
+ * e.g, timeout, retries, paginations, etc. See {@link
695
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
696
+ * details.
697
+ * @returns {Object}
698
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
699
+ *
700
+ * @example
701
+ * ```
702
+ * const client = longrunning.operationsClient();
703
+ * for await (const response of client.listOperationsAsync(request));
704
+ * // doThingsWith(response)
705
+ * ```
706
+ */
707
+ listOperationsAsync(request, options) {
708
+ return this.operationsClient.listOperationsAsync(request, options);
709
+ }
710
+ /**
711
+ * Starts asynchronous cancellation on a long-running operation. The server
712
+ * makes a best effort to cancel the operation, but success is not
713
+ * guaranteed. If the server doesn't support this method, it returns
714
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
715
+ * {@link Operations.GetOperation} or
716
+ * other methods to check whether the cancellation succeeded or whether the
717
+ * operation completed despite cancellation. On successful cancellation,
718
+ * the operation is not deleted; instead, it becomes an operation with
719
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
720
+ * 1, corresponding to `Code.CANCELLED`.
721
+ *
722
+ * @param {Object} request - The request object that will be sent.
723
+ * @param {string} request.name - The name of the operation resource to be cancelled.
724
+ * @param {Object=} options
725
+ * Optional parameters. You can override the default settings for this call,
726
+ * e.g, timeout, retries, paginations, etc. See {@link
727
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
728
+ * details.
729
+ * @param {function(?Error)=} callback
730
+ * The function which will be called with the result of the API call.
731
+ * @return {Promise} - The promise which resolves when API call finishes.
732
+ * The promise has a method named "cancel" which cancels the ongoing API
733
+ * call.
734
+ *
735
+ * @example
736
+ * ```
737
+ * const client = longrunning.operationsClient();
738
+ * await client.cancelOperation({name: ''});
739
+ * ```
740
+ */
741
+ cancelOperation(request, options, callback) {
742
+ return this.operationsClient.cancelOperation(request, options, callback);
743
+ }
744
+ /**
745
+ * Deletes a long-running operation. This method indicates that the client is
746
+ * no longer interested in the operation result. It does not cancel the
747
+ * operation. If the server doesn't support this method, it returns
748
+ * `google.rpc.Code.UNIMPLEMENTED`.
749
+ *
750
+ * @param {Object} request - The request object that will be sent.
751
+ * @param {string} request.name - The name of the operation resource to be deleted.
752
+ * @param {Object=} options
753
+ * Optional parameters. You can override the default settings for this call,
754
+ * e.g, timeout, retries, paginations, etc. See {@link
755
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
756
+ * for the details.
757
+ * @param {function(?Error)=} callback
758
+ * The function which will be called with the result of the API call.
759
+ * @return {Promise} - The promise which resolves when API call finishes.
760
+ * The promise has a method named "cancel" which cancels the ongoing API
761
+ * call.
762
+ *
763
+ * @example
764
+ * ```
765
+ * const client = longrunning.operationsClient();
766
+ * await client.deleteOperation({name: ''});
767
+ * ```
768
+ */
769
+ deleteOperation(request, options, callback) {
770
+ return this.operationsClient.deleteOperation(request, options, callback);
771
+ }
391
772
  // --------------------
392
773
  // -- Path templates --
393
774
  // --------------------
775
+ /**
776
+ * Return a fully-qualified audienceExport resource name string.
777
+ *
778
+ * @param {string} property
779
+ * @param {string} audience_export
780
+ * @returns {string} Resource name string.
781
+ */
782
+ audienceExportPath(property, audienceExport) {
783
+ return this.pathTemplates.audienceExportPathTemplate.render({
784
+ property: property,
785
+ audience_export: audienceExport,
786
+ });
787
+ }
788
+ /**
789
+ * Parse the property from AudienceExport resource.
790
+ *
791
+ * @param {string} audienceExportName
792
+ * A fully-qualified path representing AudienceExport resource.
793
+ * @returns {string} A string representing the property.
794
+ */
795
+ matchPropertyFromAudienceExportName(audienceExportName) {
796
+ return this.pathTemplates.audienceExportPathTemplate.match(audienceExportName).property;
797
+ }
798
+ /**
799
+ * Parse the audience_export from AudienceExport resource.
800
+ *
801
+ * @param {string} audienceExportName
802
+ * A fully-qualified path representing AudienceExport resource.
803
+ * @returns {string} A string representing the audience_export.
804
+ */
805
+ matchAudienceExportFromAudienceExportName(audienceExportName) {
806
+ return this.pathTemplates.audienceExportPathTemplate.match(audienceExportName).audience_export;
807
+ }
394
808
  /**
395
809
  * Return a fully-qualified metadata resource name string.
396
810
  *
@@ -412,6 +826,27 @@ class BetaAnalyticsDataClient {
412
826
  matchPropertyFromMetadataName(metadataName) {
413
827
  return this.pathTemplates.metadataPathTemplate.match(metadataName).property;
414
828
  }
829
+ /**
830
+ * Return a fully-qualified property resource name string.
831
+ *
832
+ * @param {string} property
833
+ * @returns {string} Resource name string.
834
+ */
835
+ propertyPath(property) {
836
+ return this.pathTemplates.propertyPathTemplate.render({
837
+ property: property,
838
+ });
839
+ }
840
+ /**
841
+ * Parse the property from Property resource.
842
+ *
843
+ * @param {string} propertyName
844
+ * A fully-qualified path representing Property resource.
845
+ * @returns {string} A string representing the property.
846
+ */
847
+ matchPropertyFromPropertyName(propertyName) {
848
+ return this.pathTemplates.propertyPathTemplate.match(propertyName).property;
849
+ }
415
850
  /**
416
851
  * Terminate the gRPC channel and close the client.
417
852
  *
@@ -423,6 +858,7 @@ class BetaAnalyticsDataClient {
423
858
  return this.betaAnalyticsDataStub.then(stub => {
424
859
  this._terminated = true;
425
860
  stub.close();
861
+ this.operationsClient.close();
426
862
  });
427
863
  }
428
864
  return Promise.resolve();
@@ -6,6 +6,9 @@
6
6
  "idempotent": [
7
7
  "DEADLINE_EXCEEDED",
8
8
  "UNAVAILABLE"
9
+ ],
10
+ "unknown": [
11
+ "UNKNOWN"
9
12
  ]
10
13
  },
11
14
  "retry_params": {
@@ -17,6 +20,15 @@
17
20
  "rpc_timeout_multiplier": 1,
18
21
  "max_rpc_timeout_millis": 60000,
19
22
  "total_timeout_millis": 600000
23
+ },
24
+ "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c": {
25
+ "initial_retry_delay_millis": 1000,
26
+ "retry_delay_multiplier": 1.3,
27
+ "max_retry_delay_millis": 60000,
28
+ "initial_rpc_timeout_millis": 60000,
29
+ "rpc_timeout_multiplier": 1,
30
+ "max_rpc_timeout_millis": 60000,
31
+ "total_timeout_millis": 600000
20
32
  }
21
33
  },
22
34
  "methods": {
@@ -54,6 +66,26 @@
54
66
  "timeout_millis": 60000,
55
67
  "retry_codes_name": "non_idempotent",
56
68
  "retry_params_name": "default"
69
+ },
70
+ "CreateAudienceExport": {
71
+ "timeout_millis": 60000,
72
+ "retry_codes_name": "unknown",
73
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
74
+ },
75
+ "QueryAudienceExport": {
76
+ "timeout_millis": 60000,
77
+ "retry_codes_name": "unknown",
78
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
79
+ },
80
+ "GetAudienceExport": {
81
+ "timeout_millis": 60000,
82
+ "retry_codes_name": "unknown",
83
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
84
+ },
85
+ "ListAudienceExports": {
86
+ "timeout_millis": 60000,
87
+ "retry_codes_name": "unknown",
88
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
57
89
  }
58
90
  }
59
91
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-analytics/data",
3
- "version": "4.2.0",
3
+ "version": "4.4.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  "@types/node": "^20.4.5",
53
53
  "@types/sinon": "^17.0.0",
54
54
  "c8": "^8.0.1",
55
- "gapic-tools": "^0.2.0",
55
+ "gapic-tools": "^0.3.0",
56
56
  "gts": "^5.0.0",
57
57
  "jsdoc": "^4.0.0",
58
58
  "jsdoc-fresh": "^3.0.0",