@google-analytics/data 4.3.0 → 4.5.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.
@@ -16,6 +16,8 @@ export declare class AlphaAnalyticsDataClient {
16
16
  private _gaxGrpc;
17
17
  private _protos;
18
18
  private _defaults;
19
+ private _universeDomain;
20
+ private _servicePath;
19
21
  auth: gax.GoogleAuth;
20
22
  descriptors: Descriptors;
21
23
  warn: (code: string, message: string, warnType?: string) => void;
@@ -85,15 +87,22 @@ export declare class AlphaAnalyticsDataClient {
85
87
  }>;
86
88
  /**
87
89
  * The DNS address for this API service.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
88
91
  * @returns {string} The DNS address for this service.
89
92
  */
90
93
  static get servicePath(): string;
91
94
  /**
92
- * The DNS address for this API service - same as servicePath(),
93
- * exists for compatibility reasons.
95
+ * The DNS address for this API service - same as servicePath.
96
+ * @deprecated Use the apiEndpoint method of the client instance.
94
97
  * @returns {string} The DNS address for this service.
95
98
  */
96
99
  static get apiEndpoint(): string;
100
+ /**
101
+ * The DNS address for this API service.
102
+ * @returns {string} The DNS address for this service.
103
+ */
104
+ get apiEndpoint(): string;
105
+ get universeDomain(): string;
97
106
  /**
98
107
  * The port for this API service.
99
108
  * @returns {number} The default port for this service.
@@ -219,11 +228,10 @@ export declare class AlphaAnalyticsDataClient {
219
228
  * that are important to your business. To learn more, see
220
229
  * https://support.google.com/analytics/answer/9267572.
221
230
  *
222
- * This method is introduced at alpha stability with the intention of
223
- * gathering feedback on syntax and capabilities before entering beta. To give
224
- * your feedback on this API, complete the
225
- * [Google Analytics Audience Export API
226
- * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
231
+ * This method is available at beta stability at
232
+ * [audienceExports.query](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties.audienceExports/query).
233
+ * To give your feedback on this API, complete the [Google Analytics Audience
234
+ * Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
227
235
  *
228
236
  * @param {Object} request
229
237
  * The request object that will be sent.
@@ -338,9 +346,9 @@ export declare class AlphaAnalyticsDataClient {
338
346
  * List](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
339
347
  * for an introduction to Audience Lists with examples.
340
348
  *
341
- * This method is introduced at alpha stability with the intention of
342
- * gathering feedback on syntax and capabilities before entering beta. To give
343
- * your feedback on this API, complete the
349
+ * This method is available at beta stability at
350
+ * [audienceExports.get](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties.audienceExports/get).
351
+ * To give your feedback on this API, complete the
344
352
  * [Google Analytics Audience Export API
345
353
  * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
346
354
  *
@@ -464,11 +472,10 @@ export declare class AlphaAnalyticsDataClient {
464
472
  * https://support.google.com/analytics/answer/9267572. Audience lists contain
465
473
  * the users in each audience.
466
474
  *
467
- * This method is introduced at alpha stability with the intention of
468
- * gathering feedback on syntax and capabilities before entering beta. To give
469
- * your feedback on this API, complete the
470
- * [Google Analytics Audience Export API
471
- * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
475
+ * This method is available at beta stability at
476
+ * [audienceExports.create](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties.audienceExports/create).
477
+ * To give your feedback on this API, complete the [Google Analytics Audience
478
+ * Export API Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
472
479
  *
473
480
  * @param {Object} request
474
481
  * The request object that will be sent.
@@ -517,9 +524,9 @@ export declare class AlphaAnalyticsDataClient {
517
524
  * List](https://developers.google.com/analytics/devguides/reporting/data/v1/audience-list-basics)
518
525
  * for an introduction to Audience Lists with examples.
519
526
  *
520
- * This method is introduced at alpha stability with the intention of
521
- * gathering feedback on syntax and capabilities before entering beta. To give
522
- * your feedback on this API, complete the
527
+ * This method is available at beta stability at
528
+ * [audienceExports.list](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties.audienceExports/list).
529
+ * To give your feedback on this API, complete the
523
530
  * [Google Analytics Audience Export API
524
531
  * Feedback](https://forms.gle/EeA5u5LW6PEggtCEA) form.
525
532
  *
@@ -739,6 +746,126 @@ export declare class AlphaAnalyticsDataClient {
739
746
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async
740
747
  */
741
748
  listRecurringAudienceListsAsync(request?: protos.google.analytics.data.v1alpha.IListRecurringAudienceListsRequest, options?: CallOptions): AsyncIterable<protos.google.analytics.data.v1alpha.IRecurringAudienceList>;
749
+ /**
750
+ * Gets the latest state of a long-running operation. Clients can use this
751
+ * method to poll the operation result at intervals as recommended by the API
752
+ * service.
753
+ *
754
+ * @param {Object} request - The request object that will be sent.
755
+ * @param {string} request.name - The name of the operation resource.
756
+ * @param {Object=} options
757
+ * Optional parameters. You can override the default settings for this call,
758
+ * e.g, timeout, retries, paginations, etc. See {@link
759
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
760
+ * for the details.
761
+ * @param {function(?Error, ?Object)=} callback
762
+ * The function which will be called with the result of the API call.
763
+ *
764
+ * The second parameter to the callback is an object representing
765
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
766
+ * @return {Promise} - The promise which resolves to an array.
767
+ * The first element of the array is an object representing
768
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
769
+ * The promise has a method named "cancel" which cancels the ongoing API call.
770
+ *
771
+ * @example
772
+ * ```
773
+ * const client = longrunning.operationsClient();
774
+ * const name = '';
775
+ * const [response] = await client.getOperation({name});
776
+ * // doThingsWith(response)
777
+ * ```
778
+ */
779
+ getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
780
+ /**
781
+ * Lists operations that match the specified filter in the request. If the
782
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
783
+ *
784
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
785
+ *
786
+ * @param {Object} request - The request object that will be sent.
787
+ * @param {string} request.name - The name of the operation collection.
788
+ * @param {string} request.filter - The standard list filter.
789
+ * @param {number=} request.pageSize -
790
+ * The maximum number of resources contained in the underlying API
791
+ * response. If page streaming is performed per-resource, this
792
+ * parameter does not affect the return value. If page streaming is
793
+ * performed per-page, this determines the maximum number of
794
+ * resources in a page.
795
+ * @param {Object=} options
796
+ * Optional parameters. You can override the default settings for this call,
797
+ * e.g, timeout, retries, paginations, etc. See {@link
798
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
799
+ * details.
800
+ * @returns {Object}
801
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
802
+ *
803
+ * @example
804
+ * ```
805
+ * const client = longrunning.operationsClient();
806
+ * for await (const response of client.listOperationsAsync(request));
807
+ * // doThingsWith(response)
808
+ * ```
809
+ */
810
+ listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
811
+ /**
812
+ * Starts asynchronous cancellation on a long-running operation. The server
813
+ * makes a best effort to cancel the operation, but success is not
814
+ * guaranteed. If the server doesn't support this method, it returns
815
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
816
+ * {@link Operations.GetOperation} or
817
+ * other methods to check whether the cancellation succeeded or whether the
818
+ * operation completed despite cancellation. On successful cancellation,
819
+ * the operation is not deleted; instead, it becomes an operation with
820
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
821
+ * 1, corresponding to `Code.CANCELLED`.
822
+ *
823
+ * @param {Object} request - The request object that will be sent.
824
+ * @param {string} request.name - The name of the operation resource to be cancelled.
825
+ * @param {Object=} options
826
+ * Optional parameters. You can override the default settings for this call,
827
+ * e.g, timeout, retries, paginations, etc. See {@link
828
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
829
+ * details.
830
+ * @param {function(?Error)=} callback
831
+ * The function which will be called with the result of the API call.
832
+ * @return {Promise} - The promise which resolves when API call finishes.
833
+ * The promise has a method named "cancel" which cancels the ongoing API
834
+ * call.
835
+ *
836
+ * @example
837
+ * ```
838
+ * const client = longrunning.operationsClient();
839
+ * await client.cancelOperation({name: ''});
840
+ * ```
841
+ */
842
+ cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
843
+ /**
844
+ * Deletes a long-running operation. This method indicates that the client is
845
+ * no longer interested in the operation result. It does not cancel the
846
+ * operation. If the server doesn't support this method, it returns
847
+ * `google.rpc.Code.UNIMPLEMENTED`.
848
+ *
849
+ * @param {Object} request - The request object that will be sent.
850
+ * @param {string} request.name - The name of the operation resource to be deleted.
851
+ * @param {Object=} options
852
+ * Optional parameters. You can override the default settings for this call,
853
+ * e.g, timeout, retries, paginations, etc. See {@link
854
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
855
+ * for the details.
856
+ * @param {function(?Error)=} callback
857
+ * The function which will be called with the result of the API call.
858
+ * @return {Promise} - The promise which resolves when API call finishes.
859
+ * The promise has a method named "cancel" which cancels the ongoing API
860
+ * call.
861
+ *
862
+ * @example
863
+ * ```
864
+ * const client = longrunning.operationsClient();
865
+ * await client.deleteOperation({name: ''});
866
+ * ```
867
+ */
868
+ deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
742
869
  /**
743
870
  * Return a fully-qualified audienceList resource name string.
744
871
  *
@@ -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 AlphaAnalyticsDataClient {
72
72
  * ```
73
73
  */
74
74
  constructor(opts, gaxInstance) {
75
- var _a, _b;
75
+ var _a, _b, _c, _d, _e;
76
76
  this._terminated = false;
77
77
  this.descriptors = {
78
78
  page: {},
@@ -82,16 +82,27 @@ class AlphaAnalyticsDataClient {
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
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
+ : undefined;
93
+ this._universeDomain =
94
+ (_c = (_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 : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
95
+ this._servicePath = 'analyticsdata.' + this._universeDomain;
96
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
86
97
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
87
98
  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');
99
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
100
+ const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
90
101
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
91
102
  // Request numeric enum values if REST transport is used.
92
103
  opts.numericEnums = true;
93
104
  // 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)) {
105
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
95
106
  opts['scopes'] = staticMembers.scopes;
96
107
  }
97
108
  // Load google-gax module synchronously if needed
@@ -109,14 +120,14 @@ class AlphaAnalyticsDataClient {
109
120
  // Set useJWTAccessWithScope on the auth object.
110
121
  this.auth.useJWTAccessWithScope = true;
111
122
  // Set defaultServicePath on the auth object.
112
- this.auth.defaultServicePath = staticMembers.servicePath;
123
+ this.auth.defaultServicePath = this._servicePath;
113
124
  // Set the default scopes in auth client if needed.
114
- if (servicePath === staticMembers.servicePath) {
125
+ if (servicePath === this._servicePath) {
115
126
  this.auth.defaultScopes = staticMembers.scopes;
116
127
  }
117
128
  // Determine the client header string.
118
129
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
119
- if (typeof process !== 'undefined' && 'versions' in process) {
130
+ if (typeof process === 'object' && 'versions' in process) {
120
131
  clientHeader.push(`gl-node/${process.versions.node}`);
121
132
  }
122
133
  else {
@@ -233,19 +244,38 @@ class AlphaAnalyticsDataClient {
233
244
  }
234
245
  /**
235
246
  * The DNS address for this API service.
247
+ * @deprecated Use the apiEndpoint method of the client instance.
236
248
  * @returns {string} The DNS address for this service.
237
249
  */
238
250
  static get servicePath() {
251
+ if (typeof process === 'object' &&
252
+ typeof process.emitWarning === 'function') {
253
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
254
+ }
239
255
  return 'analyticsdata.googleapis.com';
240
256
  }
241
257
  /**
242
- * The DNS address for this API service - same as servicePath(),
243
- * exists for compatibility reasons.
258
+ * The DNS address for this API service - same as servicePath.
259
+ * @deprecated Use the apiEndpoint method of the client instance.
244
260
  * @returns {string} The DNS address for this service.
245
261
  */
246
262
  static get apiEndpoint() {
263
+ if (typeof process === 'object' &&
264
+ typeof process.emitWarning === 'function') {
265
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
266
+ }
247
267
  return 'analyticsdata.googleapis.com';
248
268
  }
269
+ /**
270
+ * The DNS address for this API service.
271
+ * @returns {string} The DNS address for this service.
272
+ */
273
+ get apiEndpoint() {
274
+ return this._servicePath;
275
+ }
276
+ get universeDomain() {
277
+ return this._universeDomain;
278
+ }
249
279
  /**
250
280
  * The port for this API service.
251
281
  * @returns {number} The default port for this service.
@@ -670,6 +700,134 @@ class AlphaAnalyticsDataClient {
670
700
  this.initialize();
671
701
  return this.descriptors.page.listRecurringAudienceLists.asyncIterate(this.innerApiCalls['listRecurringAudienceLists'], request, callSettings);
672
702
  }
703
+ /**
704
+ * Gets the latest state of a long-running operation. Clients can use this
705
+ * method to poll the operation result at intervals as recommended by the API
706
+ * service.
707
+ *
708
+ * @param {Object} request - The request object that will be sent.
709
+ * @param {string} request.name - The name of the operation resource.
710
+ * @param {Object=} options
711
+ * Optional parameters. You can override the default settings for this call,
712
+ * e.g, timeout, retries, paginations, etc. See {@link
713
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
714
+ * for the details.
715
+ * @param {function(?Error, ?Object)=} callback
716
+ * The function which will be called with the result of the API call.
717
+ *
718
+ * The second parameter to the callback is an object representing
719
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
720
+ * @return {Promise} - The promise which resolves to an array.
721
+ * The first element of the array is an object representing
722
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
723
+ * The promise has a method named "cancel" which cancels the ongoing API call.
724
+ *
725
+ * @example
726
+ * ```
727
+ * const client = longrunning.operationsClient();
728
+ * const name = '';
729
+ * const [response] = await client.getOperation({name});
730
+ * // doThingsWith(response)
731
+ * ```
732
+ */
733
+ getOperation(request, options, callback) {
734
+ return this.operationsClient.getOperation(request, options, callback);
735
+ }
736
+ /**
737
+ * Lists operations that match the specified filter in the request. If the
738
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
739
+ *
740
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
741
+ *
742
+ * @param {Object} request - The request object that will be sent.
743
+ * @param {string} request.name - The name of the operation collection.
744
+ * @param {string} request.filter - The standard list filter.
745
+ * @param {number=} request.pageSize -
746
+ * The maximum number of resources contained in the underlying API
747
+ * response. If page streaming is performed per-resource, this
748
+ * parameter does not affect the return value. If page streaming is
749
+ * performed per-page, this determines the maximum number of
750
+ * resources in a page.
751
+ * @param {Object=} options
752
+ * Optional parameters. You can override the default settings for this call,
753
+ * e.g, timeout, retries, paginations, etc. See {@link
754
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
755
+ * details.
756
+ * @returns {Object}
757
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
758
+ *
759
+ * @example
760
+ * ```
761
+ * const client = longrunning.operationsClient();
762
+ * for await (const response of client.listOperationsAsync(request));
763
+ * // doThingsWith(response)
764
+ * ```
765
+ */
766
+ listOperationsAsync(request, options) {
767
+ return this.operationsClient.listOperationsAsync(request, options);
768
+ }
769
+ /**
770
+ * Starts asynchronous cancellation on a long-running operation. The server
771
+ * makes a best effort to cancel the operation, but success is not
772
+ * guaranteed. If the server doesn't support this method, it returns
773
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
774
+ * {@link Operations.GetOperation} or
775
+ * other methods to check whether the cancellation succeeded or whether the
776
+ * operation completed despite cancellation. On successful cancellation,
777
+ * the operation is not deleted; instead, it becomes an operation with
778
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
779
+ * 1, corresponding to `Code.CANCELLED`.
780
+ *
781
+ * @param {Object} request - The request object that will be sent.
782
+ * @param {string} request.name - The name of the operation resource to be cancelled.
783
+ * @param {Object=} options
784
+ * Optional parameters. You can override the default settings for this call,
785
+ * e.g, timeout, retries, paginations, etc. See {@link
786
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
787
+ * details.
788
+ * @param {function(?Error)=} callback
789
+ * The function which will be called with the result of the API call.
790
+ * @return {Promise} - The promise which resolves when API call finishes.
791
+ * The promise has a method named "cancel" which cancels the ongoing API
792
+ * call.
793
+ *
794
+ * @example
795
+ * ```
796
+ * const client = longrunning.operationsClient();
797
+ * await client.cancelOperation({name: ''});
798
+ * ```
799
+ */
800
+ cancelOperation(request, options, callback) {
801
+ return this.operationsClient.cancelOperation(request, options, callback);
802
+ }
803
+ /**
804
+ * Deletes a long-running operation. This method indicates that the client is
805
+ * no longer interested in the operation result. It does not cancel the
806
+ * operation. If the server doesn't support this method, it returns
807
+ * `google.rpc.Code.UNIMPLEMENTED`.
808
+ *
809
+ * @param {Object} request - The request object that will be sent.
810
+ * @param {string} request.name - The name of the operation resource to be deleted.
811
+ * @param {Object=} options
812
+ * Optional parameters. You can override the default settings for this call,
813
+ * e.g, timeout, retries, paginations, etc. See {@link
814
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
815
+ * for the details.
816
+ * @param {function(?Error)=} callback
817
+ * The function which will be called with the result of the API call.
818
+ * @return {Promise} - The promise which resolves when API call finishes.
819
+ * The promise has a method named "cancel" which cancels the ongoing API
820
+ * call.
821
+ *
822
+ * @example
823
+ * ```
824
+ * const client = longrunning.operationsClient();
825
+ * await client.deleteOperation({name: ''});
826
+ * ```
827
+ */
828
+ deleteOperation(request, options, callback) {
829
+ return this.operationsClient.deleteOperation(request, options, callback);
830
+ }
673
831
  // --------------------
674
832
  // -- Path templates --
675
833
  // --------------------
@@ -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.
@@ -16,6 +16,8 @@ export declare class BetaAnalyticsDataClient {
16
16
  private _gaxGrpc;
17
17
  private _protos;
18
18
  private _defaults;
19
+ private _universeDomain;
20
+ private _servicePath;
19
21
  auth: gax.GoogleAuth;
20
22
  descriptors: Descriptors;
21
23
  warn: (code: string, message: string, warnType?: string) => void;
@@ -85,15 +87,22 @@ export declare class BetaAnalyticsDataClient {
85
87
  }>;
86
88
  /**
87
89
  * The DNS address for this API service.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
88
91
  * @returns {string} The DNS address for this service.
89
92
  */
90
93
  static get servicePath(): string;
91
94
  /**
92
- * The DNS address for this API service - same as servicePath(),
93
- * exists for compatibility reasons.
95
+ * The DNS address for this API service - same as servicePath.
96
+ * @deprecated Use the apiEndpoint method of the client instance.
94
97
  * @returns {string} The DNS address for this service.
95
98
  */
96
99
  static get apiEndpoint(): string;
100
+ /**
101
+ * The DNS address for this API service.
102
+ * @returns {string} The DNS address for this service.
103
+ */
104
+ get apiEndpoint(): string;
105
+ get universeDomain(): string;
97
106
  /**
98
107
  * The port for this API service.
99
108
  * @returns {number} The default port for this service.
@@ -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, _e;
76
76
  this._terminated = false;
77
77
  this.descriptors = {
78
78
  page: {},
@@ -82,16 +82,27 @@ 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
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
+ : undefined;
93
+ this._universeDomain =
94
+ (_c = (_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 : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
95
+ this._servicePath = 'analyticsdata.' + this._universeDomain;
96
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
86
97
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
87
98
  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');
99
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
100
+ const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
90
101
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
91
102
  // Request numeric enum values if REST transport is used.
92
103
  opts.numericEnums = true;
93
104
  // 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)) {
105
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
95
106
  opts['scopes'] = staticMembers.scopes;
96
107
  }
97
108
  // Load google-gax module synchronously if needed
@@ -109,14 +120,14 @@ class BetaAnalyticsDataClient {
109
120
  // Set useJWTAccessWithScope on the auth object.
110
121
  this.auth.useJWTAccessWithScope = true;
111
122
  // Set defaultServicePath on the auth object.
112
- this.auth.defaultServicePath = staticMembers.servicePath;
123
+ this.auth.defaultServicePath = this._servicePath;
113
124
  // Set the default scopes in auth client if needed.
114
- if (servicePath === staticMembers.servicePath) {
125
+ if (servicePath === this._servicePath) {
115
126
  this.auth.defaultScopes = staticMembers.scopes;
116
127
  }
117
128
  // Determine the client header string.
118
129
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
119
- if (typeof process !== 'undefined' && 'versions' in process) {
130
+ if (typeof process === 'object' && 'versions' in process) {
120
131
  clientHeader.push(`gl-node/${process.versions.node}`);
121
132
  }
122
133
  else {
@@ -233,19 +244,38 @@ class BetaAnalyticsDataClient {
233
244
  }
234
245
  /**
235
246
  * The DNS address for this API service.
247
+ * @deprecated Use the apiEndpoint method of the client instance.
236
248
  * @returns {string} The DNS address for this service.
237
249
  */
238
250
  static get servicePath() {
251
+ if (typeof process === 'object' &&
252
+ typeof process.emitWarning === 'function') {
253
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
254
+ }
239
255
  return 'analyticsdata.googleapis.com';
240
256
  }
241
257
  /**
242
- * The DNS address for this API service - same as servicePath(),
243
- * exists for compatibility reasons.
258
+ * The DNS address for this API service - same as servicePath.
259
+ * @deprecated Use the apiEndpoint method of the client instance.
244
260
  * @returns {string} The DNS address for this service.
245
261
  */
246
262
  static get apiEndpoint() {
263
+ if (typeof process === 'object' &&
264
+ typeof process.emitWarning === 'function') {
265
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
266
+ }
247
267
  return 'analyticsdata.googleapis.com';
248
268
  }
269
+ /**
270
+ * The DNS address for this API service.
271
+ * @returns {string} The DNS address for this service.
272
+ */
273
+ get apiEndpoint() {
274
+ return this._servicePath;
275
+ }
276
+ get universeDomain() {
277
+ return this._universeDomain;
278
+ }
249
279
  /**
250
280
  * The port for this API service.
251
281
  * @returns {number} The default port for this service.
@@ -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.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,8 +51,8 @@
51
51
  "@types/mocha": "^9.0.0",
52
52
  "@types/node": "^20.4.5",
53
53
  "@types/sinon": "^17.0.0",
54
- "c8": "^8.0.1",
55
- "gapic-tools": "^0.2.0",
54
+ "c8": "^9.0.0",
55
+ "gapic-tools": "^0.4.0",
56
56
  "gts": "^5.0.0",
57
57
  "jsdoc": "^4.0.0",
58
58
  "jsdoc-fresh": "^3.0.0",