@google-analytics/data 4.12.1 → 5.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.
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.AlphaAnalyticsDataClient = void 0;
21
21
  const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
22
23
  /**
23
24
  * Client JSON configuration object, loaded from
24
25
  * `src/v1alpha/alpha_analytics_data_client_config.json`.
@@ -32,6 +33,28 @@ const version = require('../../../package.json').version;
32
33
  * @memberof v1alpha
33
34
  */
34
35
  class AlphaAnalyticsDataClient {
36
+ _terminated = false;
37
+ _opts;
38
+ _providedCustomServicePath;
39
+ _gaxModule;
40
+ _gaxGrpc;
41
+ _protos;
42
+ _defaults;
43
+ _universeDomain;
44
+ _servicePath;
45
+ _log = google_gax_1.loggingUtils.log('data');
46
+ auth;
47
+ descriptors = {
48
+ page: {},
49
+ stream: {},
50
+ longrunning: {},
51
+ batching: {},
52
+ };
53
+ warn;
54
+ innerApiCalls;
55
+ pathTemplates;
56
+ operationsClient;
57
+ alphaAnalyticsDataStub;
35
58
  /**
36
59
  * Construct an instance of AlphaAnalyticsDataClient.
37
60
  *
@@ -54,7 +77,7 @@ class AlphaAnalyticsDataClient {
54
77
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
55
78
  * the environment variable GCLOUD_PROJECT for your project ID. If your
56
79
  * app is running in an environment which supports
57
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
58
81
  * your project ID will be detected automatically.
59
82
  * @param {string} [options.apiEndpoint] - The domain name of the
60
83
  * API remote host.
@@ -72,32 +95,28 @@ class AlphaAnalyticsDataClient {
72
95
  * ```
73
96
  */
74
97
  constructor(opts, gaxInstance) {
75
- var _a, _b, _c, _d, _e;
76
- this._terminated = false;
77
- this.descriptors = {
78
- page: {},
79
- stream: {},
80
- longrunning: {},
81
- batching: {},
82
- };
83
98
  // Ensure that options include all the required fields.
84
99
  const staticMembers = this.constructor;
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)) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
88
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
104
  }
90
105
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
106
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
107
  : undefined;
93
108
  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';
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
95
113
  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;
97
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
98
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
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');
114
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
+ const port = opts?.port || staticMembers.port;
117
+ const clientConfig = opts?.clientConfig ?? {};
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
101
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
102
121
  // Request numeric enum values if REST transport is used.
103
122
  opts.numericEnums = true;
@@ -320,7 +339,6 @@ class AlphaAnalyticsDataClient {
320
339
  return this.auth.getProjectId();
321
340
  }
322
341
  runFunnelReport(request, optionsOrCallback, callback) {
323
- var _a;
324
342
  request = request || {};
325
343
  let options;
326
344
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -335,13 +353,26 @@ class AlphaAnalyticsDataClient {
335
353
  options.otherArgs.headers = options.otherArgs.headers || {};
336
354
  options.otherArgs.headers['x-goog-request-params'] =
337
355
  this._gaxModule.routingHeader.fromParams({
338
- property: (_a = request.property) !== null && _a !== void 0 ? _a : '',
356
+ property: request.property ?? '',
339
357
  });
340
- this.initialize();
341
- return this.innerApiCalls.runFunnelReport(request, options, callback);
358
+ this.initialize().catch(err => {
359
+ throw err;
360
+ });
361
+ this._log.info('runFunnelReport request %j', request);
362
+ const wrappedCallback = callback
363
+ ? (error, response, options, rawResponse) => {
364
+ this._log.info('runFunnelReport response %j', response);
365
+ callback(error, response, options, rawResponse); // We verified callback above.
366
+ }
367
+ : undefined;
368
+ return this.innerApiCalls
369
+ .runFunnelReport(request, options, wrappedCallback)
370
+ ?.then(([response, options, rawResponse]) => {
371
+ this._log.info('runFunnelReport response %j', response);
372
+ return [response, options, rawResponse];
373
+ });
342
374
  }
343
375
  queryAudienceList(request, optionsOrCallback, callback) {
344
- var _a;
345
376
  request = request || {};
346
377
  let options;
347
378
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -356,13 +387,26 @@ class AlphaAnalyticsDataClient {
356
387
  options.otherArgs.headers = options.otherArgs.headers || {};
357
388
  options.otherArgs.headers['x-goog-request-params'] =
358
389
  this._gaxModule.routingHeader.fromParams({
359
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
390
+ name: request.name ?? '',
360
391
  });
361
- this.initialize();
362
- return this.innerApiCalls.queryAudienceList(request, options, callback);
392
+ this.initialize().catch(err => {
393
+ throw err;
394
+ });
395
+ this._log.info('queryAudienceList request %j', request);
396
+ const wrappedCallback = callback
397
+ ? (error, response, options, rawResponse) => {
398
+ this._log.info('queryAudienceList response %j', response);
399
+ callback(error, response, options, rawResponse); // We verified callback above.
400
+ }
401
+ : undefined;
402
+ return this.innerApiCalls
403
+ .queryAudienceList(request, options, wrappedCallback)
404
+ ?.then(([response, options, rawResponse]) => {
405
+ this._log.info('queryAudienceList response %j', response);
406
+ return [response, options, rawResponse];
407
+ });
363
408
  }
364
409
  sheetExportAudienceList(request, optionsOrCallback, callback) {
365
- var _a;
366
410
  request = request || {};
367
411
  let options;
368
412
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -377,13 +421,26 @@ class AlphaAnalyticsDataClient {
377
421
  options.otherArgs.headers = options.otherArgs.headers || {};
378
422
  options.otherArgs.headers['x-goog-request-params'] =
379
423
  this._gaxModule.routingHeader.fromParams({
380
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
424
+ name: request.name ?? '',
381
425
  });
382
- this.initialize();
383
- return this.innerApiCalls.sheetExportAudienceList(request, options, callback);
426
+ this.initialize().catch(err => {
427
+ throw err;
428
+ });
429
+ this._log.info('sheetExportAudienceList request %j', request);
430
+ const wrappedCallback = callback
431
+ ? (error, response, options, rawResponse) => {
432
+ this._log.info('sheetExportAudienceList response %j', response);
433
+ callback(error, response, options, rawResponse); // We verified callback above.
434
+ }
435
+ : undefined;
436
+ return this.innerApiCalls
437
+ .sheetExportAudienceList(request, options, wrappedCallback)
438
+ ?.then(([response, options, rawResponse]) => {
439
+ this._log.info('sheetExportAudienceList response %j', response);
440
+ return [response, options, rawResponse];
441
+ });
384
442
  }
385
443
  getAudienceList(request, optionsOrCallback, callback) {
386
- var _a;
387
444
  request = request || {};
388
445
  let options;
389
446
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -398,13 +455,26 @@ class AlphaAnalyticsDataClient {
398
455
  options.otherArgs.headers = options.otherArgs.headers || {};
399
456
  options.otherArgs.headers['x-goog-request-params'] =
400
457
  this._gaxModule.routingHeader.fromParams({
401
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
458
+ name: request.name ?? '',
402
459
  });
403
- this.initialize();
404
- return this.innerApiCalls.getAudienceList(request, options, callback);
460
+ this.initialize().catch(err => {
461
+ throw err;
462
+ });
463
+ this._log.info('getAudienceList request %j', request);
464
+ const wrappedCallback = callback
465
+ ? (error, response, options, rawResponse) => {
466
+ this._log.info('getAudienceList response %j', response);
467
+ callback(error, response, options, rawResponse); // We verified callback above.
468
+ }
469
+ : undefined;
470
+ return this.innerApiCalls
471
+ .getAudienceList(request, options, wrappedCallback)
472
+ ?.then(([response, options, rawResponse]) => {
473
+ this._log.info('getAudienceList response %j', response);
474
+ return [response, options, rawResponse];
475
+ });
405
476
  }
406
477
  createRecurringAudienceList(request, optionsOrCallback, callback) {
407
- var _a;
408
478
  request = request || {};
409
479
  let options;
410
480
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -419,13 +489,26 @@ class AlphaAnalyticsDataClient {
419
489
  options.otherArgs.headers = options.otherArgs.headers || {};
420
490
  options.otherArgs.headers['x-goog-request-params'] =
421
491
  this._gaxModule.routingHeader.fromParams({
422
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
492
+ parent: request.parent ?? '',
423
493
  });
424
- this.initialize();
425
- return this.innerApiCalls.createRecurringAudienceList(request, options, callback);
494
+ this.initialize().catch(err => {
495
+ throw err;
496
+ });
497
+ this._log.info('createRecurringAudienceList request %j', request);
498
+ const wrappedCallback = callback
499
+ ? (error, response, options, rawResponse) => {
500
+ this._log.info('createRecurringAudienceList response %j', response);
501
+ callback(error, response, options, rawResponse); // We verified callback above.
502
+ }
503
+ : undefined;
504
+ return this.innerApiCalls
505
+ .createRecurringAudienceList(request, options, wrappedCallback)
506
+ ?.then(([response, options, rawResponse]) => {
507
+ this._log.info('createRecurringAudienceList response %j', response);
508
+ return [response, options, rawResponse];
509
+ });
426
510
  }
427
511
  getRecurringAudienceList(request, optionsOrCallback, callback) {
428
- var _a;
429
512
  request = request || {};
430
513
  let options;
431
514
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -440,13 +523,26 @@ class AlphaAnalyticsDataClient {
440
523
  options.otherArgs.headers = options.otherArgs.headers || {};
441
524
  options.otherArgs.headers['x-goog-request-params'] =
442
525
  this._gaxModule.routingHeader.fromParams({
443
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
526
+ name: request.name ?? '',
444
527
  });
445
- this.initialize();
446
- return this.innerApiCalls.getRecurringAudienceList(request, options, callback);
528
+ this.initialize().catch(err => {
529
+ throw err;
530
+ });
531
+ this._log.info('getRecurringAudienceList request %j', request);
532
+ const wrappedCallback = callback
533
+ ? (error, response, options, rawResponse) => {
534
+ this._log.info('getRecurringAudienceList response %j', response);
535
+ callback(error, response, options, rawResponse); // We verified callback above.
536
+ }
537
+ : undefined;
538
+ return this.innerApiCalls
539
+ .getRecurringAudienceList(request, options, wrappedCallback)
540
+ ?.then(([response, options, rawResponse]) => {
541
+ this._log.info('getRecurringAudienceList response %j', response);
542
+ return [response, options, rawResponse];
543
+ });
447
544
  }
448
545
  getPropertyQuotasSnapshot(request, optionsOrCallback, callback) {
449
- var _a;
450
546
  request = request || {};
451
547
  let options;
452
548
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -461,13 +557,26 @@ class AlphaAnalyticsDataClient {
461
557
  options.otherArgs.headers = options.otherArgs.headers || {};
462
558
  options.otherArgs.headers['x-goog-request-params'] =
463
559
  this._gaxModule.routingHeader.fromParams({
464
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
560
+ name: request.name ?? '',
465
561
  });
466
- this.initialize();
467
- return this.innerApiCalls.getPropertyQuotasSnapshot(request, options, callback);
562
+ this.initialize().catch(err => {
563
+ throw err;
564
+ });
565
+ this._log.info('getPropertyQuotasSnapshot request %j', request);
566
+ const wrappedCallback = callback
567
+ ? (error, response, options, rawResponse) => {
568
+ this._log.info('getPropertyQuotasSnapshot response %j', response);
569
+ callback(error, response, options, rawResponse); // We verified callback above.
570
+ }
571
+ : undefined;
572
+ return this.innerApiCalls
573
+ .getPropertyQuotasSnapshot(request, options, wrappedCallback)
574
+ ?.then(([response, options, rawResponse]) => {
575
+ this._log.info('getPropertyQuotasSnapshot response %j', response);
576
+ return [response, options, rawResponse];
577
+ });
468
578
  }
469
579
  queryReportTask(request, optionsOrCallback, callback) {
470
- var _a;
471
580
  request = request || {};
472
581
  let options;
473
582
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -482,13 +591,26 @@ class AlphaAnalyticsDataClient {
482
591
  options.otherArgs.headers = options.otherArgs.headers || {};
483
592
  options.otherArgs.headers['x-goog-request-params'] =
484
593
  this._gaxModule.routingHeader.fromParams({
485
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
594
+ name: request.name ?? '',
486
595
  });
487
- this.initialize();
488
- return this.innerApiCalls.queryReportTask(request, options, callback);
596
+ this.initialize().catch(err => {
597
+ throw err;
598
+ });
599
+ this._log.info('queryReportTask request %j', request);
600
+ const wrappedCallback = callback
601
+ ? (error, response, options, rawResponse) => {
602
+ this._log.info('queryReportTask response %j', response);
603
+ callback(error, response, options, rawResponse); // We verified callback above.
604
+ }
605
+ : undefined;
606
+ return this.innerApiCalls
607
+ .queryReportTask(request, options, wrappedCallback)
608
+ ?.then(([response, options, rawResponse]) => {
609
+ this._log.info('queryReportTask response %j', response);
610
+ return [response, options, rawResponse];
611
+ });
489
612
  }
490
613
  getReportTask(request, optionsOrCallback, callback) {
491
- var _a;
492
614
  request = request || {};
493
615
  let options;
494
616
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -503,13 +625,26 @@ class AlphaAnalyticsDataClient {
503
625
  options.otherArgs.headers = options.otherArgs.headers || {};
504
626
  options.otherArgs.headers['x-goog-request-params'] =
505
627
  this._gaxModule.routingHeader.fromParams({
506
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
628
+ name: request.name ?? '',
507
629
  });
508
- this.initialize();
509
- return this.innerApiCalls.getReportTask(request, options, callback);
630
+ this.initialize().catch(err => {
631
+ throw err;
632
+ });
633
+ this._log.info('getReportTask request %j', request);
634
+ const wrappedCallback = callback
635
+ ? (error, response, options, rawResponse) => {
636
+ this._log.info('getReportTask response %j', response);
637
+ callback(error, response, options, rawResponse); // We verified callback above.
638
+ }
639
+ : undefined;
640
+ return this.innerApiCalls
641
+ .getReportTask(request, options, wrappedCallback)
642
+ ?.then(([response, options, rawResponse]) => {
643
+ this._log.info('getReportTask response %j', response);
644
+ return [response, options, rawResponse];
645
+ });
510
646
  }
511
647
  createAudienceList(request, optionsOrCallback, callback) {
512
- var _a;
513
648
  request = request || {};
514
649
  let options;
515
650
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -524,10 +659,24 @@ class AlphaAnalyticsDataClient {
524
659
  options.otherArgs.headers = options.otherArgs.headers || {};
525
660
  options.otherArgs.headers['x-goog-request-params'] =
526
661
  this._gaxModule.routingHeader.fromParams({
527
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
662
+ parent: request.parent ?? '',
528
663
  });
529
- this.initialize();
530
- return this.innerApiCalls.createAudienceList(request, options, callback);
664
+ this.initialize().catch(err => {
665
+ throw err;
666
+ });
667
+ const wrappedCallback = callback
668
+ ? (error, response, rawResponse, _) => {
669
+ this._log.info('createAudienceList response %j', rawResponse);
670
+ callback(error, response, rawResponse, _); // We verified callback above.
671
+ }
672
+ : undefined;
673
+ this._log.info('createAudienceList request %j', request);
674
+ return this.innerApiCalls
675
+ .createAudienceList(request, options, wrappedCallback)
676
+ ?.then(([response, rawResponse, _]) => {
677
+ this._log.info('createAudienceList response %j', rawResponse);
678
+ return [response, rawResponse, _];
679
+ });
531
680
  }
532
681
  /**
533
682
  * Check the status of the long running operation returned by `createAudienceList()`.
@@ -541,13 +690,13 @@ class AlphaAnalyticsDataClient {
541
690
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateAudienceList_async
542
691
  */
543
692
  async checkCreateAudienceListProgress(name) {
693
+ this._log.info('createAudienceList long-running');
544
694
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
545
695
  const [operation] = await this.operationsClient.getOperation(request);
546
696
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAudienceList, this._gaxModule.createDefaultBackoffSettings());
547
697
  return decodeOperation;
548
698
  }
549
699
  createReportTask(request, optionsOrCallback, callback) {
550
- var _a;
551
700
  request = request || {};
552
701
  let options;
553
702
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -562,10 +711,24 @@ class AlphaAnalyticsDataClient {
562
711
  options.otherArgs.headers = options.otherArgs.headers || {};
563
712
  options.otherArgs.headers['x-goog-request-params'] =
564
713
  this._gaxModule.routingHeader.fromParams({
565
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
714
+ parent: request.parent ?? '',
566
715
  });
567
- this.initialize();
568
- return this.innerApiCalls.createReportTask(request, options, callback);
716
+ this.initialize().catch(err => {
717
+ throw err;
718
+ });
719
+ const wrappedCallback = callback
720
+ ? (error, response, rawResponse, _) => {
721
+ this._log.info('createReportTask response %j', rawResponse);
722
+ callback(error, response, rawResponse, _); // We verified callback above.
723
+ }
724
+ : undefined;
725
+ this._log.info('createReportTask request %j', request);
726
+ return this.innerApiCalls
727
+ .createReportTask(request, options, wrappedCallback)
728
+ ?.then(([response, rawResponse, _]) => {
729
+ this._log.info('createReportTask response %j', rawResponse);
730
+ return [response, rawResponse, _];
731
+ });
569
732
  }
570
733
  /**
571
734
  * Check the status of the long running operation returned by `createReportTask()`.
@@ -579,13 +742,13 @@ class AlphaAnalyticsDataClient {
579
742
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_CreateReportTask_async
580
743
  */
581
744
  async checkCreateReportTaskProgress(name) {
745
+ this._log.info('createReportTask long-running');
582
746
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
583
747
  const [operation] = await this.operationsClient.getOperation(request);
584
748
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createReportTask, this._gaxModule.createDefaultBackoffSettings());
585
749
  return decodeOperation;
586
750
  }
587
751
  listAudienceLists(request, optionsOrCallback, callback) {
588
- var _a;
589
752
  request = request || {};
590
753
  let options;
591
754
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -600,10 +763,24 @@ class AlphaAnalyticsDataClient {
600
763
  options.otherArgs.headers = options.otherArgs.headers || {};
601
764
  options.otherArgs.headers['x-goog-request-params'] =
602
765
  this._gaxModule.routingHeader.fromParams({
603
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
766
+ parent: request.parent ?? '',
604
767
  });
605
- this.initialize();
606
- return this.innerApiCalls.listAudienceLists(request, options, callback);
768
+ this.initialize().catch(err => {
769
+ throw err;
770
+ });
771
+ const wrappedCallback = callback
772
+ ? (error, values, nextPageRequest, rawResponse) => {
773
+ this._log.info('listAudienceLists values %j', values);
774
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
775
+ }
776
+ : undefined;
777
+ this._log.info('listAudienceLists request %j', request);
778
+ return this.innerApiCalls
779
+ .listAudienceLists(request, options, wrappedCallback)
780
+ ?.then(([response, input, output]) => {
781
+ this._log.info('listAudienceLists values %j', response);
782
+ return [response, input, output];
783
+ });
607
784
  }
608
785
  /**
609
786
  * Equivalent to `listAudienceLists`, but returns a NodeJS Stream object.
@@ -635,18 +812,20 @@ class AlphaAnalyticsDataClient {
635
812
  * for more details and examples.
636
813
  */
637
814
  listAudienceListsStream(request, options) {
638
- var _a;
639
815
  request = request || {};
640
816
  options = options || {};
641
817
  options.otherArgs = options.otherArgs || {};
642
818
  options.otherArgs.headers = options.otherArgs.headers || {};
643
819
  options.otherArgs.headers['x-goog-request-params'] =
644
820
  this._gaxModule.routingHeader.fromParams({
645
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
821
+ parent: request.parent ?? '',
646
822
  });
647
823
  const defaultCallSettings = this._defaults['listAudienceLists'];
648
824
  const callSettings = defaultCallSettings.merge(options);
649
- this.initialize();
825
+ this.initialize().catch(err => {
826
+ throw err;
827
+ });
828
+ this._log.info('listAudienceLists stream %j', request);
650
829
  return this.descriptors.page.listAudienceLists.createStream(this.innerApiCalls.listAudienceLists, request, callSettings);
651
830
  }
652
831
  /**
@@ -682,22 +861,23 @@ class AlphaAnalyticsDataClient {
682
861
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListAudienceLists_async
683
862
  */
684
863
  listAudienceListsAsync(request, options) {
685
- var _a;
686
864
  request = request || {};
687
865
  options = options || {};
688
866
  options.otherArgs = options.otherArgs || {};
689
867
  options.otherArgs.headers = options.otherArgs.headers || {};
690
868
  options.otherArgs.headers['x-goog-request-params'] =
691
869
  this._gaxModule.routingHeader.fromParams({
692
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
870
+ parent: request.parent ?? '',
693
871
  });
694
872
  const defaultCallSettings = this._defaults['listAudienceLists'];
695
873
  const callSettings = defaultCallSettings.merge(options);
696
- this.initialize();
874
+ this.initialize().catch(err => {
875
+ throw err;
876
+ });
877
+ this._log.info('listAudienceLists iterate %j', request);
697
878
  return this.descriptors.page.listAudienceLists.asyncIterate(this.innerApiCalls['listAudienceLists'], request, callSettings);
698
879
  }
699
880
  listRecurringAudienceLists(request, optionsOrCallback, callback) {
700
- var _a;
701
881
  request = request || {};
702
882
  let options;
703
883
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -712,10 +892,24 @@ class AlphaAnalyticsDataClient {
712
892
  options.otherArgs.headers = options.otherArgs.headers || {};
713
893
  options.otherArgs.headers['x-goog-request-params'] =
714
894
  this._gaxModule.routingHeader.fromParams({
715
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
895
+ parent: request.parent ?? '',
716
896
  });
717
- this.initialize();
718
- return this.innerApiCalls.listRecurringAudienceLists(request, options, callback);
897
+ this.initialize().catch(err => {
898
+ throw err;
899
+ });
900
+ const wrappedCallback = callback
901
+ ? (error, values, nextPageRequest, rawResponse) => {
902
+ this._log.info('listRecurringAudienceLists values %j', values);
903
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
904
+ }
905
+ : undefined;
906
+ this._log.info('listRecurringAudienceLists request %j', request);
907
+ return this.innerApiCalls
908
+ .listRecurringAudienceLists(request, options, wrappedCallback)
909
+ ?.then(([response, input, output]) => {
910
+ this._log.info('listRecurringAudienceLists values %j', response);
911
+ return [response, input, output];
912
+ });
719
913
  }
720
914
  /**
721
915
  * Equivalent to `listRecurringAudienceLists`, but returns a NodeJS Stream object.
@@ -749,18 +943,20 @@ class AlphaAnalyticsDataClient {
749
943
  * for more details and examples.
750
944
  */
751
945
  listRecurringAudienceListsStream(request, options) {
752
- var _a;
753
946
  request = request || {};
754
947
  options = options || {};
755
948
  options.otherArgs = options.otherArgs || {};
756
949
  options.otherArgs.headers = options.otherArgs.headers || {};
757
950
  options.otherArgs.headers['x-goog-request-params'] =
758
951
  this._gaxModule.routingHeader.fromParams({
759
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
952
+ parent: request.parent ?? '',
760
953
  });
761
954
  const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
762
955
  const callSettings = defaultCallSettings.merge(options);
763
- this.initialize();
956
+ this.initialize().catch(err => {
957
+ throw err;
958
+ });
959
+ this._log.info('listRecurringAudienceLists stream %j', request);
764
960
  return this.descriptors.page.listRecurringAudienceLists.createStream(this.innerApiCalls.listRecurringAudienceLists, request, callSettings);
765
961
  }
766
962
  /**
@@ -798,22 +994,23 @@ class AlphaAnalyticsDataClient {
798
994
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListRecurringAudienceLists_async
799
995
  */
800
996
  listRecurringAudienceListsAsync(request, options) {
801
- var _a;
802
997
  request = request || {};
803
998
  options = options || {};
804
999
  options.otherArgs = options.otherArgs || {};
805
1000
  options.otherArgs.headers = options.otherArgs.headers || {};
806
1001
  options.otherArgs.headers['x-goog-request-params'] =
807
1002
  this._gaxModule.routingHeader.fromParams({
808
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1003
+ parent: request.parent ?? '',
809
1004
  });
810
1005
  const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
811
1006
  const callSettings = defaultCallSettings.merge(options);
812
- this.initialize();
1007
+ this.initialize().catch(err => {
1008
+ throw err;
1009
+ });
1010
+ this._log.info('listRecurringAudienceLists iterate %j', request);
813
1011
  return this.descriptors.page.listRecurringAudienceLists.asyncIterate(this.innerApiCalls['listRecurringAudienceLists'], request, callSettings);
814
1012
  }
815
1013
  listReportTasks(request, optionsOrCallback, callback) {
816
- var _a;
817
1014
  request = request || {};
818
1015
  let options;
819
1016
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -828,10 +1025,24 @@ class AlphaAnalyticsDataClient {
828
1025
  options.otherArgs.headers = options.otherArgs.headers || {};
829
1026
  options.otherArgs.headers['x-goog-request-params'] =
830
1027
  this._gaxModule.routingHeader.fromParams({
831
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1028
+ parent: request.parent ?? '',
832
1029
  });
833
- this.initialize();
834
- return this.innerApiCalls.listReportTasks(request, options, callback);
1030
+ this.initialize().catch(err => {
1031
+ throw err;
1032
+ });
1033
+ const wrappedCallback = callback
1034
+ ? (error, values, nextPageRequest, rawResponse) => {
1035
+ this._log.info('listReportTasks values %j', values);
1036
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1037
+ }
1038
+ : undefined;
1039
+ this._log.info('listReportTasks request %j', request);
1040
+ return this.innerApiCalls
1041
+ .listReportTasks(request, options, wrappedCallback)
1042
+ ?.then(([response, input, output]) => {
1043
+ this._log.info('listReportTasks values %j', response);
1044
+ return [response, input, output];
1045
+ });
835
1046
  }
836
1047
  /**
837
1048
  * Equivalent to `listReportTasks`, but returns a NodeJS Stream object.
@@ -857,18 +1068,20 @@ class AlphaAnalyticsDataClient {
857
1068
  * for more details and examples.
858
1069
  */
859
1070
  listReportTasksStream(request, options) {
860
- var _a;
861
1071
  request = request || {};
862
1072
  options = options || {};
863
1073
  options.otherArgs = options.otherArgs || {};
864
1074
  options.otherArgs.headers = options.otherArgs.headers || {};
865
1075
  options.otherArgs.headers['x-goog-request-params'] =
866
1076
  this._gaxModule.routingHeader.fromParams({
867
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1077
+ parent: request.parent ?? '',
868
1078
  });
869
1079
  const defaultCallSettings = this._defaults['listReportTasks'];
870
1080
  const callSettings = defaultCallSettings.merge(options);
871
- this.initialize();
1081
+ this.initialize().catch(err => {
1082
+ throw err;
1083
+ });
1084
+ this._log.info('listReportTasks stream %j', request);
872
1085
  return this.descriptors.page.listReportTasks.createStream(this.innerApiCalls.listReportTasks, request, callSettings);
873
1086
  }
874
1087
  /**
@@ -898,18 +1111,20 @@ class AlphaAnalyticsDataClient {
898
1111
  * region_tag:analyticsdata_v1alpha_generated_AlphaAnalyticsData_ListReportTasks_async
899
1112
  */
900
1113
  listReportTasksAsync(request, options) {
901
- var _a;
902
1114
  request = request || {};
903
1115
  options = options || {};
904
1116
  options.otherArgs = options.otherArgs || {};
905
1117
  options.otherArgs.headers = options.otherArgs.headers || {};
906
1118
  options.otherArgs.headers['x-goog-request-params'] =
907
1119
  this._gaxModule.routingHeader.fromParams({
908
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1120
+ parent: request.parent ?? '',
909
1121
  });
910
1122
  const defaultCallSettings = this._defaults['listReportTasks'];
911
1123
  const callSettings = defaultCallSettings.merge(options);
912
- this.initialize();
1124
+ this.initialize().catch(err => {
1125
+ throw err;
1126
+ });
1127
+ this._log.info('listReportTasks iterate %j', request);
913
1128
  return this.descriptors.page.listReportTasks.asyncIterate(this.innerApiCalls['listReportTasks'], request, callSettings);
914
1129
  }
915
1130
  /**
@@ -943,7 +1158,6 @@ class AlphaAnalyticsDataClient {
943
1158
  * ```
944
1159
  */
945
1160
  getOperation(request, optionsOrCallback, callback) {
946
- var _a;
947
1161
  let options;
948
1162
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
949
1163
  callback = optionsOrCallback;
@@ -957,7 +1171,7 @@ class AlphaAnalyticsDataClient {
957
1171
  options.otherArgs.headers = options.otherArgs.headers || {};
958
1172
  options.otherArgs.headers['x-goog-request-params'] =
959
1173
  this._gaxModule.routingHeader.fromParams({
960
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1174
+ name: request.name ?? '',
961
1175
  });
962
1176
  return this.operationsClient.getOperation(request, options, callback);
963
1177
  }
@@ -992,13 +1206,12 @@ class AlphaAnalyticsDataClient {
992
1206
  * ```
993
1207
  */
994
1208
  listOperationsAsync(request, options) {
995
- var _a;
996
1209
  options = options || {};
997
1210
  options.otherArgs = options.otherArgs || {};
998
1211
  options.otherArgs.headers = options.otherArgs.headers || {};
999
1212
  options.otherArgs.headers['x-goog-request-params'] =
1000
1213
  this._gaxModule.routingHeader.fromParams({
1001
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1214
+ name: request.name ?? '',
1002
1215
  });
1003
1216
  return this.operationsClient.listOperationsAsync(request, options);
1004
1217
  }
@@ -1034,7 +1247,6 @@ class AlphaAnalyticsDataClient {
1034
1247
  * ```
1035
1248
  */
1036
1249
  cancelOperation(request, optionsOrCallback, callback) {
1037
- var _a;
1038
1250
  let options;
1039
1251
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
1040
1252
  callback = optionsOrCallback;
@@ -1048,7 +1260,7 @@ class AlphaAnalyticsDataClient {
1048
1260
  options.otherArgs.headers = options.otherArgs.headers || {};
1049
1261
  options.otherArgs.headers['x-goog-request-params'] =
1050
1262
  this._gaxModule.routingHeader.fromParams({
1051
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1263
+ name: request.name ?? '',
1052
1264
  });
1053
1265
  return this.operationsClient.cancelOperation(request, options, callback);
1054
1266
  }
@@ -1078,7 +1290,6 @@ class AlphaAnalyticsDataClient {
1078
1290
  * ```
1079
1291
  */
1080
1292
  deleteOperation(request, optionsOrCallback, callback) {
1081
- var _a;
1082
1293
  let options;
1083
1294
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
1084
1295
  callback = optionsOrCallback;
@@ -1092,7 +1303,7 @@ class AlphaAnalyticsDataClient {
1092
1303
  options.otherArgs.headers = options.otherArgs.headers || {};
1093
1304
  options.otherArgs.headers['x-goog-request-params'] =
1094
1305
  this._gaxModule.routingHeader.fromParams({
1095
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1306
+ name: request.name ?? '',
1096
1307
  });
1097
1308
  return this.operationsClient.deleteOperation(request, options, callback);
1098
1309
  }
@@ -1253,6 +1464,7 @@ class AlphaAnalyticsDataClient {
1253
1464
  close() {
1254
1465
  if (this.alphaAnalyticsDataStub && !this._terminated) {
1255
1466
  return this.alphaAnalyticsDataStub.then(stub => {
1467
+ this._log.info('ending gRPC channel');
1256
1468
  this._terminated = true;
1257
1469
  stub.close();
1258
1470
  this.operationsClient.close();