@google-analytics/data 4.0.1 → 4.2.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.
@@ -137,14 +137,16 @@ class AlphaAnalyticsDataClient {
137
137
  // identifiers to uniquely identify resources within the API.
138
138
  // Create useful helper objects for these.
139
139
  this.pathTemplates = {
140
- audienceListPathTemplate: new this._gaxModule.PathTemplate('properties/{propertyId}/audienceLists/{audienceListId}'),
141
- 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}'),
142
+ recurringAudienceListPathTemplate: new this._gaxModule.PathTemplate('properties/{property}/recurringAudienceLists/{recurring_audience_list}'),
142
143
  };
143
144
  // Some of the methods on this service return "paged" results,
144
145
  // (e.g. 50 results at a time, with tokens to get subsequent
145
146
  // pages). Denote the keys used for pagination and results.
146
147
  this.descriptors.page = {
147
148
  listAudienceLists: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'audienceLists'),
149
+ listRecurringAudienceLists: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'recurringAudienceLists'),
148
150
  };
149
151
  const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
150
152
  // This API contains "long-running operations", which return a
@@ -204,8 +206,12 @@ class AlphaAnalyticsDataClient {
204
206
  'runFunnelReport',
205
207
  'createAudienceList',
206
208
  'queryAudienceList',
209
+ 'sheetExportAudienceList',
207
210
  'getAudienceList',
208
211
  'listAudienceLists',
212
+ 'createRecurringAudienceList',
213
+ 'getRecurringAudienceList',
214
+ 'listRecurringAudienceLists',
209
215
  ];
210
216
  for (const methodName of alphaAnalyticsDataStubMethods) {
211
217
  const callPromise = this.alphaAnalyticsDataStub.then(stub => (...args) => {
@@ -256,6 +262,9 @@ class AlphaAnalyticsDataClient {
256
262
  return [
257
263
  'https://www.googleapis.com/auth/analytics',
258
264
  'https://www.googleapis.com/auth/analytics.readonly',
265
+ 'https://www.googleapis.com/auth/drive',
266
+ 'https://www.googleapis.com/auth/drive.file',
267
+ 'https://www.googleapis.com/auth/spreadsheets',
259
268
  ];
260
269
  }
261
270
  /**
@@ -311,6 +320,27 @@ class AlphaAnalyticsDataClient {
311
320
  this.initialize();
312
321
  return this.innerApiCalls.queryAudienceList(request, options, callback);
313
322
  }
323
+ sheetExportAudienceList(request, optionsOrCallback, callback) {
324
+ var _a;
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'] =
338
+ this._gaxModule.routingHeader.fromParams({
339
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
340
+ });
341
+ this.initialize();
342
+ return this.innerApiCalls.sheetExportAudienceList(request, options, callback);
343
+ }
314
344
  getAudienceList(request, optionsOrCallback, callback) {
315
345
  var _a;
316
346
  request = request || {};
@@ -332,6 +362,48 @@ class AlphaAnalyticsDataClient {
332
362
  this.initialize();
333
363
  return this.innerApiCalls.getAudienceList(request, options, callback);
334
364
  }
365
+ createRecurringAudienceList(request, optionsOrCallback, callback) {
366
+ var _a;
367
+ request = request || {};
368
+ let options;
369
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
370
+ callback = optionsOrCallback;
371
+ options = {};
372
+ }
373
+ else {
374
+ options = optionsOrCallback;
375
+ }
376
+ options = options || {};
377
+ options.otherArgs = options.otherArgs || {};
378
+ options.otherArgs.headers = options.otherArgs.headers || {};
379
+ options.otherArgs.headers['x-goog-request-params'] =
380
+ this._gaxModule.routingHeader.fromParams({
381
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
382
+ });
383
+ this.initialize();
384
+ return this.innerApiCalls.createRecurringAudienceList(request, options, callback);
385
+ }
386
+ getRecurringAudienceList(request, optionsOrCallback, callback) {
387
+ var _a;
388
+ request = request || {};
389
+ let options;
390
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
391
+ callback = optionsOrCallback;
392
+ options = {};
393
+ }
394
+ else {
395
+ options = optionsOrCallback;
396
+ }
397
+ options = options || {};
398
+ options.otherArgs = options.otherArgs || {};
399
+ options.otherArgs.headers = options.otherArgs.headers || {};
400
+ options.otherArgs.headers['x-goog-request-params'] =
401
+ this._gaxModule.routingHeader.fromParams({
402
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
403
+ });
404
+ this.initialize();
405
+ return this.innerApiCalls.getRecurringAudienceList(request, options, callback);
406
+ }
335
407
  createAudienceList(request, optionsOrCallback, callback) {
336
408
  var _a;
337
409
  request = request || {};
@@ -397,15 +469,15 @@ class AlphaAnalyticsDataClient {
397
469
  * The request object that will be sent.
398
470
  * @param {string} request.parent
399
471
  * Required. All audience lists for this property will be listed in the
400
- * response. Format: `properties/{propertyId}`
401
- * @param {number} request.pageSize
402
- * The maximum number of audience lists to return. The service may return
403
- * fewer than this value. If unspecified, at most 200 audience lists will be
404
- * returned. The maximum value is 1000 (higher values will be coerced to the
405
- * maximum).
406
- * @param {string} request.pageToken
407
- * A page token, received from a previous `ListAudienceLists` call. Provide
408
- * this to retrieve the subsequent page.
472
+ * response. Format: `properties/{property}`
473
+ * @param {number} [request.pageSize]
474
+ * Optional. The maximum number of audience lists to return. The service may
475
+ * return fewer than this value. If unspecified, at most 200 audience lists
476
+ * will be returned. The maximum value is 1000 (higher values will be coerced
477
+ * to the maximum).
478
+ * @param {string} [request.pageToken]
479
+ * Optional. A page token, received from a previous `ListAudienceLists` call.
480
+ * Provide this to retrieve the subsequent page.
409
481
  *
410
482
  * When paginating, all other parameters provided to `ListAudienceLists` must
411
483
  * match the call that provided the page token.
@@ -443,15 +515,15 @@ class AlphaAnalyticsDataClient {
443
515
  * The request object that will be sent.
444
516
  * @param {string} request.parent
445
517
  * Required. All audience lists for this property will be listed in the
446
- * response. Format: `properties/{propertyId}`
447
- * @param {number} request.pageSize
448
- * The maximum number of audience lists to return. The service may return
449
- * fewer than this value. If unspecified, at most 200 audience lists will be
450
- * returned. The maximum value is 1000 (higher values will be coerced to the
451
- * maximum).
452
- * @param {string} request.pageToken
453
- * A page token, received from a previous `ListAudienceLists` call. Provide
454
- * this to retrieve the subsequent page.
518
+ * response. Format: `properties/{property}`
519
+ * @param {number} [request.pageSize]
520
+ * Optional. The maximum number of audience lists to return. The service may
521
+ * return fewer than this value. If unspecified, at most 200 audience lists
522
+ * will be returned. The maximum value is 1000 (higher values will be coerced
523
+ * to the maximum).
524
+ * @param {string} [request.pageToken]
525
+ * Optional. A page token, received from a previous `ListAudienceLists` call.
526
+ * Provide this to retrieve the subsequent page.
455
527
  *
456
528
  * When paginating, all other parameters provided to `ListAudienceLists` must
457
529
  * match the call that provided the page token.
@@ -482,65 +554,213 @@ class AlphaAnalyticsDataClient {
482
554
  this.initialize();
483
555
  return this.descriptors.page.listAudienceLists.asyncIterate(this.innerApiCalls['listAudienceLists'], request, callSettings);
484
556
  }
557
+ listRecurringAudienceLists(request, optionsOrCallback, callback) {
558
+ var _a;
559
+ request = request || {};
560
+ let options;
561
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
562
+ callback = optionsOrCallback;
563
+ options = {};
564
+ }
565
+ else {
566
+ options = optionsOrCallback;
567
+ }
568
+ options = options || {};
569
+ options.otherArgs = options.otherArgs || {};
570
+ options.otherArgs.headers = options.otherArgs.headers || {};
571
+ options.otherArgs.headers['x-goog-request-params'] =
572
+ this._gaxModule.routingHeader.fromParams({
573
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
574
+ });
575
+ this.initialize();
576
+ return this.innerApiCalls.listRecurringAudienceLists(request, options, callback);
577
+ }
578
+ /**
579
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
580
+ * @param {Object} request
581
+ * The request object that will be sent.
582
+ * @param {string} request.parent
583
+ * Required. All recurring audience lists for this property will be listed in
584
+ * the response. Format: `properties/{property}`
585
+ * @param {number} [request.pageSize]
586
+ * Optional. The maximum number of recurring audience lists to return. The
587
+ * service may return fewer than this value. If unspecified, at most 200
588
+ * recurring audience lists will be returned. The maximum value is 1000
589
+ * (higher values will be coerced to the maximum).
590
+ * @param {string} [request.pageToken]
591
+ * Optional. A page token, received from a previous
592
+ * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent
593
+ * page.
594
+ *
595
+ * When paginating, all other parameters provided to
596
+ * `ListRecurringAudienceLists` must match the call that provided the page
597
+ * token.
598
+ * @param {object} [options]
599
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
600
+ * @returns {Stream}
601
+ * An object stream which emits an object representing {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList} on 'data' event.
602
+ * The client library will perform auto-pagination by default: it will call the API as many
603
+ * times as needed. Note that it can affect your quota.
604
+ * We recommend using `listRecurringAudienceListsAsync()`
605
+ * method described below for async iteration which you can stop as needed.
606
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
607
+ * for more details and examples.
608
+ */
609
+ listRecurringAudienceListsStream(request, options) {
610
+ var _a;
611
+ request = request || {};
612
+ options = options || {};
613
+ options.otherArgs = options.otherArgs || {};
614
+ options.otherArgs.headers = options.otherArgs.headers || {};
615
+ options.otherArgs.headers['x-goog-request-params'] =
616
+ this._gaxModule.routingHeader.fromParams({
617
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
618
+ });
619
+ const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
620
+ const callSettings = defaultCallSettings.merge(options);
621
+ this.initialize();
622
+ return this.descriptors.page.listRecurringAudienceLists.createStream(this.innerApiCalls.listRecurringAudienceLists, request, callSettings);
623
+ }
624
+ /**
625
+ * Equivalent to `listRecurringAudienceLists`, but returns an iterable object.
626
+ *
627
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
628
+ * @param {Object} request
629
+ * The request object that will be sent.
630
+ * @param {string} request.parent
631
+ * Required. All recurring audience lists for this property will be listed in
632
+ * the response. Format: `properties/{property}`
633
+ * @param {number} [request.pageSize]
634
+ * Optional. The maximum number of recurring audience lists to return. The
635
+ * service may return fewer than this value. If unspecified, at most 200
636
+ * recurring audience lists will be returned. The maximum value is 1000
637
+ * (higher values will be coerced to the maximum).
638
+ * @param {string} [request.pageToken]
639
+ * Optional. A page token, received from a previous
640
+ * `ListRecurringAudienceLists` call. Provide this to retrieve the subsequent
641
+ * page.
642
+ *
643
+ * When paginating, all other parameters provided to
644
+ * `ListRecurringAudienceLists` must match the call that provided the page
645
+ * token.
646
+ * @param {object} [options]
647
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
648
+ * @returns {Object}
649
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
650
+ * When you iterate the returned iterable, each element will be an object representing
651
+ * {@link protos.google.analytics.data.v1alpha.RecurringAudienceList|RecurringAudienceList}. The API will be called under the hood as needed, once per the page,
652
+ * so you can stop the iteration when you don't need more results.
653
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
654
+ * for more details and examples.
655
+ * @example <caption>include:samples/generated/v1alpha/alpha_analytics_data.list_recurring_audience_lists.js</caption>
656
+ * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async
657
+ */
658
+ listRecurringAudienceListsAsync(request, options) {
659
+ var _a;
660
+ request = request || {};
661
+ options = options || {};
662
+ options.otherArgs = options.otherArgs || {};
663
+ options.otherArgs.headers = options.otherArgs.headers || {};
664
+ options.otherArgs.headers['x-goog-request-params'] =
665
+ this._gaxModule.routingHeader.fromParams({
666
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
667
+ });
668
+ const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
669
+ const callSettings = defaultCallSettings.merge(options);
670
+ this.initialize();
671
+ return this.descriptors.page.listRecurringAudienceLists.asyncIterate(this.innerApiCalls['listRecurringAudienceLists'], request, callSettings);
672
+ }
485
673
  // --------------------
486
674
  // -- Path templates --
487
675
  // --------------------
488
676
  /**
489
677
  * Return a fully-qualified audienceList resource name string.
490
678
  *
491
- * @param {string} propertyId
492
- * @param {string} audienceListId
679
+ * @param {string} property
680
+ * @param {string} audience_list
493
681
  * @returns {string} Resource name string.
494
682
  */
495
- audienceListPath(propertyId, audienceListId) {
683
+ audienceListPath(property, audienceList) {
496
684
  return this.pathTemplates.audienceListPathTemplate.render({
497
- propertyId: propertyId,
498
- audienceListId: audienceListId,
685
+ property: property,
686
+ audience_list: audienceList,
499
687
  });
500
688
  }
501
689
  /**
502
- * Parse the propertyId from AudienceList resource.
690
+ * Parse the property from AudienceList resource.
503
691
  *
504
692
  * @param {string} audienceListName
505
693
  * A fully-qualified path representing AudienceList resource.
506
- * @returns {string} A string representing the propertyId.
694
+ * @returns {string} A string representing the property.
507
695
  */
508
- matchPropertyIdFromAudienceListName(audienceListName) {
696
+ matchPropertyFromAudienceListName(audienceListName) {
509
697
  return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
510
- .propertyId;
698
+ .property;
511
699
  }
512
700
  /**
513
- * Parse the audienceListId from AudienceList resource.
701
+ * Parse the audience_list from AudienceList resource.
514
702
  *
515
703
  * @param {string} audienceListName
516
704
  * A fully-qualified path representing AudienceList resource.
517
- * @returns {string} A string representing the audienceListId.
705
+ * @returns {string} A string representing the audience_list.
518
706
  */
519
- matchAudienceListIdFromAudienceListName(audienceListName) {
707
+ matchAudienceListFromAudienceListName(audienceListName) {
520
708
  return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
521
- .audienceListId;
709
+ .audience_list;
522
710
  }
523
711
  /**
524
712
  * Return a fully-qualified property resource name string.
525
713
  *
526
- * @param {string} propertyId
714
+ * @param {string} property
527
715
  * @returns {string} Resource name string.
528
716
  */
529
- propertyPath(propertyId) {
717
+ propertyPath(property) {
530
718
  return this.pathTemplates.propertyPathTemplate.render({
531
- propertyId: propertyId,
719
+ property: property,
532
720
  });
533
721
  }
534
722
  /**
535
- * Parse the propertyId from Property resource.
723
+ * Parse the property from Property resource.
536
724
  *
537
725
  * @param {string} propertyName
538
726
  * A fully-qualified path representing Property resource.
539
- * @returns {string} A string representing the propertyId.
727
+ * @returns {string} A string representing the property.
728
+ */
729
+ matchPropertyFromPropertyName(propertyName) {
730
+ return this.pathTemplates.propertyPathTemplate.match(propertyName).property;
731
+ }
732
+ /**
733
+ * Return a fully-qualified recurringAudienceList resource name string.
734
+ *
735
+ * @param {string} property
736
+ * @param {string} recurring_audience_list
737
+ * @returns {string} Resource name string.
738
+ */
739
+ recurringAudienceListPath(property, recurringAudienceList) {
740
+ return this.pathTemplates.recurringAudienceListPathTemplate.render({
741
+ property: property,
742
+ recurring_audience_list: recurringAudienceList,
743
+ });
744
+ }
745
+ /**
746
+ * Parse the property from RecurringAudienceList resource.
747
+ *
748
+ * @param {string} recurringAudienceListName
749
+ * A fully-qualified path representing RecurringAudienceList resource.
750
+ * @returns {string} A string representing the property.
751
+ */
752
+ matchPropertyFromRecurringAudienceListName(recurringAudienceListName) {
753
+ return this.pathTemplates.recurringAudienceListPathTemplate.match(recurringAudienceListName).property;
754
+ }
755
+ /**
756
+ * Parse the recurring_audience_list from RecurringAudienceList resource.
757
+ *
758
+ * @param {string} recurringAudienceListName
759
+ * A fully-qualified path representing RecurringAudienceList resource.
760
+ * @returns {string} A string representing the recurring_audience_list.
540
761
  */
541
- matchPropertyIdFromPropertyName(propertyName) {
542
- return this.pathTemplates.propertyPathTemplate.match(propertyName)
543
- .propertyId;
762
+ matchRecurringAudienceListFromRecurringAudienceListName(recurringAudienceListName) {
763
+ return this.pathTemplates.recurringAudienceListPathTemplate.match(recurringAudienceListName).recurring_audience_list;
544
764
  }
545
765
  /**
546
766
  * 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",
@@ -56,6 +61,21 @@
56
61
  "timeout_millis": 60000,
57
62
  "retry_codes_name": "unknown",
58
63
  "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
64
+ },
65
+ "CreateRecurringAudienceList": {
66
+ "timeout_millis": 60000,
67
+ "retry_codes_name": "unknown",
68
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
69
+ },
70
+ "GetRecurringAudienceList": {
71
+ "timeout_millis": 60000,
72
+ "retry_codes_name": "unknown",
73
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
74
+ },
75
+ "ListRecurringAudienceLists": {
76
+ "timeout_millis": 60000,
77
+ "retry_codes_name": "unknown",
78
+ "retry_params_name": "01d6d956b4dadd7e38ee9dec12ed8720e6e6f90c"
59
79
  }
60
80
  }
61
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-analytics/data",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "docs-test": "linkinator docs",
38
38
  "fix": "gts fix",
39
39
  "lint": "gts check",
40
- "prepare": "npm run compile-protos && npm run compile",
40
+ "prepare": "npm run compile",
41
41
  "prelint": "cd samples; npm link ../; npm i",
42
42
  "postpack": "minifyProtoJson",
43
43
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
@@ -50,9 +50,9 @@
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
58
  "jsdoc-fresh": "^3.0.0",
@@ -60,8 +60,8 @@
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": {