@google-analytics/data 5.0.0 → 5.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.
- package/README.md +2 -2
- package/build/protos/protos.d.ts +13 -196
- package/build/protos/protos.js +820 -625
- package/build/protos/protos.json +64 -16
- package/build/src/v1alpha/alpha_analytics_data_client.d.ts +145 -145
- package/build/src/v1alpha/alpha_analytics_data_client.js +200 -207
- package/build/src/v1beta/beta_analytics_data_client.d.ts +77 -77
- package/build/src/v1beta/beta_analytics_data_client.js +167 -158
- package/package.json +4 -4
- package/CHANGELOG.md +0 -395
|
@@ -97,26 +97,17 @@ class BetaAnalyticsDataClient {
|
|
|
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 &&
|
|
101
|
-
opts?.universeDomain &&
|
|
102
|
-
opts?.universe_domain !== opts?.universeDomain) {
|
|
100
|
+
if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
|
|
103
101
|
throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
|
104
102
|
}
|
|
105
|
-
const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
|
106
|
-
|
|
107
|
-
: undefined;
|
|
108
|
-
this._universeDomain =
|
|
109
|
-
opts?.universeDomain ??
|
|
110
|
-
opts?.universe_domain ??
|
|
111
|
-
universeDomainEnvVar ??
|
|
112
|
-
'googleapis.com';
|
|
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';
|
|
113
105
|
this._servicePath = 'analyticsdata.' + this._universeDomain;
|
|
114
106
|
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
|
|
115
107
|
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
|
|
116
108
|
const port = opts?.port || staticMembers.port;
|
|
117
109
|
const clientConfig = opts?.clientConfig ?? {};
|
|
118
|
-
const fallback = opts?.fallback ??
|
|
119
|
-
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
110
|
+
const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
120
111
|
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
|
121
112
|
// Request numeric enum values if REST transport is used.
|
|
122
113
|
opts.numericEnums = true;
|
|
@@ -145,7 +136,10 @@ class BetaAnalyticsDataClient {
|
|
|
145
136
|
this.auth.defaultScopes = staticMembers.scopes;
|
|
146
137
|
}
|
|
147
138
|
// Determine the client header string.
|
|
148
|
-
const clientHeader = [
|
|
139
|
+
const clientHeader = [
|
|
140
|
+
`gax/${this._gaxModule.version}`,
|
|
141
|
+
`gapic/${version}`,
|
|
142
|
+
];
|
|
149
143
|
if (typeof process === 'object' && 'versions' in process) {
|
|
150
144
|
clientHeader.push(`gl-node/${process.versions.node}`);
|
|
151
145
|
}
|
|
@@ -175,27 +169,25 @@ class BetaAnalyticsDataClient {
|
|
|
175
169
|
// (e.g. 50 results at a time, with tokens to get subsequent
|
|
176
170
|
// pages). Denote the keys used for pagination and results.
|
|
177
171
|
this.descriptors.page = {
|
|
178
|
-
listAudienceExports: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'audienceExports')
|
|
172
|
+
listAudienceExports: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'audienceExports')
|
|
179
173
|
};
|
|
180
|
-
const protoFilesRoot = this._gaxModule.
|
|
174
|
+
const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
|
|
181
175
|
// This API contains "long-running operations", which return a
|
|
182
176
|
// an Operation object that allows for tracking of the operation,
|
|
183
177
|
// rather than holding a request open.
|
|
184
178
|
const lroOptions = {
|
|
185
179
|
auth: this.auth,
|
|
186
|
-
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
|
|
180
|
+
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
|
|
187
181
|
};
|
|
188
182
|
if (opts.fallback) {
|
|
189
183
|
lroOptions.protoJson = protoFilesRoot;
|
|
190
184
|
lroOptions.httpRules = [];
|
|
191
185
|
}
|
|
192
|
-
this.operationsClient = this._gaxModule
|
|
193
|
-
.lro(lroOptions)
|
|
194
|
-
.operationsClient(opts);
|
|
186
|
+
this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
|
|
195
187
|
const createAudienceExportResponse = protoFilesRoot.lookup('.google.analytics.data.v1beta.AudienceExport');
|
|
196
188
|
const createAudienceExportMetadata = protoFilesRoot.lookup('.google.analytics.data.v1beta.AudienceExportMetadata');
|
|
197
189
|
this.descriptors.longrunning = {
|
|
198
|
-
createAudienceExport: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createAudienceExportResponse.decode.bind(createAudienceExportResponse), createAudienceExportMetadata.decode.bind(createAudienceExportMetadata))
|
|
190
|
+
createAudienceExport: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createAudienceExportResponse.decode.bind(createAudienceExportResponse), createAudienceExportMetadata.decode.bind(createAudienceExportMetadata))
|
|
199
191
|
};
|
|
200
192
|
// Put together the default options sent with requests.
|
|
201
193
|
this._defaults = this._gaxGrpc.constructSettings('google.analytics.data.v1beta.BetaAnalyticsData', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
|
|
@@ -224,25 +216,13 @@ class BetaAnalyticsDataClient {
|
|
|
224
216
|
}
|
|
225
217
|
// Put together the "service stub" for
|
|
226
218
|
// google.analytics.data.v1beta.BetaAnalyticsData.
|
|
227
|
-
this.betaAnalyticsDataStub = this._gaxGrpc.createStub(this._opts.fallback
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
219
|
+
this.betaAnalyticsDataStub = this._gaxGrpc.createStub(this._opts.fallback ?
|
|
220
|
+
this._protos.lookupService('google.analytics.data.v1beta.BetaAnalyticsData') :
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
|
+
this._protos.google.analytics.data.v1beta.BetaAnalyticsData, this._opts, this._providedCustomServicePath);
|
|
231
223
|
// Iterate over each of the methods that the service provides
|
|
232
224
|
// and create an API call method for each.
|
|
233
|
-
const betaAnalyticsDataStubMethods = [
|
|
234
|
-
'runReport',
|
|
235
|
-
'runPivotReport',
|
|
236
|
-
'batchRunReports',
|
|
237
|
-
'batchRunPivotReports',
|
|
238
|
-
'getMetadata',
|
|
239
|
-
'runRealtimeReport',
|
|
240
|
-
'checkCompatibility',
|
|
241
|
-
'createAudienceExport',
|
|
242
|
-
'queryAudienceExport',
|
|
243
|
-
'getAudienceExport',
|
|
244
|
-
'listAudienceExports',
|
|
245
|
-
];
|
|
225
|
+
const betaAnalyticsDataStubMethods = ['runReport', 'runPivotReport', 'batchRunReports', 'batchRunPivotReports', 'getMetadata', 'runRealtimeReport', 'checkCompatibility', 'createAudienceExport', 'queryAudienceExport', 'getAudienceExport', 'listAudienceExports'];
|
|
246
226
|
for (const methodName of betaAnalyticsDataStubMethods) {
|
|
247
227
|
const callPromise = this.betaAnalyticsDataStub.then(stub => (...args) => {
|
|
248
228
|
if (this._terminated) {
|
|
@@ -267,8 +247,7 @@ class BetaAnalyticsDataClient {
|
|
|
267
247
|
* @returns {string} The DNS address for this service.
|
|
268
248
|
*/
|
|
269
249
|
static get servicePath() {
|
|
270
|
-
if (typeof process === 'object' &&
|
|
271
|
-
typeof process.emitWarning === 'function') {
|
|
250
|
+
if (typeof process === 'object' && typeof process.emitWarning === 'function') {
|
|
272
251
|
process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
|
273
252
|
}
|
|
274
253
|
return 'analyticsdata.googleapis.com';
|
|
@@ -279,8 +258,7 @@ class BetaAnalyticsDataClient {
|
|
|
279
258
|
* @returns {string} The DNS address for this service.
|
|
280
259
|
*/
|
|
281
260
|
static get apiEndpoint() {
|
|
282
|
-
if (typeof process === 'object' &&
|
|
283
|
-
typeof process.emitWarning === 'function') {
|
|
261
|
+
if (typeof process === 'object' && typeof process.emitWarning === 'function') {
|
|
284
262
|
process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
|
|
285
263
|
}
|
|
286
264
|
return 'analyticsdata.googleapis.com';
|
|
@@ -310,7 +288,7 @@ class BetaAnalyticsDataClient {
|
|
|
310
288
|
static get scopes() {
|
|
311
289
|
return [
|
|
312
290
|
'https://www.googleapis.com/auth/analytics',
|
|
313
|
-
'https://www.googleapis.com/auth/analytics.readonly'
|
|
291
|
+
'https://www.googleapis.com/auth/analytics.readonly'
|
|
314
292
|
];
|
|
315
293
|
}
|
|
316
294
|
/**
|
|
@@ -337,11 +315,10 @@ class BetaAnalyticsDataClient {
|
|
|
337
315
|
options = options || {};
|
|
338
316
|
options.otherArgs = options.otherArgs || {};
|
|
339
317
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
340
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
this.initialize();
|
|
318
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
319
|
+
'property': request.property ?? '',
|
|
320
|
+
});
|
|
321
|
+
this.initialize().catch(err => { throw err; });
|
|
345
322
|
this._log.info('runReport request %j', request);
|
|
346
323
|
const wrappedCallback = callback
|
|
347
324
|
? (error, response, options, rawResponse) => {
|
|
@@ -349,11 +326,16 @@ class BetaAnalyticsDataClient {
|
|
|
349
326
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
350
327
|
}
|
|
351
328
|
: undefined;
|
|
352
|
-
return this.innerApiCalls
|
|
353
|
-
.runReport(request, options, wrappedCallback)
|
|
329
|
+
return this.innerApiCalls.runReport(request, options, wrappedCallback)
|
|
354
330
|
?.then(([response, options, rawResponse]) => {
|
|
355
331
|
this._log.info('runReport response %j', response);
|
|
356
332
|
return [response, options, rawResponse];
|
|
333
|
+
}).catch((error) => {
|
|
334
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
335
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
336
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
337
|
+
}
|
|
338
|
+
throw error;
|
|
357
339
|
});
|
|
358
340
|
}
|
|
359
341
|
runPivotReport(request, optionsOrCallback, callback) {
|
|
@@ -369,11 +351,10 @@ class BetaAnalyticsDataClient {
|
|
|
369
351
|
options = options || {};
|
|
370
352
|
options.otherArgs = options.otherArgs || {};
|
|
371
353
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
372
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this.initialize();
|
|
354
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
355
|
+
'property': request.property ?? '',
|
|
356
|
+
});
|
|
357
|
+
this.initialize().catch(err => { throw err; });
|
|
377
358
|
this._log.info('runPivotReport request %j', request);
|
|
378
359
|
const wrappedCallback = callback
|
|
379
360
|
? (error, response, options, rawResponse) => {
|
|
@@ -381,11 +362,16 @@ class BetaAnalyticsDataClient {
|
|
|
381
362
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
382
363
|
}
|
|
383
364
|
: undefined;
|
|
384
|
-
return this.innerApiCalls
|
|
385
|
-
.runPivotReport(request, options, wrappedCallback)
|
|
365
|
+
return this.innerApiCalls.runPivotReport(request, options, wrappedCallback)
|
|
386
366
|
?.then(([response, options, rawResponse]) => {
|
|
387
367
|
this._log.info('runPivotReport response %j', response);
|
|
388
368
|
return [response, options, rawResponse];
|
|
369
|
+
}).catch((error) => {
|
|
370
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
371
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
372
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
373
|
+
}
|
|
374
|
+
throw error;
|
|
389
375
|
});
|
|
390
376
|
}
|
|
391
377
|
batchRunReports(request, optionsOrCallback, callback) {
|
|
@@ -401,11 +387,10 @@ class BetaAnalyticsDataClient {
|
|
|
401
387
|
options = options || {};
|
|
402
388
|
options.otherArgs = options.otherArgs || {};
|
|
403
389
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
404
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
this.initialize();
|
|
390
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
391
|
+
'property': request.property ?? '',
|
|
392
|
+
});
|
|
393
|
+
this.initialize().catch(err => { throw err; });
|
|
409
394
|
this._log.info('batchRunReports request %j', request);
|
|
410
395
|
const wrappedCallback = callback
|
|
411
396
|
? (error, response, options, rawResponse) => {
|
|
@@ -413,11 +398,16 @@ class BetaAnalyticsDataClient {
|
|
|
413
398
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
414
399
|
}
|
|
415
400
|
: undefined;
|
|
416
|
-
return this.innerApiCalls
|
|
417
|
-
.batchRunReports(request, options, wrappedCallback)
|
|
401
|
+
return this.innerApiCalls.batchRunReports(request, options, wrappedCallback)
|
|
418
402
|
?.then(([response, options, rawResponse]) => {
|
|
419
403
|
this._log.info('batchRunReports response %j', response);
|
|
420
404
|
return [response, options, rawResponse];
|
|
405
|
+
}).catch((error) => {
|
|
406
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
407
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
408
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
409
|
+
}
|
|
410
|
+
throw error;
|
|
421
411
|
});
|
|
422
412
|
}
|
|
423
413
|
batchRunPivotReports(request, optionsOrCallback, callback) {
|
|
@@ -433,11 +423,10 @@ class BetaAnalyticsDataClient {
|
|
|
433
423
|
options = options || {};
|
|
434
424
|
options.otherArgs = options.otherArgs || {};
|
|
435
425
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
436
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
this.initialize();
|
|
426
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
427
|
+
'property': request.property ?? '',
|
|
428
|
+
});
|
|
429
|
+
this.initialize().catch(err => { throw err; });
|
|
441
430
|
this._log.info('batchRunPivotReports request %j', request);
|
|
442
431
|
const wrappedCallback = callback
|
|
443
432
|
? (error, response, options, rawResponse) => {
|
|
@@ -445,11 +434,16 @@ class BetaAnalyticsDataClient {
|
|
|
445
434
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
446
435
|
}
|
|
447
436
|
: undefined;
|
|
448
|
-
return this.innerApiCalls
|
|
449
|
-
.batchRunPivotReports(request, options, wrappedCallback)
|
|
437
|
+
return this.innerApiCalls.batchRunPivotReports(request, options, wrappedCallback)
|
|
450
438
|
?.then(([response, options, rawResponse]) => {
|
|
451
439
|
this._log.info('batchRunPivotReports response %j', response);
|
|
452
440
|
return [response, options, rawResponse];
|
|
441
|
+
}).catch((error) => {
|
|
442
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
443
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
444
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
445
|
+
}
|
|
446
|
+
throw error;
|
|
453
447
|
});
|
|
454
448
|
}
|
|
455
449
|
getMetadata(request, optionsOrCallback, callback) {
|
|
@@ -465,11 +459,10 @@ class BetaAnalyticsDataClient {
|
|
|
465
459
|
options = options || {};
|
|
466
460
|
options.otherArgs = options.otherArgs || {};
|
|
467
461
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
468
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.initialize();
|
|
462
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
463
|
+
'name': request.name ?? '',
|
|
464
|
+
});
|
|
465
|
+
this.initialize().catch(err => { throw err; });
|
|
473
466
|
this._log.info('getMetadata request %j', request);
|
|
474
467
|
const wrappedCallback = callback
|
|
475
468
|
? (error, response, options, rawResponse) => {
|
|
@@ -477,11 +470,16 @@ class BetaAnalyticsDataClient {
|
|
|
477
470
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
478
471
|
}
|
|
479
472
|
: undefined;
|
|
480
|
-
return this.innerApiCalls
|
|
481
|
-
.getMetadata(request, options, wrappedCallback)
|
|
473
|
+
return this.innerApiCalls.getMetadata(request, options, wrappedCallback)
|
|
482
474
|
?.then(([response, options, rawResponse]) => {
|
|
483
475
|
this._log.info('getMetadata response %j', response);
|
|
484
476
|
return [response, options, rawResponse];
|
|
477
|
+
}).catch((error) => {
|
|
478
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
479
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
480
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
481
|
+
}
|
|
482
|
+
throw error;
|
|
485
483
|
});
|
|
486
484
|
}
|
|
487
485
|
runRealtimeReport(request, optionsOrCallback, callback) {
|
|
@@ -497,11 +495,10 @@ class BetaAnalyticsDataClient {
|
|
|
497
495
|
options = options || {};
|
|
498
496
|
options.otherArgs = options.otherArgs || {};
|
|
499
497
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
500
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this.initialize();
|
|
498
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
499
|
+
'property': request.property ?? '',
|
|
500
|
+
});
|
|
501
|
+
this.initialize().catch(err => { throw err; });
|
|
505
502
|
this._log.info('runRealtimeReport request %j', request);
|
|
506
503
|
const wrappedCallback = callback
|
|
507
504
|
? (error, response, options, rawResponse) => {
|
|
@@ -509,11 +506,16 @@ class BetaAnalyticsDataClient {
|
|
|
509
506
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
510
507
|
}
|
|
511
508
|
: undefined;
|
|
512
|
-
return this.innerApiCalls
|
|
513
|
-
.runRealtimeReport(request, options, wrappedCallback)
|
|
509
|
+
return this.innerApiCalls.runRealtimeReport(request, options, wrappedCallback)
|
|
514
510
|
?.then(([response, options, rawResponse]) => {
|
|
515
511
|
this._log.info('runRealtimeReport response %j', response);
|
|
516
512
|
return [response, options, rawResponse];
|
|
513
|
+
}).catch((error) => {
|
|
514
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
515
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
516
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
517
|
+
}
|
|
518
|
+
throw error;
|
|
517
519
|
});
|
|
518
520
|
}
|
|
519
521
|
checkCompatibility(request, optionsOrCallback, callback) {
|
|
@@ -529,11 +531,10 @@ class BetaAnalyticsDataClient {
|
|
|
529
531
|
options = options || {};
|
|
530
532
|
options.otherArgs = options.otherArgs || {};
|
|
531
533
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
532
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
this.initialize();
|
|
534
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
535
|
+
'property': request.property ?? '',
|
|
536
|
+
});
|
|
537
|
+
this.initialize().catch(err => { throw err; });
|
|
537
538
|
this._log.info('checkCompatibility request %j', request);
|
|
538
539
|
const wrappedCallback = callback
|
|
539
540
|
? (error, response, options, rawResponse) => {
|
|
@@ -541,11 +542,16 @@ class BetaAnalyticsDataClient {
|
|
|
541
542
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
542
543
|
}
|
|
543
544
|
: undefined;
|
|
544
|
-
return this.innerApiCalls
|
|
545
|
-
.checkCompatibility(request, options, wrappedCallback)
|
|
545
|
+
return this.innerApiCalls.checkCompatibility(request, options, wrappedCallback)
|
|
546
546
|
?.then(([response, options, rawResponse]) => {
|
|
547
547
|
this._log.info('checkCompatibility response %j', response);
|
|
548
548
|
return [response, options, rawResponse];
|
|
549
|
+
}).catch((error) => {
|
|
550
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
551
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
552
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
553
|
+
}
|
|
554
|
+
throw error;
|
|
549
555
|
});
|
|
550
556
|
}
|
|
551
557
|
queryAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -561,11 +567,10 @@ class BetaAnalyticsDataClient {
|
|
|
561
567
|
options = options || {};
|
|
562
568
|
options.otherArgs = options.otherArgs || {};
|
|
563
569
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
564
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
this.initialize();
|
|
570
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
571
|
+
'name': request.name ?? '',
|
|
572
|
+
});
|
|
573
|
+
this.initialize().catch(err => { throw err; });
|
|
569
574
|
this._log.info('queryAudienceExport request %j', request);
|
|
570
575
|
const wrappedCallback = callback
|
|
571
576
|
? (error, response, options, rawResponse) => {
|
|
@@ -573,11 +578,16 @@ class BetaAnalyticsDataClient {
|
|
|
573
578
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
574
579
|
}
|
|
575
580
|
: undefined;
|
|
576
|
-
return this.innerApiCalls
|
|
577
|
-
.queryAudienceExport(request, options, wrappedCallback)
|
|
581
|
+
return this.innerApiCalls.queryAudienceExport(request, options, wrappedCallback)
|
|
578
582
|
?.then(([response, options, rawResponse]) => {
|
|
579
583
|
this._log.info('queryAudienceExport response %j', response);
|
|
580
584
|
return [response, options, rawResponse];
|
|
585
|
+
}).catch((error) => {
|
|
586
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
587
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
588
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
589
|
+
}
|
|
590
|
+
throw error;
|
|
581
591
|
});
|
|
582
592
|
}
|
|
583
593
|
getAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -593,11 +603,10 @@ class BetaAnalyticsDataClient {
|
|
|
593
603
|
options = options || {};
|
|
594
604
|
options.otherArgs = options.otherArgs || {};
|
|
595
605
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
596
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
this.initialize();
|
|
606
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
607
|
+
'name': request.name ?? '',
|
|
608
|
+
});
|
|
609
|
+
this.initialize().catch(err => { throw err; });
|
|
601
610
|
this._log.info('getAudienceExport request %j', request);
|
|
602
611
|
const wrappedCallback = callback
|
|
603
612
|
? (error, response, options, rawResponse) => {
|
|
@@ -605,11 +614,16 @@ class BetaAnalyticsDataClient {
|
|
|
605
614
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
606
615
|
}
|
|
607
616
|
: undefined;
|
|
608
|
-
return this.innerApiCalls
|
|
609
|
-
.getAudienceExport(request, options, wrappedCallback)
|
|
617
|
+
return this.innerApiCalls.getAudienceExport(request, options, wrappedCallback)
|
|
610
618
|
?.then(([response, options, rawResponse]) => {
|
|
611
619
|
this._log.info('getAudienceExport response %j', response);
|
|
612
620
|
return [response, options, rawResponse];
|
|
621
|
+
}).catch((error) => {
|
|
622
|
+
if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
|
|
623
|
+
const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
|
|
624
|
+
error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
|
|
625
|
+
}
|
|
626
|
+
throw error;
|
|
613
627
|
});
|
|
614
628
|
}
|
|
615
629
|
createAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -625,11 +639,10 @@ class BetaAnalyticsDataClient {
|
|
|
625
639
|
options = options || {};
|
|
626
640
|
options.otherArgs = options.otherArgs || {};
|
|
627
641
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
628
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
this.initialize();
|
|
642
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
643
|
+
'parent': request.parent ?? '',
|
|
644
|
+
});
|
|
645
|
+
this.initialize().catch(err => { throw err; });
|
|
633
646
|
const wrappedCallback = callback
|
|
634
647
|
? (error, response, rawResponse, _) => {
|
|
635
648
|
this._log.info('createAudienceExport response %j', rawResponse);
|
|
@@ -637,8 +650,7 @@ class BetaAnalyticsDataClient {
|
|
|
637
650
|
}
|
|
638
651
|
: undefined;
|
|
639
652
|
this._log.info('createAudienceExport request %j', request);
|
|
640
|
-
return this.innerApiCalls
|
|
641
|
-
.createAudienceExport(request, options, wrappedCallback)
|
|
653
|
+
return this.innerApiCalls.createAudienceExport(request, options, wrappedCallback)
|
|
642
654
|
?.then(([response, rawResponse, _]) => {
|
|
643
655
|
this._log.info('createAudienceExport response %j', rawResponse);
|
|
644
656
|
return [response, rawResponse, _];
|
|
@@ -675,11 +687,10 @@ class BetaAnalyticsDataClient {
|
|
|
675
687
|
options = options || {};
|
|
676
688
|
options.otherArgs = options.otherArgs || {};
|
|
677
689
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
678
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
this.initialize();
|
|
690
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
691
|
+
'parent': request.parent ?? '',
|
|
692
|
+
});
|
|
693
|
+
this.initialize().catch(err => { throw err; });
|
|
683
694
|
const wrappedCallback = callback
|
|
684
695
|
? (error, values, nextPageRequest, rawResponse) => {
|
|
685
696
|
this._log.info('listAudienceExports values %j', values);
|
|
@@ -728,13 +739,12 @@ class BetaAnalyticsDataClient {
|
|
|
728
739
|
options = options || {};
|
|
729
740
|
options.otherArgs = options.otherArgs || {};
|
|
730
741
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
731
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
});
|
|
742
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
743
|
+
'parent': request.parent ?? '',
|
|
744
|
+
});
|
|
735
745
|
const defaultCallSettings = this._defaults['listAudienceExports'];
|
|
736
746
|
const callSettings = defaultCallSettings.merge(options);
|
|
737
|
-
this.initialize();
|
|
747
|
+
this.initialize().catch(err => { throw err; });
|
|
738
748
|
this._log.info('listAudienceExports stream %j', request);
|
|
739
749
|
return this.descriptors.page.listAudienceExports.createStream(this.innerApiCalls.listAudienceExports, request, callSettings);
|
|
740
750
|
}
|
|
@@ -775,46 +785,45 @@ class BetaAnalyticsDataClient {
|
|
|
775
785
|
options = options || {};
|
|
776
786
|
options.otherArgs = options.otherArgs || {};
|
|
777
787
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
778
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
});
|
|
788
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
789
|
+
'parent': request.parent ?? '',
|
|
790
|
+
});
|
|
782
791
|
const defaultCallSettings = this._defaults['listAudienceExports'];
|
|
783
792
|
const callSettings = defaultCallSettings.merge(options);
|
|
784
|
-
this.initialize();
|
|
793
|
+
this.initialize().catch(err => { throw err; });
|
|
785
794
|
this._log.info('listAudienceExports iterate %j', request);
|
|
786
795
|
return this.descriptors.page.listAudienceExports.asyncIterate(this.innerApiCalls['listAudienceExports'], request, callSettings);
|
|
787
796
|
}
|
|
788
797
|
/**
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
798
|
+
* Gets the latest state of a long-running operation. Clients can use this
|
|
799
|
+
* method to poll the operation result at intervals as recommended by the API
|
|
800
|
+
* service.
|
|
801
|
+
*
|
|
802
|
+
* @param {Object} request - The request object that will be sent.
|
|
803
|
+
* @param {string} request.name - The name of the operation resource.
|
|
804
|
+
* @param {Object=} options
|
|
805
|
+
* Optional parameters. You can override the default settings for this call,
|
|
806
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
807
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
|
|
808
|
+
* for the details.
|
|
809
|
+
* @param {function(?Error, ?Object)=} callback
|
|
810
|
+
* The function which will be called with the result of the API call.
|
|
811
|
+
*
|
|
812
|
+
* The second parameter to the callback is an object representing
|
|
813
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
814
|
+
* @return {Promise} - The promise which resolves to an array.
|
|
815
|
+
* The first element of the array is an object representing
|
|
816
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
817
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```
|
|
821
|
+
* const client = longrunning.operationsClient();
|
|
822
|
+
* const name = '';
|
|
823
|
+
* const [response] = await client.getOperation({name});
|
|
824
|
+
* // doThingsWith(response)
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
818
827
|
getOperation(request, optionsOrCallback, callback) {
|
|
819
828
|
let options;
|
|
820
829
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -1055,7 +1064,7 @@ class BetaAnalyticsDataClient {
|
|
|
1055
1064
|
this._log.info('ending gRPC channel');
|
|
1056
1065
|
this._terminated = true;
|
|
1057
1066
|
stub.close();
|
|
1058
|
-
this.operationsClient.close();
|
|
1067
|
+
void this.operationsClient.close();
|
|
1059
1068
|
});
|
|
1060
1069
|
}
|
|
1061
1070
|
return Promise.resolve();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-analytics/data",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Data client for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test": "c8 mocha build/test"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"google-gax": "^5.0.0
|
|
48
|
+
"google-gax": "^5.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/mocha": "^10.0.10",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"gapic-tools": "^1.0.0",
|
|
56
56
|
"gts": "^6.0.2",
|
|
57
57
|
"jsdoc": "^4.0.4",
|
|
58
|
-
"jsdoc-fresh": "^
|
|
58
|
+
"jsdoc-fresh": "^4.0.0",
|
|
59
59
|
"jsdoc-region-tag": "^3.0.0",
|
|
60
60
|
"linkinator": "^6.1.2",
|
|
61
61
|
"long": "^5.3.1",
|
|
62
62
|
"mocha": "^11.1.0",
|
|
63
63
|
"pack-n-play": "^3.0.0",
|
|
64
|
-
"sinon": "^
|
|
64
|
+
"sinon": "^21.0.0",
|
|
65
65
|
"typescript": "^5.8.2"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|