@google-analytics/data 5.1.0 → 5.2.1
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 +58 -125
- package/build/protos/protos.d.ts +13 -196
- package/build/protos/protos.js +821 -626
- package/build/protos/protos.json +64 -16
- package/build/src/v1alpha/alpha_analytics_data_client.d.ts +144 -144
- package/build/src/v1alpha/alpha_analytics_data_client.js +186 -233
- package/build/src/v1beta/beta_analytics_data_client.d.ts +76 -76
- package/build/src/v1beta/beta_analytics_data_client.js +156 -173
- package/package.json +4 -4
- package/CHANGELOG.md +0 -402
|
@@ -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,13 +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
|
-
property: request.property ?? '',
|
|
343
|
-
});
|
|
344
|
-
this.initialize().catch(err => {
|
|
345
|
-
throw err;
|
|
318
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
319
|
+
'property': request.property ?? '',
|
|
346
320
|
});
|
|
321
|
+
this.initialize().catch(err => { throw err; });
|
|
347
322
|
this._log.info('runReport request %j', request);
|
|
348
323
|
const wrappedCallback = callback
|
|
349
324
|
? (error, response, options, rawResponse) => {
|
|
@@ -351,11 +326,16 @@ class BetaAnalyticsDataClient {
|
|
|
351
326
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
352
327
|
}
|
|
353
328
|
: undefined;
|
|
354
|
-
return this.innerApiCalls
|
|
355
|
-
.runReport(request, options, wrappedCallback)
|
|
329
|
+
return this.innerApiCalls.runReport(request, options, wrappedCallback)
|
|
356
330
|
?.then(([response, options, rawResponse]) => {
|
|
357
331
|
this._log.info('runReport response %j', response);
|
|
358
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;
|
|
359
339
|
});
|
|
360
340
|
}
|
|
361
341
|
runPivotReport(request, optionsOrCallback, callback) {
|
|
@@ -371,13 +351,10 @@ class BetaAnalyticsDataClient {
|
|
|
371
351
|
options = options || {};
|
|
372
352
|
options.otherArgs = options.otherArgs || {};
|
|
373
353
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
374
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
375
|
-
|
|
376
|
-
property: request.property ?? '',
|
|
377
|
-
});
|
|
378
|
-
this.initialize().catch(err => {
|
|
379
|
-
throw err;
|
|
354
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
355
|
+
'property': request.property ?? '',
|
|
380
356
|
});
|
|
357
|
+
this.initialize().catch(err => { throw err; });
|
|
381
358
|
this._log.info('runPivotReport request %j', request);
|
|
382
359
|
const wrappedCallback = callback
|
|
383
360
|
? (error, response, options, rawResponse) => {
|
|
@@ -385,11 +362,16 @@ class BetaAnalyticsDataClient {
|
|
|
385
362
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
386
363
|
}
|
|
387
364
|
: undefined;
|
|
388
|
-
return this.innerApiCalls
|
|
389
|
-
.runPivotReport(request, options, wrappedCallback)
|
|
365
|
+
return this.innerApiCalls.runPivotReport(request, options, wrappedCallback)
|
|
390
366
|
?.then(([response, options, rawResponse]) => {
|
|
391
367
|
this._log.info('runPivotReport response %j', response);
|
|
392
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;
|
|
393
375
|
});
|
|
394
376
|
}
|
|
395
377
|
batchRunReports(request, optionsOrCallback, callback) {
|
|
@@ -405,13 +387,10 @@ class BetaAnalyticsDataClient {
|
|
|
405
387
|
options = options || {};
|
|
406
388
|
options.otherArgs = options.otherArgs || {};
|
|
407
389
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
408
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
409
|
-
|
|
410
|
-
property: request.property ?? '',
|
|
411
|
-
});
|
|
412
|
-
this.initialize().catch(err => {
|
|
413
|
-
throw err;
|
|
390
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
391
|
+
'property': request.property ?? '',
|
|
414
392
|
});
|
|
393
|
+
this.initialize().catch(err => { throw err; });
|
|
415
394
|
this._log.info('batchRunReports request %j', request);
|
|
416
395
|
const wrappedCallback = callback
|
|
417
396
|
? (error, response, options, rawResponse) => {
|
|
@@ -419,11 +398,16 @@ class BetaAnalyticsDataClient {
|
|
|
419
398
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
420
399
|
}
|
|
421
400
|
: undefined;
|
|
422
|
-
return this.innerApiCalls
|
|
423
|
-
.batchRunReports(request, options, wrappedCallback)
|
|
401
|
+
return this.innerApiCalls.batchRunReports(request, options, wrappedCallback)
|
|
424
402
|
?.then(([response, options, rawResponse]) => {
|
|
425
403
|
this._log.info('batchRunReports response %j', response);
|
|
426
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;
|
|
427
411
|
});
|
|
428
412
|
}
|
|
429
413
|
batchRunPivotReports(request, optionsOrCallback, callback) {
|
|
@@ -439,13 +423,10 @@ class BetaAnalyticsDataClient {
|
|
|
439
423
|
options = options || {};
|
|
440
424
|
options.otherArgs = options.otherArgs || {};
|
|
441
425
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
442
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
443
|
-
|
|
444
|
-
property: request.property ?? '',
|
|
445
|
-
});
|
|
446
|
-
this.initialize().catch(err => {
|
|
447
|
-
throw err;
|
|
426
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
427
|
+
'property': request.property ?? '',
|
|
448
428
|
});
|
|
429
|
+
this.initialize().catch(err => { throw err; });
|
|
449
430
|
this._log.info('batchRunPivotReports request %j', request);
|
|
450
431
|
const wrappedCallback = callback
|
|
451
432
|
? (error, response, options, rawResponse) => {
|
|
@@ -453,11 +434,16 @@ class BetaAnalyticsDataClient {
|
|
|
453
434
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
454
435
|
}
|
|
455
436
|
: undefined;
|
|
456
|
-
return this.innerApiCalls
|
|
457
|
-
.batchRunPivotReports(request, options, wrappedCallback)
|
|
437
|
+
return this.innerApiCalls.batchRunPivotReports(request, options, wrappedCallback)
|
|
458
438
|
?.then(([response, options, rawResponse]) => {
|
|
459
439
|
this._log.info('batchRunPivotReports response %j', response);
|
|
460
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;
|
|
461
447
|
});
|
|
462
448
|
}
|
|
463
449
|
getMetadata(request, optionsOrCallback, callback) {
|
|
@@ -473,13 +459,10 @@ class BetaAnalyticsDataClient {
|
|
|
473
459
|
options = options || {};
|
|
474
460
|
options.otherArgs = options.otherArgs || {};
|
|
475
461
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
476
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
477
|
-
|
|
478
|
-
name: request.name ?? '',
|
|
479
|
-
});
|
|
480
|
-
this.initialize().catch(err => {
|
|
481
|
-
throw err;
|
|
462
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
463
|
+
'name': request.name ?? '',
|
|
482
464
|
});
|
|
465
|
+
this.initialize().catch(err => { throw err; });
|
|
483
466
|
this._log.info('getMetadata request %j', request);
|
|
484
467
|
const wrappedCallback = callback
|
|
485
468
|
? (error, response, options, rawResponse) => {
|
|
@@ -487,11 +470,16 @@ class BetaAnalyticsDataClient {
|
|
|
487
470
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
488
471
|
}
|
|
489
472
|
: undefined;
|
|
490
|
-
return this.innerApiCalls
|
|
491
|
-
.getMetadata(request, options, wrappedCallback)
|
|
473
|
+
return this.innerApiCalls.getMetadata(request, options, wrappedCallback)
|
|
492
474
|
?.then(([response, options, rawResponse]) => {
|
|
493
475
|
this._log.info('getMetadata response %j', response);
|
|
494
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;
|
|
495
483
|
});
|
|
496
484
|
}
|
|
497
485
|
runRealtimeReport(request, optionsOrCallback, callback) {
|
|
@@ -507,13 +495,10 @@ class BetaAnalyticsDataClient {
|
|
|
507
495
|
options = options || {};
|
|
508
496
|
options.otherArgs = options.otherArgs || {};
|
|
509
497
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
510
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
511
|
-
|
|
512
|
-
property: request.property ?? '',
|
|
513
|
-
});
|
|
514
|
-
this.initialize().catch(err => {
|
|
515
|
-
throw err;
|
|
498
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
499
|
+
'property': request.property ?? '',
|
|
516
500
|
});
|
|
501
|
+
this.initialize().catch(err => { throw err; });
|
|
517
502
|
this._log.info('runRealtimeReport request %j', request);
|
|
518
503
|
const wrappedCallback = callback
|
|
519
504
|
? (error, response, options, rawResponse) => {
|
|
@@ -521,11 +506,16 @@ class BetaAnalyticsDataClient {
|
|
|
521
506
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
522
507
|
}
|
|
523
508
|
: undefined;
|
|
524
|
-
return this.innerApiCalls
|
|
525
|
-
.runRealtimeReport(request, options, wrappedCallback)
|
|
509
|
+
return this.innerApiCalls.runRealtimeReport(request, options, wrappedCallback)
|
|
526
510
|
?.then(([response, options, rawResponse]) => {
|
|
527
511
|
this._log.info('runRealtimeReport response %j', response);
|
|
528
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;
|
|
529
519
|
});
|
|
530
520
|
}
|
|
531
521
|
checkCompatibility(request, optionsOrCallback, callback) {
|
|
@@ -541,13 +531,10 @@ class BetaAnalyticsDataClient {
|
|
|
541
531
|
options = options || {};
|
|
542
532
|
options.otherArgs = options.otherArgs || {};
|
|
543
533
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
544
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
545
|
-
|
|
546
|
-
property: request.property ?? '',
|
|
547
|
-
});
|
|
548
|
-
this.initialize().catch(err => {
|
|
549
|
-
throw err;
|
|
534
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
535
|
+
'property': request.property ?? '',
|
|
550
536
|
});
|
|
537
|
+
this.initialize().catch(err => { throw err; });
|
|
551
538
|
this._log.info('checkCompatibility request %j', request);
|
|
552
539
|
const wrappedCallback = callback
|
|
553
540
|
? (error, response, options, rawResponse) => {
|
|
@@ -555,11 +542,16 @@ class BetaAnalyticsDataClient {
|
|
|
555
542
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
556
543
|
}
|
|
557
544
|
: undefined;
|
|
558
|
-
return this.innerApiCalls
|
|
559
|
-
.checkCompatibility(request, options, wrappedCallback)
|
|
545
|
+
return this.innerApiCalls.checkCompatibility(request, options, wrappedCallback)
|
|
560
546
|
?.then(([response, options, rawResponse]) => {
|
|
561
547
|
this._log.info('checkCompatibility response %j', response);
|
|
562
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;
|
|
563
555
|
});
|
|
564
556
|
}
|
|
565
557
|
queryAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -575,13 +567,10 @@ class BetaAnalyticsDataClient {
|
|
|
575
567
|
options = options || {};
|
|
576
568
|
options.otherArgs = options.otherArgs || {};
|
|
577
569
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
578
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
579
|
-
|
|
580
|
-
name: request.name ?? '',
|
|
581
|
-
});
|
|
582
|
-
this.initialize().catch(err => {
|
|
583
|
-
throw err;
|
|
570
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
571
|
+
'name': request.name ?? '',
|
|
584
572
|
});
|
|
573
|
+
this.initialize().catch(err => { throw err; });
|
|
585
574
|
this._log.info('queryAudienceExport request %j', request);
|
|
586
575
|
const wrappedCallback = callback
|
|
587
576
|
? (error, response, options, rawResponse) => {
|
|
@@ -589,11 +578,16 @@ class BetaAnalyticsDataClient {
|
|
|
589
578
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
590
579
|
}
|
|
591
580
|
: undefined;
|
|
592
|
-
return this.innerApiCalls
|
|
593
|
-
.queryAudienceExport(request, options, wrappedCallback)
|
|
581
|
+
return this.innerApiCalls.queryAudienceExport(request, options, wrappedCallback)
|
|
594
582
|
?.then(([response, options, rawResponse]) => {
|
|
595
583
|
this._log.info('queryAudienceExport response %j', response);
|
|
596
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;
|
|
597
591
|
});
|
|
598
592
|
}
|
|
599
593
|
getAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -609,13 +603,10 @@ class BetaAnalyticsDataClient {
|
|
|
609
603
|
options = options || {};
|
|
610
604
|
options.otherArgs = options.otherArgs || {};
|
|
611
605
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
612
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
613
|
-
|
|
614
|
-
name: request.name ?? '',
|
|
615
|
-
});
|
|
616
|
-
this.initialize().catch(err => {
|
|
617
|
-
throw err;
|
|
606
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
607
|
+
'name': request.name ?? '',
|
|
618
608
|
});
|
|
609
|
+
this.initialize().catch(err => { throw err; });
|
|
619
610
|
this._log.info('getAudienceExport request %j', request);
|
|
620
611
|
const wrappedCallback = callback
|
|
621
612
|
? (error, response, options, rawResponse) => {
|
|
@@ -623,11 +614,16 @@ class BetaAnalyticsDataClient {
|
|
|
623
614
|
callback(error, response, options, rawResponse); // We verified callback above.
|
|
624
615
|
}
|
|
625
616
|
: undefined;
|
|
626
|
-
return this.innerApiCalls
|
|
627
|
-
.getAudienceExport(request, options, wrappedCallback)
|
|
617
|
+
return this.innerApiCalls.getAudienceExport(request, options, wrappedCallback)
|
|
628
618
|
?.then(([response, options, rawResponse]) => {
|
|
629
619
|
this._log.info('getAudienceExport response %j', response);
|
|
630
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;
|
|
631
627
|
});
|
|
632
628
|
}
|
|
633
629
|
createAudienceExport(request, optionsOrCallback, callback) {
|
|
@@ -643,13 +639,10 @@ class BetaAnalyticsDataClient {
|
|
|
643
639
|
options = options || {};
|
|
644
640
|
options.otherArgs = options.otherArgs || {};
|
|
645
641
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
646
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
647
|
-
|
|
648
|
-
parent: request.parent ?? '',
|
|
649
|
-
});
|
|
650
|
-
this.initialize().catch(err => {
|
|
651
|
-
throw err;
|
|
642
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
643
|
+
'parent': request.parent ?? '',
|
|
652
644
|
});
|
|
645
|
+
this.initialize().catch(err => { throw err; });
|
|
653
646
|
const wrappedCallback = callback
|
|
654
647
|
? (error, response, rawResponse, _) => {
|
|
655
648
|
this._log.info('createAudienceExport response %j', rawResponse);
|
|
@@ -657,8 +650,7 @@ class BetaAnalyticsDataClient {
|
|
|
657
650
|
}
|
|
658
651
|
: undefined;
|
|
659
652
|
this._log.info('createAudienceExport request %j', request);
|
|
660
|
-
return this.innerApiCalls
|
|
661
|
-
.createAudienceExport(request, options, wrappedCallback)
|
|
653
|
+
return this.innerApiCalls.createAudienceExport(request, options, wrappedCallback)
|
|
662
654
|
?.then(([response, rawResponse, _]) => {
|
|
663
655
|
this._log.info('createAudienceExport response %j', rawResponse);
|
|
664
656
|
return [response, rawResponse, _];
|
|
@@ -695,13 +687,10 @@ class BetaAnalyticsDataClient {
|
|
|
695
687
|
options = options || {};
|
|
696
688
|
options.otherArgs = options.otherArgs || {};
|
|
697
689
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
698
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
699
|
-
|
|
700
|
-
parent: request.parent ?? '',
|
|
701
|
-
});
|
|
702
|
-
this.initialize().catch(err => {
|
|
703
|
-
throw err;
|
|
690
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
691
|
+
'parent': request.parent ?? '',
|
|
704
692
|
});
|
|
693
|
+
this.initialize().catch(err => { throw err; });
|
|
705
694
|
const wrappedCallback = callback
|
|
706
695
|
? (error, values, nextPageRequest, rawResponse) => {
|
|
707
696
|
this._log.info('listAudienceExports values %j', values);
|
|
@@ -750,15 +739,12 @@ class BetaAnalyticsDataClient {
|
|
|
750
739
|
options = options || {};
|
|
751
740
|
options.otherArgs = options.otherArgs || {};
|
|
752
741
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
753
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
});
|
|
742
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
743
|
+
'parent': request.parent ?? '',
|
|
744
|
+
});
|
|
757
745
|
const defaultCallSettings = this._defaults['listAudienceExports'];
|
|
758
746
|
const callSettings = defaultCallSettings.merge(options);
|
|
759
|
-
this.initialize().catch(err => {
|
|
760
|
-
throw err;
|
|
761
|
-
});
|
|
747
|
+
this.initialize().catch(err => { throw err; });
|
|
762
748
|
this._log.info('listAudienceExports stream %j', request);
|
|
763
749
|
return this.descriptors.page.listAudienceExports.createStream(this.innerApiCalls.listAudienceExports, request, callSettings);
|
|
764
750
|
}
|
|
@@ -799,48 +785,45 @@ class BetaAnalyticsDataClient {
|
|
|
799
785
|
options = options || {};
|
|
800
786
|
options.otherArgs = options.otherArgs || {};
|
|
801
787
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
802
|
-
options.otherArgs.headers['x-goog-request-params'] =
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
});
|
|
788
|
+
options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
|
|
789
|
+
'parent': request.parent ?? '',
|
|
790
|
+
});
|
|
806
791
|
const defaultCallSettings = this._defaults['listAudienceExports'];
|
|
807
792
|
const callSettings = defaultCallSettings.merge(options);
|
|
808
|
-
this.initialize().catch(err => {
|
|
809
|
-
throw err;
|
|
810
|
-
});
|
|
793
|
+
this.initialize().catch(err => { throw err; });
|
|
811
794
|
this._log.info('listAudienceExports iterate %j', request);
|
|
812
795
|
return this.descriptors.page.listAudienceExports.asyncIterate(this.innerApiCalls['listAudienceExports'], request, callSettings);
|
|
813
796
|
}
|
|
814
797
|
/**
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
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
|
+
*/
|
|
844
827
|
getOperation(request, optionsOrCallback, callback) {
|
|
845
828
|
let options;
|
|
846
829
|
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
@@ -1081,7 +1064,7 @@ class BetaAnalyticsDataClient {
|
|
|
1081
1064
|
this._log.info('ending gRPC channel');
|
|
1082
1065
|
this._terminated = true;
|
|
1083
1066
|
stub.close();
|
|
1084
|
-
this.operationsClient.close();
|
|
1067
|
+
void this.operationsClient.close();
|
|
1085
1068
|
});
|
|
1086
1069
|
}
|
|
1087
1070
|
return Promise.resolve();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-analytics/data",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
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.
|
|
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": {
|