@google-analytics/data 6.1.0 → 7.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.
@@ -97,17 +97,26 @@ class AlphaAnalyticsDataClient {
97
97
  constructor(opts, gaxInstance) {
98
98
  // Ensure that options include all the required fields.
99
99
  const staticMembers = this.constructor;
100
- if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
101
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
104
  }
103
- const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
104
- this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
105
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
+ : undefined;
108
+ this._universeDomain =
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
105
113
  this._servicePath = 'analyticsdata.' + this._universeDomain;
106
114
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
107
115
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
108
116
  const port = opts?.port || staticMembers.port;
109
117
  const clientConfig = opts?.clientConfig ?? {};
110
- const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
111
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
112
121
  // Request numeric enum values if REST transport is used.
113
122
  opts.numericEnums = true;
@@ -136,10 +145,7 @@ class AlphaAnalyticsDataClient {
136
145
  this.auth.defaultScopes = staticMembers.scopes;
137
146
  }
138
147
  // Determine the client header string.
139
- const clientHeader = [
140
- `gax/${this._gaxModule.version}`,
141
- `gapic/${version}`,
142
- ];
148
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
143
149
  if (typeof process === 'object' && 'versions' in process) {
144
150
  clientHeader.push(`gl-node/${process.versions.node}`);
145
151
  }
@@ -174,7 +180,7 @@ class AlphaAnalyticsDataClient {
174
180
  this.descriptors.page = {
175
181
  listAudienceLists: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'audienceLists'),
176
182
  listRecurringAudienceLists: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'recurringAudienceLists'),
177
- listReportTasks: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reportTasks')
183
+ listReportTasks: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reportTasks'),
178
184
  };
179
185
  const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
180
186
  // This API contains "long-running operations", which return a
@@ -182,20 +188,22 @@ class AlphaAnalyticsDataClient {
182
188
  // rather than holding a request open.
183
189
  const lroOptions = {
184
190
  auth: this.auth,
185
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
191
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
186
192
  };
187
193
  if (opts.fallback) {
188
194
  lroOptions.protoJson = protoFilesRoot;
189
195
  lroOptions.httpRules = [];
190
196
  }
191
- this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
197
+ this.operationsClient = this._gaxModule
198
+ .lro(lroOptions)
199
+ .operationsClient(opts);
192
200
  const createAudienceListResponse = protoFilesRoot.lookup('.google.analytics.data.v1alpha.AudienceList');
193
201
  const createAudienceListMetadata = protoFilesRoot.lookup('.google.analytics.data.v1alpha.AudienceListMetadata');
194
202
  const createReportTaskResponse = protoFilesRoot.lookup('.google.analytics.data.v1alpha.ReportTask');
195
203
  const createReportTaskMetadata = protoFilesRoot.lookup('.google.analytics.data.v1alpha.ReportTaskMetadata');
196
204
  this.descriptors.longrunning = {
197
205
  createAudienceList: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createAudienceListResponse.decode.bind(createAudienceListResponse), createAudienceListMetadata.decode.bind(createAudienceListMetadata)),
198
- createReportTask: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createReportTaskResponse.decode.bind(createReportTaskResponse), createReportTaskMetadata.decode.bind(createReportTaskMetadata))
206
+ createReportTask: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createReportTaskResponse.decode.bind(createReportTaskResponse), createReportTaskMetadata.decode.bind(createReportTaskMetadata)),
199
207
  };
200
208
  // Put together the default options sent with requests.
201
209
  this._defaults = this._gaxGrpc.constructSettings('google.analytics.data.v1alpha.AlphaAnalyticsData', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -224,13 +232,30 @@ class AlphaAnalyticsDataClient {
224
232
  }
225
233
  // Put together the "service stub" for
226
234
  // google.analytics.data.v1alpha.AlphaAnalyticsData.
227
- this.alphaAnalyticsDataStub = this._gaxGrpc.createStub(this._opts.fallback ?
228
- this._protos.lookupService('google.analytics.data.v1alpha.AlphaAnalyticsData') :
229
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
230
- this._protos.google.analytics.data.v1alpha.AlphaAnalyticsData, this._opts, this._providedCustomServicePath);
235
+ this.alphaAnalyticsDataStub = this._gaxGrpc.createStub(this._opts.fallback
236
+ ? this._protos.lookupService('google.analytics.data.v1alpha.AlphaAnalyticsData')
237
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
238
+ this._protos.google.analytics.data.v1alpha
239
+ .AlphaAnalyticsData, this._opts, this._providedCustomServicePath);
231
240
  // Iterate over each of the methods that the service provides
232
241
  // and create an API call method for each.
233
- const alphaAnalyticsDataStubMethods = ['runFunnelReport', 'createAudienceList', 'queryAudienceList', 'getAudienceList', 'listAudienceLists', 'createRecurringAudienceList', 'getRecurringAudienceList', 'listRecurringAudienceLists', 'getPropertyQuotasSnapshot', 'createReportTask', 'queryReportTask', 'getReportTask', 'listReportTasks', 'runReport', 'getMetadata'];
242
+ const alphaAnalyticsDataStubMethods = [
243
+ 'runFunnelReport',
244
+ 'createAudienceList',
245
+ 'queryAudienceList',
246
+ 'getAudienceList',
247
+ 'listAudienceLists',
248
+ 'createRecurringAudienceList',
249
+ 'getRecurringAudienceList',
250
+ 'listRecurringAudienceLists',
251
+ 'getPropertyQuotasSnapshot',
252
+ 'createReportTask',
253
+ 'queryReportTask',
254
+ 'getReportTask',
255
+ 'listReportTasks',
256
+ 'runReport',
257
+ 'getMetadata',
258
+ ];
234
259
  for (const methodName of alphaAnalyticsDataStubMethods) {
235
260
  const callPromise = this.alphaAnalyticsDataStub.then(stub => (...args) => {
236
261
  if (this._terminated) {
@@ -255,7 +280,8 @@ class AlphaAnalyticsDataClient {
255
280
  * @returns {string} The DNS address for this service.
256
281
  */
257
282
  static get servicePath() {
258
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
283
+ if (typeof process === 'object' &&
284
+ typeof process.emitWarning === 'function') {
259
285
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
260
286
  }
261
287
  return 'analyticsdata.googleapis.com';
@@ -266,7 +292,8 @@ class AlphaAnalyticsDataClient {
266
292
  * @returns {string} The DNS address for this service.
267
293
  */
268
294
  static get apiEndpoint() {
269
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
295
+ if (typeof process === 'object' &&
296
+ typeof process.emitWarning === 'function') {
270
297
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
271
298
  }
272
299
  return 'analyticsdata.googleapis.com';
@@ -296,7 +323,7 @@ class AlphaAnalyticsDataClient {
296
323
  static get scopes() {
297
324
  return [
298
325
  'https://www.googleapis.com/auth/analytics',
299
- 'https://www.googleapis.com/auth/analytics.readonly'
326
+ 'https://www.googleapis.com/auth/analytics.readonly',
300
327
  ];
301
328
  }
302
329
  /**
@@ -323,10 +350,13 @@ class AlphaAnalyticsDataClient {
323
350
  options = options || {};
324
351
  options.otherArgs = options.otherArgs || {};
325
352
  options.otherArgs.headers = options.otherArgs.headers || {};
326
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
327
- 'property': request.property ?? '',
353
+ options.otherArgs.headers['x-goog-request-params'] =
354
+ this._gaxModule.routingHeader.fromParams({
355
+ property: request.property ?? '',
356
+ });
357
+ this.initialize().catch(err => {
358
+ throw err;
328
359
  });
329
- this.initialize().catch(err => { throw err; });
330
360
  this._log.info('runFunnelReport request %j', request);
331
361
  const wrappedCallback = callback
332
362
  ? (error, response, options, rawResponse) => {
@@ -334,12 +364,16 @@ class AlphaAnalyticsDataClient {
334
364
  callback(error, response, options, rawResponse); // We verified callback above.
335
365
  }
336
366
  : undefined;
337
- return this.innerApiCalls.runFunnelReport(request, options, wrappedCallback)
367
+ return this.innerApiCalls
368
+ .runFunnelReport(request, options, wrappedCallback)
338
369
  ?.then(([response, options, rawResponse]) => {
339
370
  this._log.info('runFunnelReport response %j', response);
340
371
  return [response, options, rawResponse];
341
- }).catch((error) => {
342
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
372
+ })
373
+ .catch((error) => {
374
+ if (error &&
375
+ 'statusDetails' in error &&
376
+ error.statusDetails instanceof Array) {
343
377
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
344
378
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
345
379
  }
@@ -359,10 +393,13 @@ class AlphaAnalyticsDataClient {
359
393
  options = options || {};
360
394
  options.otherArgs = options.otherArgs || {};
361
395
  options.otherArgs.headers = options.otherArgs.headers || {};
362
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
363
- 'name': request.name ?? '',
396
+ options.otherArgs.headers['x-goog-request-params'] =
397
+ this._gaxModule.routingHeader.fromParams({
398
+ name: request.name ?? '',
399
+ });
400
+ this.initialize().catch(err => {
401
+ throw err;
364
402
  });
365
- this.initialize().catch(err => { throw err; });
366
403
  this._log.info('queryAudienceList request %j', request);
367
404
  const wrappedCallback = callback
368
405
  ? (error, response, options, rawResponse) => {
@@ -370,12 +407,16 @@ class AlphaAnalyticsDataClient {
370
407
  callback(error, response, options, rawResponse); // We verified callback above.
371
408
  }
372
409
  : undefined;
373
- return this.innerApiCalls.queryAudienceList(request, options, wrappedCallback)
410
+ return this.innerApiCalls
411
+ .queryAudienceList(request, options, wrappedCallback)
374
412
  ?.then(([response, options, rawResponse]) => {
375
413
  this._log.info('queryAudienceList response %j', response);
376
414
  return [response, options, rawResponse];
377
- }).catch((error) => {
378
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
415
+ })
416
+ .catch((error) => {
417
+ if (error &&
418
+ 'statusDetails' in error &&
419
+ error.statusDetails instanceof Array) {
379
420
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
380
421
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
381
422
  }
@@ -395,10 +436,13 @@ class AlphaAnalyticsDataClient {
395
436
  options = options || {};
396
437
  options.otherArgs = options.otherArgs || {};
397
438
  options.otherArgs.headers = options.otherArgs.headers || {};
398
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
399
- 'name': request.name ?? '',
439
+ options.otherArgs.headers['x-goog-request-params'] =
440
+ this._gaxModule.routingHeader.fromParams({
441
+ name: request.name ?? '',
442
+ });
443
+ this.initialize().catch(err => {
444
+ throw err;
400
445
  });
401
- this.initialize().catch(err => { throw err; });
402
446
  this._log.info('getAudienceList request %j', request);
403
447
  const wrappedCallback = callback
404
448
  ? (error, response, options, rawResponse) => {
@@ -406,12 +450,16 @@ class AlphaAnalyticsDataClient {
406
450
  callback(error, response, options, rawResponse); // We verified callback above.
407
451
  }
408
452
  : undefined;
409
- return this.innerApiCalls.getAudienceList(request, options, wrappedCallback)
453
+ return this.innerApiCalls
454
+ .getAudienceList(request, options, wrappedCallback)
410
455
  ?.then(([response, options, rawResponse]) => {
411
456
  this._log.info('getAudienceList response %j', response);
412
457
  return [response, options, rawResponse];
413
- }).catch((error) => {
414
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
458
+ })
459
+ .catch((error) => {
460
+ if (error &&
461
+ 'statusDetails' in error &&
462
+ error.statusDetails instanceof Array) {
415
463
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
416
464
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
417
465
  }
@@ -431,10 +479,13 @@ class AlphaAnalyticsDataClient {
431
479
  options = options || {};
432
480
  options.otherArgs = options.otherArgs || {};
433
481
  options.otherArgs.headers = options.otherArgs.headers || {};
434
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
435
- 'parent': request.parent ?? '',
482
+ options.otherArgs.headers['x-goog-request-params'] =
483
+ this._gaxModule.routingHeader.fromParams({
484
+ parent: request.parent ?? '',
485
+ });
486
+ this.initialize().catch(err => {
487
+ throw err;
436
488
  });
437
- this.initialize().catch(err => { throw err; });
438
489
  this._log.info('createRecurringAudienceList request %j', request);
439
490
  const wrappedCallback = callback
440
491
  ? (error, response, options, rawResponse) => {
@@ -442,12 +493,16 @@ class AlphaAnalyticsDataClient {
442
493
  callback(error, response, options, rawResponse); // We verified callback above.
443
494
  }
444
495
  : undefined;
445
- return this.innerApiCalls.createRecurringAudienceList(request, options, wrappedCallback)
496
+ return this.innerApiCalls
497
+ .createRecurringAudienceList(request, options, wrappedCallback)
446
498
  ?.then(([response, options, rawResponse]) => {
447
499
  this._log.info('createRecurringAudienceList response %j', response);
448
500
  return [response, options, rawResponse];
449
- }).catch((error) => {
450
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
501
+ })
502
+ .catch((error) => {
503
+ if (error &&
504
+ 'statusDetails' in error &&
505
+ error.statusDetails instanceof Array) {
451
506
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
452
507
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
453
508
  }
@@ -467,10 +522,13 @@ class AlphaAnalyticsDataClient {
467
522
  options = options || {};
468
523
  options.otherArgs = options.otherArgs || {};
469
524
  options.otherArgs.headers = options.otherArgs.headers || {};
470
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
471
- 'name': request.name ?? '',
525
+ options.otherArgs.headers['x-goog-request-params'] =
526
+ this._gaxModule.routingHeader.fromParams({
527
+ name: request.name ?? '',
528
+ });
529
+ this.initialize().catch(err => {
530
+ throw err;
472
531
  });
473
- this.initialize().catch(err => { throw err; });
474
532
  this._log.info('getRecurringAudienceList request %j', request);
475
533
  const wrappedCallback = callback
476
534
  ? (error, response, options, rawResponse) => {
@@ -478,12 +536,16 @@ class AlphaAnalyticsDataClient {
478
536
  callback(error, response, options, rawResponse); // We verified callback above.
479
537
  }
480
538
  : undefined;
481
- return this.innerApiCalls.getRecurringAudienceList(request, options, wrappedCallback)
539
+ return this.innerApiCalls
540
+ .getRecurringAudienceList(request, options, wrappedCallback)
482
541
  ?.then(([response, options, rawResponse]) => {
483
542
  this._log.info('getRecurringAudienceList response %j', response);
484
543
  return [response, options, rawResponse];
485
- }).catch((error) => {
486
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
544
+ })
545
+ .catch((error) => {
546
+ if (error &&
547
+ 'statusDetails' in error &&
548
+ error.statusDetails instanceof Array) {
487
549
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
488
550
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
489
551
  }
@@ -503,10 +565,13 @@ class AlphaAnalyticsDataClient {
503
565
  options = options || {};
504
566
  options.otherArgs = options.otherArgs || {};
505
567
  options.otherArgs.headers = options.otherArgs.headers || {};
506
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
507
- 'name': request.name ?? '',
568
+ options.otherArgs.headers['x-goog-request-params'] =
569
+ this._gaxModule.routingHeader.fromParams({
570
+ name: request.name ?? '',
571
+ });
572
+ this.initialize().catch(err => {
573
+ throw err;
508
574
  });
509
- this.initialize().catch(err => { throw err; });
510
575
  this._log.info('getPropertyQuotasSnapshot request %j', request);
511
576
  const wrappedCallback = callback
512
577
  ? (error, response, options, rawResponse) => {
@@ -514,12 +579,16 @@ class AlphaAnalyticsDataClient {
514
579
  callback(error, response, options, rawResponse); // We verified callback above.
515
580
  }
516
581
  : undefined;
517
- return this.innerApiCalls.getPropertyQuotasSnapshot(request, options, wrappedCallback)
582
+ return this.innerApiCalls
583
+ .getPropertyQuotasSnapshot(request, options, wrappedCallback)
518
584
  ?.then(([response, options, rawResponse]) => {
519
585
  this._log.info('getPropertyQuotasSnapshot response %j', response);
520
586
  return [response, options, rawResponse];
521
- }).catch((error) => {
522
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
587
+ })
588
+ .catch((error) => {
589
+ if (error &&
590
+ 'statusDetails' in error &&
591
+ error.statusDetails instanceof Array) {
523
592
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
524
593
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
525
594
  }
@@ -539,10 +608,13 @@ class AlphaAnalyticsDataClient {
539
608
  options = options || {};
540
609
  options.otherArgs = options.otherArgs || {};
541
610
  options.otherArgs.headers = options.otherArgs.headers || {};
542
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
543
- 'name': request.name ?? '',
611
+ options.otherArgs.headers['x-goog-request-params'] =
612
+ this._gaxModule.routingHeader.fromParams({
613
+ name: request.name ?? '',
614
+ });
615
+ this.initialize().catch(err => {
616
+ throw err;
544
617
  });
545
- this.initialize().catch(err => { throw err; });
546
618
  this._log.info('queryReportTask request %j', request);
547
619
  const wrappedCallback = callback
548
620
  ? (error, response, options, rawResponse) => {
@@ -550,12 +622,16 @@ class AlphaAnalyticsDataClient {
550
622
  callback(error, response, options, rawResponse); // We verified callback above.
551
623
  }
552
624
  : undefined;
553
- return this.innerApiCalls.queryReportTask(request, options, wrappedCallback)
625
+ return this.innerApiCalls
626
+ .queryReportTask(request, options, wrappedCallback)
554
627
  ?.then(([response, options, rawResponse]) => {
555
628
  this._log.info('queryReportTask response %j', response);
556
629
  return [response, options, rawResponse];
557
- }).catch((error) => {
558
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
630
+ })
631
+ .catch((error) => {
632
+ if (error &&
633
+ 'statusDetails' in error &&
634
+ error.statusDetails instanceof Array) {
559
635
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
560
636
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
561
637
  }
@@ -575,10 +651,13 @@ class AlphaAnalyticsDataClient {
575
651
  options = options || {};
576
652
  options.otherArgs = options.otherArgs || {};
577
653
  options.otherArgs.headers = options.otherArgs.headers || {};
578
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
579
- 'name': request.name ?? '',
654
+ options.otherArgs.headers['x-goog-request-params'] =
655
+ this._gaxModule.routingHeader.fromParams({
656
+ name: request.name ?? '',
657
+ });
658
+ this.initialize().catch(err => {
659
+ throw err;
580
660
  });
581
- this.initialize().catch(err => { throw err; });
582
661
  this._log.info('getReportTask request %j', request);
583
662
  const wrappedCallback = callback
584
663
  ? (error, response, options, rawResponse) => {
@@ -586,12 +665,16 @@ class AlphaAnalyticsDataClient {
586
665
  callback(error, response, options, rawResponse); // We verified callback above.
587
666
  }
588
667
  : undefined;
589
- return this.innerApiCalls.getReportTask(request, options, wrappedCallback)
668
+ return this.innerApiCalls
669
+ .getReportTask(request, options, wrappedCallback)
590
670
  ?.then(([response, options, rawResponse]) => {
591
671
  this._log.info('getReportTask response %j', response);
592
672
  return [response, options, rawResponse];
593
- }).catch((error) => {
594
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
673
+ })
674
+ .catch((error) => {
675
+ if (error &&
676
+ 'statusDetails' in error &&
677
+ error.statusDetails instanceof Array) {
595
678
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
596
679
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
597
680
  }
@@ -611,10 +694,13 @@ class AlphaAnalyticsDataClient {
611
694
  options = options || {};
612
695
  options.otherArgs = options.otherArgs || {};
613
696
  options.otherArgs.headers = options.otherArgs.headers || {};
614
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
615
- 'property': request.property ?? '',
697
+ options.otherArgs.headers['x-goog-request-params'] =
698
+ this._gaxModule.routingHeader.fromParams({
699
+ property: request.property ?? '',
700
+ });
701
+ this.initialize().catch(err => {
702
+ throw err;
616
703
  });
617
- this.initialize().catch(err => { throw err; });
618
704
  this._log.info('runReport request %j', request);
619
705
  const wrappedCallback = callback
620
706
  ? (error, response, options, rawResponse) => {
@@ -622,12 +708,16 @@ class AlphaAnalyticsDataClient {
622
708
  callback(error, response, options, rawResponse); // We verified callback above.
623
709
  }
624
710
  : undefined;
625
- return this.innerApiCalls.runReport(request, options, wrappedCallback)
711
+ return this.innerApiCalls
712
+ .runReport(request, options, wrappedCallback)
626
713
  ?.then(([response, options, rawResponse]) => {
627
714
  this._log.info('runReport response %j', response);
628
715
  return [response, options, rawResponse];
629
- }).catch((error) => {
630
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
716
+ })
717
+ .catch((error) => {
718
+ if (error &&
719
+ 'statusDetails' in error &&
720
+ error.statusDetails instanceof Array) {
631
721
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
632
722
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
633
723
  }
@@ -647,10 +737,13 @@ class AlphaAnalyticsDataClient {
647
737
  options = options || {};
648
738
  options.otherArgs = options.otherArgs || {};
649
739
  options.otherArgs.headers = options.otherArgs.headers || {};
650
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
651
- 'name': request.name ?? '',
740
+ options.otherArgs.headers['x-goog-request-params'] =
741
+ this._gaxModule.routingHeader.fromParams({
742
+ name: request.name ?? '',
743
+ });
744
+ this.initialize().catch(err => {
745
+ throw err;
652
746
  });
653
- this.initialize().catch(err => { throw err; });
654
747
  this._log.info('getMetadata request %j', request);
655
748
  const wrappedCallback = callback
656
749
  ? (error, response, options, rawResponse) => {
@@ -658,12 +751,16 @@ class AlphaAnalyticsDataClient {
658
751
  callback(error, response, options, rawResponse); // We verified callback above.
659
752
  }
660
753
  : undefined;
661
- return this.innerApiCalls.getMetadata(request, options, wrappedCallback)
754
+ return this.innerApiCalls
755
+ .getMetadata(request, options, wrappedCallback)
662
756
  ?.then(([response, options, rawResponse]) => {
663
757
  this._log.info('getMetadata response %j', response);
664
758
  return [response, options, rawResponse];
665
- }).catch((error) => {
666
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
759
+ })
760
+ .catch((error) => {
761
+ if (error &&
762
+ 'statusDetails' in error &&
763
+ error.statusDetails instanceof Array) {
667
764
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
668
765
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
669
766
  }
@@ -683,10 +780,13 @@ class AlphaAnalyticsDataClient {
683
780
  options = options || {};
684
781
  options.otherArgs = options.otherArgs || {};
685
782
  options.otherArgs.headers = options.otherArgs.headers || {};
686
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
687
- 'parent': request.parent ?? '',
783
+ options.otherArgs.headers['x-goog-request-params'] =
784
+ this._gaxModule.routingHeader.fromParams({
785
+ parent: request.parent ?? '',
786
+ });
787
+ this.initialize().catch(err => {
788
+ throw err;
688
789
  });
689
- this.initialize().catch(err => { throw err; });
690
790
  const wrappedCallback = callback
691
791
  ? (error, response, rawResponse, _) => {
692
792
  this._log.info('createAudienceList response %j', rawResponse);
@@ -694,7 +794,8 @@ class AlphaAnalyticsDataClient {
694
794
  }
695
795
  : undefined;
696
796
  this._log.info('createAudienceList request %j', request);
697
- return this.innerApiCalls.createAudienceList(request, options, wrappedCallback)
797
+ return this.innerApiCalls
798
+ .createAudienceList(request, options, wrappedCallback)
698
799
  ?.then(([response, rawResponse, _]) => {
699
800
  this._log.info('createAudienceList response %j', rawResponse);
700
801
  return [response, rawResponse, _];
@@ -731,10 +832,13 @@ class AlphaAnalyticsDataClient {
731
832
  options = options || {};
732
833
  options.otherArgs = options.otherArgs || {};
733
834
  options.otherArgs.headers = options.otherArgs.headers || {};
734
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
735
- 'parent': request.parent ?? '',
835
+ options.otherArgs.headers['x-goog-request-params'] =
836
+ this._gaxModule.routingHeader.fromParams({
837
+ parent: request.parent ?? '',
838
+ });
839
+ this.initialize().catch(err => {
840
+ throw err;
736
841
  });
737
- this.initialize().catch(err => { throw err; });
738
842
  const wrappedCallback = callback
739
843
  ? (error, response, rawResponse, _) => {
740
844
  this._log.info('createReportTask response %j', rawResponse);
@@ -742,7 +846,8 @@ class AlphaAnalyticsDataClient {
742
846
  }
743
847
  : undefined;
744
848
  this._log.info('createReportTask request %j', request);
745
- return this.innerApiCalls.createReportTask(request, options, wrappedCallback)
849
+ return this.innerApiCalls
850
+ .createReportTask(request, options, wrappedCallback)
746
851
  ?.then(([response, rawResponse, _]) => {
747
852
  this._log.info('createReportTask response %j', rawResponse);
748
853
  return [response, rawResponse, _];
@@ -779,10 +884,13 @@ class AlphaAnalyticsDataClient {
779
884
  options = options || {};
780
885
  options.otherArgs = options.otherArgs || {};
781
886
  options.otherArgs.headers = options.otherArgs.headers || {};
782
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
783
- 'parent': request.parent ?? '',
887
+ options.otherArgs.headers['x-goog-request-params'] =
888
+ this._gaxModule.routingHeader.fromParams({
889
+ parent: request.parent ?? '',
890
+ });
891
+ this.initialize().catch(err => {
892
+ throw err;
784
893
  });
785
- this.initialize().catch(err => { throw err; });
786
894
  const wrappedCallback = callback
787
895
  ? (error, values, nextPageRequest, rawResponse) => {
788
896
  this._log.info('listAudienceLists values %j', values);
@@ -831,12 +939,15 @@ class AlphaAnalyticsDataClient {
831
939
  options = options || {};
832
940
  options.otherArgs = options.otherArgs || {};
833
941
  options.otherArgs.headers = options.otherArgs.headers || {};
834
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
835
- 'parent': request.parent ?? '',
836
- });
942
+ options.otherArgs.headers['x-goog-request-params'] =
943
+ this._gaxModule.routingHeader.fromParams({
944
+ parent: request.parent ?? '',
945
+ });
837
946
  const defaultCallSettings = this._defaults['listAudienceLists'];
838
947
  const callSettings = defaultCallSettings.merge(options);
839
- this.initialize().catch(err => { throw err; });
948
+ this.initialize().catch(err => {
949
+ throw err;
950
+ });
840
951
  this._log.info('listAudienceLists stream %j', request);
841
952
  return this.descriptors.page.listAudienceLists.createStream(this.innerApiCalls.listAudienceLists, request, callSettings);
842
953
  }
@@ -877,12 +988,15 @@ class AlphaAnalyticsDataClient {
877
988
  options = options || {};
878
989
  options.otherArgs = options.otherArgs || {};
879
990
  options.otherArgs.headers = options.otherArgs.headers || {};
880
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
881
- 'parent': request.parent ?? '',
882
- });
991
+ options.otherArgs.headers['x-goog-request-params'] =
992
+ this._gaxModule.routingHeader.fromParams({
993
+ parent: request.parent ?? '',
994
+ });
883
995
  const defaultCallSettings = this._defaults['listAudienceLists'];
884
996
  const callSettings = defaultCallSettings.merge(options);
885
- this.initialize().catch(err => { throw err; });
997
+ this.initialize().catch(err => {
998
+ throw err;
999
+ });
886
1000
  this._log.info('listAudienceLists iterate %j', request);
887
1001
  return this.descriptors.page.listAudienceLists.asyncIterate(this.innerApiCalls['listAudienceLists'], request, callSettings);
888
1002
  }
@@ -899,10 +1013,13 @@ class AlphaAnalyticsDataClient {
899
1013
  options = options || {};
900
1014
  options.otherArgs = options.otherArgs || {};
901
1015
  options.otherArgs.headers = options.otherArgs.headers || {};
902
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
903
- 'parent': request.parent ?? '',
1016
+ options.otherArgs.headers['x-goog-request-params'] =
1017
+ this._gaxModule.routingHeader.fromParams({
1018
+ parent: request.parent ?? '',
1019
+ });
1020
+ this.initialize().catch(err => {
1021
+ throw err;
904
1022
  });
905
- this.initialize().catch(err => { throw err; });
906
1023
  const wrappedCallback = callback
907
1024
  ? (error, values, nextPageRequest, rawResponse) => {
908
1025
  this._log.info('listRecurringAudienceLists values %j', values);
@@ -953,12 +1070,15 @@ class AlphaAnalyticsDataClient {
953
1070
  options = options || {};
954
1071
  options.otherArgs = options.otherArgs || {};
955
1072
  options.otherArgs.headers = options.otherArgs.headers || {};
956
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
957
- 'parent': request.parent ?? '',
958
- });
1073
+ options.otherArgs.headers['x-goog-request-params'] =
1074
+ this._gaxModule.routingHeader.fromParams({
1075
+ parent: request.parent ?? '',
1076
+ });
959
1077
  const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
960
1078
  const callSettings = defaultCallSettings.merge(options);
961
- this.initialize().catch(err => { throw err; });
1079
+ this.initialize().catch(err => {
1080
+ throw err;
1081
+ });
962
1082
  this._log.info('listRecurringAudienceLists stream %j', request);
963
1083
  return this.descriptors.page.listRecurringAudienceLists.createStream(this.innerApiCalls.listRecurringAudienceLists, request, callSettings);
964
1084
  }
@@ -1001,12 +1121,15 @@ class AlphaAnalyticsDataClient {
1001
1121
  options = options || {};
1002
1122
  options.otherArgs = options.otherArgs || {};
1003
1123
  options.otherArgs.headers = options.otherArgs.headers || {};
1004
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1005
- 'parent': request.parent ?? '',
1006
- });
1124
+ options.otherArgs.headers['x-goog-request-params'] =
1125
+ this._gaxModule.routingHeader.fromParams({
1126
+ parent: request.parent ?? '',
1127
+ });
1007
1128
  const defaultCallSettings = this._defaults['listRecurringAudienceLists'];
1008
1129
  const callSettings = defaultCallSettings.merge(options);
1009
- this.initialize().catch(err => { throw err; });
1130
+ this.initialize().catch(err => {
1131
+ throw err;
1132
+ });
1010
1133
  this._log.info('listRecurringAudienceLists iterate %j', request);
1011
1134
  return this.descriptors.page.listRecurringAudienceLists.asyncIterate(this.innerApiCalls['listRecurringAudienceLists'], request, callSettings);
1012
1135
  }
@@ -1023,10 +1146,13 @@ class AlphaAnalyticsDataClient {
1023
1146
  options = options || {};
1024
1147
  options.otherArgs = options.otherArgs || {};
1025
1148
  options.otherArgs.headers = options.otherArgs.headers || {};
1026
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1027
- 'parent': request.parent ?? '',
1149
+ options.otherArgs.headers['x-goog-request-params'] =
1150
+ this._gaxModule.routingHeader.fromParams({
1151
+ parent: request.parent ?? '',
1152
+ });
1153
+ this.initialize().catch(err => {
1154
+ throw err;
1028
1155
  });
1029
- this.initialize().catch(err => { throw err; });
1030
1156
  const wrappedCallback = callback
1031
1157
  ? (error, values, nextPageRequest, rawResponse) => {
1032
1158
  this._log.info('listReportTasks values %j', values);
@@ -1069,12 +1195,15 @@ class AlphaAnalyticsDataClient {
1069
1195
  options = options || {};
1070
1196
  options.otherArgs = options.otherArgs || {};
1071
1197
  options.otherArgs.headers = options.otherArgs.headers || {};
1072
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1073
- 'parent': request.parent ?? '',
1074
- });
1198
+ options.otherArgs.headers['x-goog-request-params'] =
1199
+ this._gaxModule.routingHeader.fromParams({
1200
+ parent: request.parent ?? '',
1201
+ });
1075
1202
  const defaultCallSettings = this._defaults['listReportTasks'];
1076
1203
  const callSettings = defaultCallSettings.merge(options);
1077
- this.initialize().catch(err => { throw err; });
1204
+ this.initialize().catch(err => {
1205
+ throw err;
1206
+ });
1078
1207
  this._log.info('listReportTasks stream %j', request);
1079
1208
  return this.descriptors.page.listReportTasks.createStream(this.innerApiCalls.listReportTasks, request, callSettings);
1080
1209
  }
@@ -1109,45 +1238,48 @@ class AlphaAnalyticsDataClient {
1109
1238
  options = options || {};
1110
1239
  options.otherArgs = options.otherArgs || {};
1111
1240
  options.otherArgs.headers = options.otherArgs.headers || {};
1112
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1113
- 'parent': request.parent ?? '',
1114
- });
1241
+ options.otherArgs.headers['x-goog-request-params'] =
1242
+ this._gaxModule.routingHeader.fromParams({
1243
+ parent: request.parent ?? '',
1244
+ });
1115
1245
  const defaultCallSettings = this._defaults['listReportTasks'];
1116
1246
  const callSettings = defaultCallSettings.merge(options);
1117
- this.initialize().catch(err => { throw err; });
1247
+ this.initialize().catch(err => {
1248
+ throw err;
1249
+ });
1118
1250
  this._log.info('listReportTasks iterate %j', request);
1119
1251
  return this.descriptors.page.listReportTasks.asyncIterate(this.innerApiCalls['listReportTasks'], request, callSettings);
1120
1252
  }
1121
1253
  /**
1122
- * Gets the latest state of a long-running operation. Clients can use this
1123
- * method to poll the operation result at intervals as recommended by the API
1124
- * service.
1125
- *
1126
- * @param {Object} request - The request object that will be sent.
1127
- * @param {string} request.name - The name of the operation resource.
1128
- * @param {Object=} options
1129
- * Optional parameters. You can override the default settings for this call,
1130
- * e.g, timeout, retries, paginations, etc. See {@link
1131
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1132
- * for the details.
1133
- * @param {function(?Error, ?Object)=} callback
1134
- * The function which will be called with the result of the API call.
1135
- *
1136
- * The second parameter to the callback is an object representing
1137
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
1138
- * @return {Promise} - The promise which resolves to an array.
1139
- * The first element of the array is an object representing
1140
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
1141
- * The promise has a method named "cancel" which cancels the ongoing API call.
1142
- *
1143
- * @example
1144
- * ```
1145
- * const client = longrunning.operationsClient();
1146
- * const name = '';
1147
- * const [response] = await client.getOperation({name});
1148
- * // doThingsWith(response)
1149
- * ```
1150
- */
1254
+ * Gets the latest state of a long-running operation. Clients can use this
1255
+ * method to poll the operation result at intervals as recommended by the API
1256
+ * service.
1257
+ *
1258
+ * @param {Object} request - The request object that will be sent.
1259
+ * @param {string} request.name - The name of the operation resource.
1260
+ * @param {Object=} options
1261
+ * Optional parameters. You can override the default settings for this call,
1262
+ * e.g, timeout, retries, paginations, etc. See {@link
1263
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1264
+ * for the details.
1265
+ * @param {function(?Error, ?Object)=} callback
1266
+ * The function which will be called with the result of the API call.
1267
+ *
1268
+ * The second parameter to the callback is an object representing
1269
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1270
+ * @return {Promise} - The promise which resolves to an array.
1271
+ * The first element of the array is an object representing
1272
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1273
+ * The promise has a method named "cancel" which cancels the ongoing API call.
1274
+ *
1275
+ * @example
1276
+ * ```
1277
+ * const client = longrunning.operationsClient();
1278
+ * const name = '';
1279
+ * const [response] = await client.getOperation({name});
1280
+ * // doThingsWith(response)
1281
+ * ```
1282
+ */
1151
1283
  getOperation(request, optionsOrCallback, callback) {
1152
1284
  let options;
1153
1285
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1322,7 +1454,8 @@ class AlphaAnalyticsDataClient {
1322
1454
  * @returns {string} A string representing the property.
1323
1455
  */
1324
1456
  matchPropertyFromAudienceListName(audienceListName) {
1325
- return this.pathTemplates.audienceListPathTemplate.match(audienceListName).property;
1457
+ return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
1458
+ .property;
1326
1459
  }
1327
1460
  /**
1328
1461
  * Parse the audience_list from AudienceList resource.
@@ -1332,7 +1465,8 @@ class AlphaAnalyticsDataClient {
1332
1465
  * @returns {string} A string representing the audience_list.
1333
1466
  */
1334
1467
  matchAudienceListFromAudienceListName(audienceListName) {
1335
- return this.pathTemplates.audienceListPathTemplate.match(audienceListName).audience_list;
1468
+ return this.pathTemplates.audienceListPathTemplate.match(audienceListName)
1469
+ .audience_list;
1336
1470
  }
1337
1471
  /**
1338
1472
  * Return a fully-qualified metadata resource name string.
@@ -1451,7 +1585,8 @@ class AlphaAnalyticsDataClient {
1451
1585
  * @returns {string} A string representing the property.
1452
1586
  */
1453
1587
  matchPropertyFromReportTaskName(reportTaskName) {
1454
- return this.pathTemplates.reportTaskPathTemplate.match(reportTaskName).property;
1588
+ return this.pathTemplates.reportTaskPathTemplate.match(reportTaskName)
1589
+ .property;
1455
1590
  }
1456
1591
  /**
1457
1592
  * Parse the report_task from ReportTask resource.
@@ -1461,7 +1596,8 @@ class AlphaAnalyticsDataClient {
1461
1596
  * @returns {string} A string representing the report_task.
1462
1597
  */
1463
1598
  matchReportTaskFromReportTaskName(reportTaskName) {
1464
- return this.pathTemplates.reportTaskPathTemplate.match(reportTaskName).report_task;
1599
+ return this.pathTemplates.reportTaskPathTemplate.match(reportTaskName)
1600
+ .report_task;
1465
1601
  }
1466
1602
  /**
1467
1603
  * Terminate the gRPC channel and close the client.