@google-analytics/data 4.0.0 → 4.1.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.
@@ -60,8 +60,7 @@ class AlphaAnalyticsDataClient {
60
60
  * API remote host.
61
61
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
62
62
  * Follows the structure of {@link gapicConfig}.
63
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
64
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
63
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
65
64
  * For more information, please check the
66
65
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
66
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -69,7 +68,7 @@ class AlphaAnalyticsDataClient {
69
68
  * HTTP implementation. Load only fallback version and pass it to the constructor:
70
69
  * ```
71
70
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
- * const client = new AlphaAnalyticsDataClient({fallback: 'rest'}, gax);
71
+ * const client = new AlphaAnalyticsDataClient({fallback: true}, gax);
73
72
  * ```
74
73
  */
75
74
  constructor(opts, gaxInstance) {
@@ -126,7 +125,7 @@ class AlphaAnalyticsDataClient {
126
125
  if (!opts.fallback) {
127
126
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
128
127
  }
129
- else if (opts.fallback === 'rest') {
128
+ else {
130
129
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
131
130
  }
132
131
  if (opts.libName && opts.libVersion) {
@@ -138,8 +137,8 @@ class AlphaAnalyticsDataClient {
138
137
  // identifiers to uniquely identify resources within the API.
139
138
  // Create useful helper objects for these.
140
139
  this.pathTemplates = {
141
- audienceListPathTemplate: new this._gaxModule.PathTemplate('properties/{propertyId}/audienceLists/{audienceListId}'),
142
- propertyPathTemplate: new this._gaxModule.PathTemplate('properties/{propertyId}'),
140
+ audienceListPathTemplate: new this._gaxModule.PathTemplate('properties/{property}/audienceLists/{audience_list}'),
141
+ propertyPathTemplate: new this._gaxModule.PathTemplate('properties/{property}'),
143
142
  };
144
143
  // Some of the methods on this service return "paged" results,
145
144
  // (e.g. 50 results at a time, with tokens to get subsequent
@@ -155,7 +154,7 @@ class AlphaAnalyticsDataClient {
155
154
  auth: this.auth,
156
155
  grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
157
156
  };
158
- if (opts.fallback === 'rest') {
157
+ if (opts.fallback) {
159
158
  lroOptions.protoJson = protoFilesRoot;
160
159
  lroOptions.httpRules = [];
161
160
  }
@@ -205,6 +204,7 @@ class AlphaAnalyticsDataClient {
205
204
  'runFunnelReport',
206
205
  'createAudienceList',
207
206
  'queryAudienceList',
207
+ 'sheetExportAudienceList',
208
208
  'getAudienceList',
209
209
  'listAudienceLists',
210
210
  ];
@@ -257,6 +257,9 @@ class AlphaAnalyticsDataClient {
257
257
  return [
258
258
  'https://www.googleapis.com/auth/analytics',
259
259
  'https://www.googleapis.com/auth/analytics.readonly',
260
+ 'https://www.googleapis.com/auth/drive',
261
+ 'https://www.googleapis.com/auth/drive.file',
262
+ 'https://www.googleapis.com/auth/spreadsheets',
260
263
  ];
261
264
  }
262
265
  /**
@@ -312,6 +315,27 @@ class AlphaAnalyticsDataClient {
312
315
  this.initialize();
313
316
  return this.innerApiCalls.queryAudienceList(request, options, callback);
314
317
  }
318
+ sheetExportAudienceList(request, optionsOrCallback, callback) {
319
+ var _a;
320
+ request = request || {};
321
+ let options;
322
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
323
+ callback = optionsOrCallback;
324
+ options = {};
325
+ }
326
+ else {
327
+ options = optionsOrCallback;
328
+ }
329
+ options = options || {};
330
+ options.otherArgs = options.otherArgs || {};
331
+ options.otherArgs.headers = options.otherArgs.headers || {};
332
+ options.otherArgs.headers['x-goog-request-params'] =
333
+ this._gaxModule.routingHeader.fromParams({
334
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
335
+ });
336
+ this.initialize();
337
+ return this.innerApiCalls.sheetExportAudienceList(request, options, callback);
338
+ }
315
339
  getAudienceList(request, optionsOrCallback, callback) {
316
340
  var _a;
317
341
  request = request || {};
@@ -398,15 +422,15 @@ class AlphaAnalyticsDataClient {
398
422
  * The request object that will be sent.
399
423
  * @param {string} request.parent
400
424
  * Required. All audience lists for this property will be listed in the
401
- * response. Format: `properties/{propertyId}`
402
- * @param {number} request.pageSize
403
- * The maximum number of audience lists to return. The service may return
404
- * fewer than this value. If unspecified, at most 200 audience lists will be
405
- * returned. The maximum value is 1000 (higher values will be coerced to the
406
- * maximum).
407
- * @param {string} request.pageToken
408
- * A page token, received from a previous `ListAudienceLists` call. Provide
409
- * this to retrieve the subsequent page.
425
+ * response. Format: `properties/{property}`
426
+ * @param {number} [request.pageSize]
427
+ * Optional. The maximum number of audience lists to return. The service may
428
+ * return fewer than this value. If unspecified, at most 200 audience lists
429
+ * will be returned. The maximum value is 1000 (higher values will be coerced
430
+ * to the maximum).
431
+ * @param {string} [request.pageToken]
432
+ * Optional. A page token, received from a previous `ListAudienceLists` call.
433
+ * Provide this to retrieve the subsequent page.
410
434
  *
411
435
  * When paginating, all other parameters provided to `ListAudienceLists` must
412
436
  * match the call that provided the page token.
@@ -444,15 +468,15 @@ class AlphaAnalyticsDataClient {
444
468
  * The request object that will be sent.
445
469
  * @param {string} request.parent
446
470
  * Required. All audience lists for this property will be listed in the
447
- * response. Format: `properties/{propertyId}`
448
- * @param {number} request.pageSize
449
- * The maximum number of audience lists to return. The service may return
450
- * fewer than this value. If unspecified, at most 200 audience lists will be
451
- * returned. The maximum value is 1000 (higher values will be coerced to the
452
- * maximum).
453
- * @param {string} request.pageToken
454
- * A page token, received from a previous `ListAudienceLists` call. Provide
455
- * this to retrieve the subsequent page.
471
+ * response. Format: `properties/{property}`
472
+ * @param {number} [request.pageSize]
473
+ * Optional. The maximum number of audience lists to return. The service may
474
+ * return fewer than this value. If unspecified, at most 200 audience lists
475
+ * will be returned. The maximum value is 1000 (higher values will be coerced
476
+ * to the maximum).
477
+ * @param {string} [request.pageToken]
478
+ * Optional. A page token, received from a previous `ListAudienceLists` call.
479
+ * Provide this to retrieve the subsequent page.
456
480
  *
457
481
  * When paginating, all other parameters provided to `ListAudienceLists` must
458
482
  * match the call that provided the page token.
@@ -489,59 +513,58 @@ class AlphaAnalyticsDataClient {
489
513
  /**
490
514
  * Return a fully-qualified audienceList resource name string.
491
515
  *
492
- * @param {string} propertyId
493
- * @param {string} audienceListId
516
+ * @param {string} property
517
+ * @param {string} audience_list
494
518
  * @returns {string} Resource name string.
495
519
  */
496
- audienceListPath(propertyId, audienceListId) {
520
+ audienceListPath(property, audienceList) {
497
521
  return this.pathTemplates.audienceListPathTemplate.render({
498
- propertyId: propertyId,
499
- audienceListId: audienceListId,
522
+ property: property,
523
+ audience_list: audienceList,
500
524
  });
501
525
  }
502
526
  /**
503
- * Parse the propertyId from AudienceList resource.
527
+ * Parse the property from AudienceList resource.
504
528
  *
505
529
  * @param {string} audienceListName
506
530
  * A fully-qualified path representing AudienceList resource.
507
- * @returns {string} A string representing the propertyId.
531
+ * @returns {string} A string representing the property.
508
532
  */
509
- matchPropertyIdFromAudienceListName(audienceListName) {
533
+ matchPropertyFromAudienceListName(audienceListName) {
510
534
  return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
511
- .propertyId;
535
+ .property;
512
536
  }
513
537
  /**
514
- * Parse the audienceListId from AudienceList resource.
538
+ * Parse the audience_list from AudienceList resource.
515
539
  *
516
540
  * @param {string} audienceListName
517
541
  * A fully-qualified path representing AudienceList resource.
518
- * @returns {string} A string representing the audienceListId.
542
+ * @returns {string} A string representing the audience_list.
519
543
  */
520
- matchAudienceListIdFromAudienceListName(audienceListName) {
544
+ matchAudienceListFromAudienceListName(audienceListName) {
521
545
  return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
522
- .audienceListId;
546
+ .audience_list;
523
547
  }
524
548
  /**
525
549
  * Return a fully-qualified property resource name string.
526
550
  *
527
- * @param {string} propertyId
551
+ * @param {string} property
528
552
  * @returns {string} Resource name string.
529
553
  */
530
- propertyPath(propertyId) {
554
+ propertyPath(property) {
531
555
  return this.pathTemplates.propertyPathTemplate.render({
532
- propertyId: propertyId,
556
+ property: property,
533
557
  });
534
558
  }
535
559
  /**
536
- * Parse the propertyId from Property resource.
560
+ * Parse the property from Property resource.
537
561
  *
538
562
  * @param {string} propertyName
539
563
  * A fully-qualified path representing Property resource.
540
- * @returns {string} A string representing the propertyId.
564
+ * @returns {string} A string representing the property.
541
565
  */
542
- matchPropertyIdFromPropertyName(propertyName) {
543
- return this.pathTemplates.propertyPathTemplate.match(propertyName)
544
- .propertyId;
566
+ matchPropertyFromPropertyName(propertyName) {
567
+ return this.pathTemplates.propertyPathTemplate.match(propertyName).property;
545
568
  }
546
569
  /**
547
570
  * Terminate the gRPC channel and close the client.
@@ -47,6 +47,11 @@
47
47
  "retry_codes_name": "unknown",
48
48
  "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
49
49
  },
50
+ "SheetExportAudienceList": {
51
+ "timeout_millis": 60000,
52
+ "retry_codes_name": "unknown",
53
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
54
+ },
50
55
  "GetAudienceList": {
51
56
  "timeout_millis": 60000,
52
57
  "retry_codes_name": "unknown",
@@ -54,8 +54,7 @@ export declare class BetaAnalyticsDataClient {
54
54
  * API remote host.
55
55
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
56
56
  * Follows the structure of {@link gapicConfig}.
57
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
58
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
57
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
59
58
  * For more information, please check the
60
59
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
61
60
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -63,7 +62,7 @@ export declare class BetaAnalyticsDataClient {
63
62
  * HTTP implementation. Load only fallback version and pass it to the constructor:
64
63
  * ```
65
64
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
66
- * const client = new BetaAnalyticsDataClient({fallback: 'rest'}, gax);
65
+ * const client = new BetaAnalyticsDataClient({fallback: true}, gax);
67
66
  * ```
68
67
  */
69
68
  constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
@@ -60,8 +60,7 @@ class BetaAnalyticsDataClient {
60
60
  * API remote host.
61
61
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
62
62
  * Follows the structure of {@link gapicConfig}.
63
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
64
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
63
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
65
64
  * For more information, please check the
66
65
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
66
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -69,7 +68,7 @@ class BetaAnalyticsDataClient {
69
68
  * HTTP implementation. Load only fallback version and pass it to the constructor:
70
69
  * ```
71
70
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
- * const client = new BetaAnalyticsDataClient({fallback: 'rest'}, gax);
71
+ * const client = new BetaAnalyticsDataClient({fallback: true}, gax);
73
72
  * ```
74
73
  */
75
74
  constructor(opts, gaxInstance) {
@@ -126,7 +125,7 @@ class BetaAnalyticsDataClient {
126
125
  if (!opts.fallback) {
127
126
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
128
127
  }
129
- else if (opts.fallback === 'rest') {
128
+ else {
130
129
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
131
130
  }
132
131
  if (opts.libName && opts.libVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-analytics/data",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,18 +50,18 @@
50
50
  "devDependencies": {
51
51
  "@types/mocha": "^9.0.0",
52
52
  "@types/node": "^20.4.5",
53
- "@types/sinon": "^10.0.0",
53
+ "@types/sinon": "^17.0.0",
54
54
  "c8": "^8.0.1",
55
- "gapic-tools": "^0.1.8",
55
+ "gapic-tools": "^0.2.0",
56
56
  "gts": "^5.0.0",
57
57
  "jsdoc": "^4.0.0",
58
- "jsdoc-fresh": "^2.0.0",
59
- "jsdoc-region-tag": "^2.0.0",
58
+ "jsdoc-fresh": "^3.0.0",
59
+ "jsdoc-region-tag": "^3.0.0",
60
60
  "linkinator": "4.1.2",
61
61
  "long": "^5.2.3",
62
62
  "mocha": "^9.2.2",
63
- "pack-n-play": "^1.0.0-2",
64
- "sinon": "^15.0.0",
63
+ "pack-n-play": "^2.0.0",
64
+ "sinon": "^17.0.0",
65
65
  "typescript": "^5.1.6"
66
66
  },
67
67
  "engines": {