@googlemaps/fleetengine-delivery 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.DeliveryServiceClient = void 0;
21
21
  const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
22
23
  /**
23
24
  * Client JSON configuration object, loaded from
24
25
  * `src/v1/delivery_service_client_config.json`.
@@ -32,6 +33,27 @@ const version = require('../../../package.json').version;
32
33
  * @memberof v1
33
34
  */
34
35
  class DeliveryServiceClient {
36
+ _terminated = false;
37
+ _opts;
38
+ _providedCustomServicePath;
39
+ _gaxModule;
40
+ _gaxGrpc;
41
+ _protos;
42
+ _defaults;
43
+ _universeDomain;
44
+ _servicePath;
45
+ _log = google_gax_1.loggingUtils.log('fleetengine-delivery');
46
+ auth;
47
+ descriptors = {
48
+ page: {},
49
+ stream: {},
50
+ longrunning: {},
51
+ batching: {},
52
+ };
53
+ warn;
54
+ innerApiCalls;
55
+ pathTemplates;
56
+ deliveryServiceStub;
35
57
  /**
36
58
  * Construct an instance of DeliveryServiceClient.
37
59
  *
@@ -54,7 +76,7 @@ class DeliveryServiceClient {
54
76
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
55
77
  * the environment variable GCLOUD_PROJECT for your project ID. If your
56
78
  * app is running in an environment which supports
57
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
79
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
58
80
  * your project ID will be detected automatically.
59
81
  * @param {string} [options.apiEndpoint] - The domain name of the
60
82
  * API remote host.
@@ -72,32 +94,28 @@ class DeliveryServiceClient {
72
94
  * ```
73
95
  */
74
96
  constructor(opts, gaxInstance) {
75
- var _a, _b, _c, _d, _e;
76
- this._terminated = false;
77
- this.descriptors = {
78
- page: {},
79
- stream: {},
80
- longrunning: {},
81
- batching: {},
82
- };
83
97
  // Ensure that options include all the required fields.
84
98
  const staticMembers = this.constructor;
85
- if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
86
- (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
87
- (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
99
+ if (opts?.universe_domain &&
100
+ opts?.universeDomain &&
101
+ opts?.universe_domain !== opts?.universeDomain) {
88
102
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
103
  }
90
104
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
105
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
106
  : undefined;
93
107
  this._universeDomain =
94
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
108
+ opts?.universeDomain ??
109
+ opts?.universe_domain ??
110
+ universeDomainEnvVar ??
111
+ 'googleapis.com';
95
112
  this._servicePath = 'fleetengine.' + this._universeDomain;
96
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
97
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
98
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
99
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
100
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
113
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
114
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
115
+ const port = opts?.port || staticMembers.port;
116
+ const clientConfig = opts?.clientConfig ?? {};
117
+ const fallback = opts?.fallback ??
118
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
101
119
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
102
120
  // Request numeric enum values if REST transport is used.
103
121
  opts.numericEnums = true;
@@ -196,10 +214,12 @@ class DeliveryServiceClient {
196
214
  const deliveryServiceStubMethods = [
197
215
  'createDeliveryVehicle',
198
216
  'getDeliveryVehicle',
217
+ 'deleteDeliveryVehicle',
199
218
  'updateDeliveryVehicle',
200
219
  'batchCreateTasks',
201
220
  'createTask',
202
221
  'getTask',
222
+ 'deleteTask',
203
223
  'updateTask',
204
224
  'listTasks',
205
225
  'getTaskTrackingInfo',
@@ -282,7 +302,6 @@ class DeliveryServiceClient {
282
302
  return this.auth.getProjectId();
283
303
  }
284
304
  createDeliveryVehicle(request, optionsOrCallback, callback) {
285
- var _a, _b;
286
305
  request = request || {};
287
306
  let options;
288
307
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -303,7 +322,7 @@ class DeliveryServiceClient {
303
322
  .toString()
304
323
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
305
324
  if (match) {
306
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
325
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
307
326
  Object.assign(routingParameter, { provider_id: parameterValue });
308
327
  }
309
328
  }
@@ -311,10 +330,21 @@ class DeliveryServiceClient {
311
330
  options.otherArgs.headers['x-goog-request-params'] =
312
331
  this._gaxModule.routingHeader.fromParams(routingParameter);
313
332
  this.initialize();
314
- return this.innerApiCalls.createDeliveryVehicle(request, options, callback);
333
+ this._log.info('createDeliveryVehicle request %j', request);
334
+ const wrappedCallback = callback
335
+ ? (error, response, options, rawResponse) => {
336
+ this._log.info('createDeliveryVehicle response %j', response);
337
+ callback(error, response, options, rawResponse); // We verified callback above.
338
+ }
339
+ : undefined;
340
+ return this.innerApiCalls
341
+ .createDeliveryVehicle(request, options, wrappedCallback)
342
+ ?.then(([response, options, rawResponse]) => {
343
+ this._log.info('createDeliveryVehicle response %j', response);
344
+ return [response, options, rawResponse];
345
+ });
315
346
  }
316
347
  getDeliveryVehicle(request, optionsOrCallback, callback) {
317
- var _a, _b;
318
348
  request = request || {};
319
349
  let options;
320
350
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -335,7 +365,7 @@ class DeliveryServiceClient {
335
365
  .toString()
336
366
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
337
367
  if (match) {
338
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
368
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
339
369
  Object.assign(routingParameter, { provider_id: parameterValue });
340
370
  }
341
371
  }
@@ -343,10 +373,64 @@ class DeliveryServiceClient {
343
373
  options.otherArgs.headers['x-goog-request-params'] =
344
374
  this._gaxModule.routingHeader.fromParams(routingParameter);
345
375
  this.initialize();
346
- return this.innerApiCalls.getDeliveryVehicle(request, options, callback);
376
+ this._log.info('getDeliveryVehicle request %j', request);
377
+ const wrappedCallback = callback
378
+ ? (error, response, options, rawResponse) => {
379
+ this._log.info('getDeliveryVehicle response %j', response);
380
+ callback(error, response, options, rawResponse); // We verified callback above.
381
+ }
382
+ : undefined;
383
+ return this.innerApiCalls
384
+ .getDeliveryVehicle(request, options, wrappedCallback)
385
+ ?.then(([response, options, rawResponse]) => {
386
+ this._log.info('getDeliveryVehicle response %j', response);
387
+ return [response, options, rawResponse];
388
+ });
389
+ }
390
+ deleteDeliveryVehicle(request, optionsOrCallback, callback) {
391
+ request = request || {};
392
+ let options;
393
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
394
+ callback = optionsOrCallback;
395
+ options = {};
396
+ }
397
+ else {
398
+ options = optionsOrCallback;
399
+ }
400
+ options = options || {};
401
+ options.otherArgs = options.otherArgs || {};
402
+ options.otherArgs.headers = options.otherArgs.headers || {};
403
+ const routingParameter = {};
404
+ {
405
+ const fieldValue = request.name;
406
+ if (fieldValue !== undefined && fieldValue !== null) {
407
+ const match = fieldValue
408
+ .toString()
409
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
410
+ if (match) {
411
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
412
+ Object.assign(routingParameter, { provider_id: parameterValue });
413
+ }
414
+ }
415
+ }
416
+ options.otherArgs.headers['x-goog-request-params'] =
417
+ this._gaxModule.routingHeader.fromParams(routingParameter);
418
+ this.initialize();
419
+ this._log.info('deleteDeliveryVehicle request %j', request);
420
+ const wrappedCallback = callback
421
+ ? (error, response, options, rawResponse) => {
422
+ this._log.info('deleteDeliveryVehicle response %j', response);
423
+ callback(error, response, options, rawResponse); // We verified callback above.
424
+ }
425
+ : undefined;
426
+ return this.innerApiCalls
427
+ .deleteDeliveryVehicle(request, options, wrappedCallback)
428
+ ?.then(([response, options, rawResponse]) => {
429
+ this._log.info('deleteDeliveryVehicle response %j', response);
430
+ return [response, options, rawResponse];
431
+ });
347
432
  }
348
433
  updateDeliveryVehicle(request, optionsOrCallback, callback) {
349
- var _a, _b, _c;
350
434
  request = request || {};
351
435
  let options;
352
436
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -361,13 +445,13 @@ class DeliveryServiceClient {
361
445
  options.otherArgs.headers = options.otherArgs.headers || {};
362
446
  const routingParameter = {};
363
447
  {
364
- const fieldValue = (_a = request.deliveryVehicle) === null || _a === void 0 ? void 0 : _a.name;
448
+ const fieldValue = request.deliveryVehicle?.name;
365
449
  if (fieldValue !== undefined && fieldValue !== null) {
366
450
  const match = fieldValue
367
451
  .toString()
368
452
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
369
453
  if (match) {
370
- const parameterValue = (_c = (_b = match.groups) === null || _b === void 0 ? void 0 : _b['provider_id']) !== null && _c !== void 0 ? _c : fieldValue;
454
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
371
455
  Object.assign(routingParameter, { provider_id: parameterValue });
372
456
  }
373
457
  }
@@ -375,10 +459,21 @@ class DeliveryServiceClient {
375
459
  options.otherArgs.headers['x-goog-request-params'] =
376
460
  this._gaxModule.routingHeader.fromParams(routingParameter);
377
461
  this.initialize();
378
- return this.innerApiCalls.updateDeliveryVehicle(request, options, callback);
462
+ this._log.info('updateDeliveryVehicle request %j', request);
463
+ const wrappedCallback = callback
464
+ ? (error, response, options, rawResponse) => {
465
+ this._log.info('updateDeliveryVehicle response %j', response);
466
+ callback(error, response, options, rawResponse); // We verified callback above.
467
+ }
468
+ : undefined;
469
+ return this.innerApiCalls
470
+ .updateDeliveryVehicle(request, options, wrappedCallback)
471
+ ?.then(([response, options, rawResponse]) => {
472
+ this._log.info('updateDeliveryVehicle response %j', response);
473
+ return [response, options, rawResponse];
474
+ });
379
475
  }
380
476
  batchCreateTasks(request, optionsOrCallback, callback) {
381
- var _a, _b;
382
477
  request = request || {};
383
478
  let options;
384
479
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -399,7 +494,7 @@ class DeliveryServiceClient {
399
494
  .toString()
400
495
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
401
496
  if (match) {
402
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
497
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
403
498
  Object.assign(routingParameter, { provider_id: parameterValue });
404
499
  }
405
500
  }
@@ -407,10 +502,21 @@ class DeliveryServiceClient {
407
502
  options.otherArgs.headers['x-goog-request-params'] =
408
503
  this._gaxModule.routingHeader.fromParams(routingParameter);
409
504
  this.initialize();
410
- return this.innerApiCalls.batchCreateTasks(request, options, callback);
505
+ this._log.info('batchCreateTasks request %j', request);
506
+ const wrappedCallback = callback
507
+ ? (error, response, options, rawResponse) => {
508
+ this._log.info('batchCreateTasks response %j', response);
509
+ callback(error, response, options, rawResponse); // We verified callback above.
510
+ }
511
+ : undefined;
512
+ return this.innerApiCalls
513
+ .batchCreateTasks(request, options, wrappedCallback)
514
+ ?.then(([response, options, rawResponse]) => {
515
+ this._log.info('batchCreateTasks response %j', response);
516
+ return [response, options, rawResponse];
517
+ });
411
518
  }
412
519
  createTask(request, optionsOrCallback, callback) {
413
- var _a, _b;
414
520
  request = request || {};
415
521
  let options;
416
522
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -431,7 +537,7 @@ class DeliveryServiceClient {
431
537
  .toString()
432
538
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
433
539
  if (match) {
434
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
540
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
435
541
  Object.assign(routingParameter, { provider_id: parameterValue });
436
542
  }
437
543
  }
@@ -439,10 +545,21 @@ class DeliveryServiceClient {
439
545
  options.otherArgs.headers['x-goog-request-params'] =
440
546
  this._gaxModule.routingHeader.fromParams(routingParameter);
441
547
  this.initialize();
442
- return this.innerApiCalls.createTask(request, options, callback);
548
+ this._log.info('createTask request %j', request);
549
+ const wrappedCallback = callback
550
+ ? (error, response, options, rawResponse) => {
551
+ this._log.info('createTask response %j', response);
552
+ callback(error, response, options, rawResponse); // We verified callback above.
553
+ }
554
+ : undefined;
555
+ return this.innerApiCalls
556
+ .createTask(request, options, wrappedCallback)
557
+ ?.then(([response, options, rawResponse]) => {
558
+ this._log.info('createTask response %j', response);
559
+ return [response, options, rawResponse];
560
+ });
443
561
  }
444
562
  getTask(request, optionsOrCallback, callback) {
445
- var _a, _b;
446
563
  request = request || {};
447
564
  let options;
448
565
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -463,7 +580,7 @@ class DeliveryServiceClient {
463
580
  .toString()
464
581
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
465
582
  if (match) {
466
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
583
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
467
584
  Object.assign(routingParameter, { provider_id: parameterValue });
468
585
  }
469
586
  }
@@ -471,10 +588,64 @@ class DeliveryServiceClient {
471
588
  options.otherArgs.headers['x-goog-request-params'] =
472
589
  this._gaxModule.routingHeader.fromParams(routingParameter);
473
590
  this.initialize();
474
- return this.innerApiCalls.getTask(request, options, callback);
591
+ this._log.info('getTask request %j', request);
592
+ const wrappedCallback = callback
593
+ ? (error, response, options, rawResponse) => {
594
+ this._log.info('getTask response %j', response);
595
+ callback(error, response, options, rawResponse); // We verified callback above.
596
+ }
597
+ : undefined;
598
+ return this.innerApiCalls
599
+ .getTask(request, options, wrappedCallback)
600
+ ?.then(([response, options, rawResponse]) => {
601
+ this._log.info('getTask response %j', response);
602
+ return [response, options, rawResponse];
603
+ });
604
+ }
605
+ deleteTask(request, optionsOrCallback, callback) {
606
+ request = request || {};
607
+ let options;
608
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
609
+ callback = optionsOrCallback;
610
+ options = {};
611
+ }
612
+ else {
613
+ options = optionsOrCallback;
614
+ }
615
+ options = options || {};
616
+ options.otherArgs = options.otherArgs || {};
617
+ options.otherArgs.headers = options.otherArgs.headers || {};
618
+ const routingParameter = {};
619
+ {
620
+ const fieldValue = request.name;
621
+ if (fieldValue !== undefined && fieldValue !== null) {
622
+ const match = fieldValue
623
+ .toString()
624
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
625
+ if (match) {
626
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
627
+ Object.assign(routingParameter, { provider_id: parameterValue });
628
+ }
629
+ }
630
+ }
631
+ options.otherArgs.headers['x-goog-request-params'] =
632
+ this._gaxModule.routingHeader.fromParams(routingParameter);
633
+ this.initialize();
634
+ this._log.info('deleteTask request %j', request);
635
+ const wrappedCallback = callback
636
+ ? (error, response, options, rawResponse) => {
637
+ this._log.info('deleteTask response %j', response);
638
+ callback(error, response, options, rawResponse); // We verified callback above.
639
+ }
640
+ : undefined;
641
+ return this.innerApiCalls
642
+ .deleteTask(request, options, wrappedCallback)
643
+ ?.then(([response, options, rawResponse]) => {
644
+ this._log.info('deleteTask response %j', response);
645
+ return [response, options, rawResponse];
646
+ });
475
647
  }
476
648
  updateTask(request, optionsOrCallback, callback) {
477
- var _a, _b, _c;
478
649
  request = request || {};
479
650
  let options;
480
651
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -489,13 +660,13 @@ class DeliveryServiceClient {
489
660
  options.otherArgs.headers = options.otherArgs.headers || {};
490
661
  const routingParameter = {};
491
662
  {
492
- const fieldValue = (_a = request.task) === null || _a === void 0 ? void 0 : _a.name;
663
+ const fieldValue = request.task?.name;
493
664
  if (fieldValue !== undefined && fieldValue !== null) {
494
665
  const match = fieldValue
495
666
  .toString()
496
667
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
497
668
  if (match) {
498
- const parameterValue = (_c = (_b = match.groups) === null || _b === void 0 ? void 0 : _b['provider_id']) !== null && _c !== void 0 ? _c : fieldValue;
669
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
499
670
  Object.assign(routingParameter, { provider_id: parameterValue });
500
671
  }
501
672
  }
@@ -503,10 +674,21 @@ class DeliveryServiceClient {
503
674
  options.otherArgs.headers['x-goog-request-params'] =
504
675
  this._gaxModule.routingHeader.fromParams(routingParameter);
505
676
  this.initialize();
506
- return this.innerApiCalls.updateTask(request, options, callback);
677
+ this._log.info('updateTask request %j', request);
678
+ const wrappedCallback = callback
679
+ ? (error, response, options, rawResponse) => {
680
+ this._log.info('updateTask response %j', response);
681
+ callback(error, response, options, rawResponse); // We verified callback above.
682
+ }
683
+ : undefined;
684
+ return this.innerApiCalls
685
+ .updateTask(request, options, wrappedCallback)
686
+ ?.then(([response, options, rawResponse]) => {
687
+ this._log.info('updateTask response %j', response);
688
+ return [response, options, rawResponse];
689
+ });
507
690
  }
508
691
  getTaskTrackingInfo(request, optionsOrCallback, callback) {
509
- var _a, _b;
510
692
  request = request || {};
511
693
  let options;
512
694
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -527,7 +709,7 @@ class DeliveryServiceClient {
527
709
  .toString()
528
710
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
529
711
  if (match) {
530
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
712
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
531
713
  Object.assign(routingParameter, { provider_id: parameterValue });
532
714
  }
533
715
  }
@@ -535,10 +717,21 @@ class DeliveryServiceClient {
535
717
  options.otherArgs.headers['x-goog-request-params'] =
536
718
  this._gaxModule.routingHeader.fromParams(routingParameter);
537
719
  this.initialize();
538
- return this.innerApiCalls.getTaskTrackingInfo(request, options, callback);
720
+ this._log.info('getTaskTrackingInfo request %j', request);
721
+ const wrappedCallback = callback
722
+ ? (error, response, options, rawResponse) => {
723
+ this._log.info('getTaskTrackingInfo response %j', response);
724
+ callback(error, response, options, rawResponse); // We verified callback above.
725
+ }
726
+ : undefined;
727
+ return this.innerApiCalls
728
+ .getTaskTrackingInfo(request, options, wrappedCallback)
729
+ ?.then(([response, options, rawResponse]) => {
730
+ this._log.info('getTaskTrackingInfo response %j', response);
731
+ return [response, options, rawResponse];
732
+ });
539
733
  }
540
734
  listTasks(request, optionsOrCallback, callback) {
541
- var _a, _b;
542
735
  request = request || {};
543
736
  let options;
544
737
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -559,7 +752,7 @@ class DeliveryServiceClient {
559
752
  .toString()
560
753
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
561
754
  if (match) {
562
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
755
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
563
756
  Object.assign(routingParameter, { provider_id: parameterValue });
564
757
  }
565
758
  }
@@ -567,10 +760,22 @@ class DeliveryServiceClient {
567
760
  options.otherArgs.headers['x-goog-request-params'] =
568
761
  this._gaxModule.routingHeader.fromParams(routingParameter);
569
762
  this.initialize();
570
- return this.innerApiCalls.listTasks(request, options, callback);
763
+ const wrappedCallback = callback
764
+ ? (error, values, nextPageRequest, rawResponse) => {
765
+ this._log.info('listTasks values %j', values);
766
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
767
+ }
768
+ : undefined;
769
+ this._log.info('listTasks request %j', request);
770
+ return this.innerApiCalls
771
+ .listTasks(request, options, wrappedCallback)
772
+ ?.then(([response, input, output]) => {
773
+ this._log.info('listTasks values %j', response);
774
+ return [response, input, output];
775
+ });
571
776
  }
572
777
  /**
573
- * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
778
+ * Equivalent to `listTasks`, but returns a NodeJS Stream object.
574
779
  * @param {Object} request
575
780
  * The request object that will be sent.
576
781
  * @param {maps.fleetengine.delivery.v1.DeliveryRequestHeader} [request.header]
@@ -607,7 +812,6 @@ class DeliveryServiceClient {
607
812
  * for more details and examples.
608
813
  */
609
814
  listTasksStream(request, options) {
610
- var _a, _b;
611
815
  request = request || {};
612
816
  options = options || {};
613
817
  options.otherArgs = options.otherArgs || {};
@@ -620,7 +824,7 @@ class DeliveryServiceClient {
620
824
  .toString()
621
825
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
622
826
  if (match) {
623
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
827
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
624
828
  Object.assign(routingParameter, { provider_id: parameterValue });
625
829
  }
626
830
  }
@@ -630,6 +834,7 @@ class DeliveryServiceClient {
630
834
  const defaultCallSettings = this._defaults['listTasks'];
631
835
  const callSettings = defaultCallSettings.merge(options);
632
836
  this.initialize();
837
+ this._log.info('listTasks stream %j', request);
633
838
  return this.descriptors.page.listTasks.createStream(this.innerApiCalls.listTasks, request, callSettings);
634
839
  }
635
840
  /**
@@ -673,7 +878,6 @@ class DeliveryServiceClient {
673
878
  * region_tag:fleetengine_v1_generated_DeliveryService_ListTasks_async
674
879
  */
675
880
  listTasksAsync(request, options) {
676
- var _a, _b;
677
881
  request = request || {};
678
882
  options = options || {};
679
883
  options.otherArgs = options.otherArgs || {};
@@ -686,7 +890,7 @@ class DeliveryServiceClient {
686
890
  .toString()
687
891
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
688
892
  if (match) {
689
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
893
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
690
894
  Object.assign(routingParameter, { provider_id: parameterValue });
691
895
  }
692
896
  }
@@ -696,10 +900,10 @@ class DeliveryServiceClient {
696
900
  const defaultCallSettings = this._defaults['listTasks'];
697
901
  const callSettings = defaultCallSettings.merge(options);
698
902
  this.initialize();
903
+ this._log.info('listTasks iterate %j', request);
699
904
  return this.descriptors.page.listTasks.asyncIterate(this.innerApiCalls['listTasks'], request, callSettings);
700
905
  }
701
906
  listDeliveryVehicles(request, optionsOrCallback, callback) {
702
- var _a, _b;
703
907
  request = request || {};
704
908
  let options;
705
909
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -720,7 +924,7 @@ class DeliveryServiceClient {
720
924
  .toString()
721
925
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
722
926
  if (match) {
723
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
927
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
724
928
  Object.assign(routingParameter, { provider_id: parameterValue });
725
929
  }
726
930
  }
@@ -728,10 +932,22 @@ class DeliveryServiceClient {
728
932
  options.otherArgs.headers['x-goog-request-params'] =
729
933
  this._gaxModule.routingHeader.fromParams(routingParameter);
730
934
  this.initialize();
731
- return this.innerApiCalls.listDeliveryVehicles(request, options, callback);
935
+ const wrappedCallback = callback
936
+ ? (error, values, nextPageRequest, rawResponse) => {
937
+ this._log.info('listDeliveryVehicles values %j', values);
938
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
939
+ }
940
+ : undefined;
941
+ this._log.info('listDeliveryVehicles request %j', request);
942
+ return this.innerApiCalls
943
+ .listDeliveryVehicles(request, options, wrappedCallback)
944
+ ?.then(([response, input, output]) => {
945
+ this._log.info('listDeliveryVehicles values %j', response);
946
+ return [response, input, output];
947
+ });
732
948
  }
733
949
  /**
734
- * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
950
+ * Equivalent to `listDeliveryVehicles`, but returns a NodeJS Stream object.
735
951
  * @param {Object} request
736
952
  * The request object that will be sent.
737
953
  * @param {maps.fleetengine.delivery.v1.DeliveryRequestHeader} [request.header]
@@ -784,7 +1000,6 @@ class DeliveryServiceClient {
784
1000
  * for more details and examples.
785
1001
  */
786
1002
  listDeliveryVehiclesStream(request, options) {
787
- var _a, _b;
788
1003
  request = request || {};
789
1004
  options = options || {};
790
1005
  options.otherArgs = options.otherArgs || {};
@@ -797,7 +1012,7 @@ class DeliveryServiceClient {
797
1012
  .toString()
798
1013
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
799
1014
  if (match) {
800
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
1015
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
801
1016
  Object.assign(routingParameter, { provider_id: parameterValue });
802
1017
  }
803
1018
  }
@@ -807,6 +1022,7 @@ class DeliveryServiceClient {
807
1022
  const defaultCallSettings = this._defaults['listDeliveryVehicles'];
808
1023
  const callSettings = defaultCallSettings.merge(options);
809
1024
  this.initialize();
1025
+ this._log.info('listDeliveryVehicles stream %j', request);
810
1026
  return this.descriptors.page.listDeliveryVehicles.createStream(this.innerApiCalls.listDeliveryVehicles, request, callSettings);
811
1027
  }
812
1028
  /**
@@ -866,7 +1082,6 @@ class DeliveryServiceClient {
866
1082
  * region_tag:fleetengine_v1_generated_DeliveryService_ListDeliveryVehicles_async
867
1083
  */
868
1084
  listDeliveryVehiclesAsync(request, options) {
869
- var _a, _b;
870
1085
  request = request || {};
871
1086
  options = options || {};
872
1087
  options.otherArgs = options.otherArgs || {};
@@ -879,7 +1094,7 @@ class DeliveryServiceClient {
879
1094
  .toString()
880
1095
  .match(RegExp('(?<provider_id>providers/[^/]+)'));
881
1096
  if (match) {
882
- const parameterValue = (_b = (_a = match.groups) === null || _a === void 0 ? void 0 : _a['provider_id']) !== null && _b !== void 0 ? _b : fieldValue;
1097
+ const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
883
1098
  Object.assign(routingParameter, { provider_id: parameterValue });
884
1099
  }
885
1100
  }
@@ -889,6 +1104,7 @@ class DeliveryServiceClient {
889
1104
  const defaultCallSettings = this._defaults['listDeliveryVehicles'];
890
1105
  const callSettings = defaultCallSettings.merge(options);
891
1106
  this.initialize();
1107
+ this._log.info('listDeliveryVehicles iterate %j', request);
892
1108
  return this.descriptors.page.listDeliveryVehicles.asyncIterate(this.innerApiCalls['listDeliveryVehicles'], request, callSettings);
893
1109
  }
894
1110
  // --------------------
@@ -1023,6 +1239,7 @@ class DeliveryServiceClient {
1023
1239
  close() {
1024
1240
  if (this.deliveryServiceStub && !this._terminated) {
1025
1241
  return this.deliveryServiceStub.then(stub => {
1242
+ this._log.info('ending gRPC channel');
1026
1243
  this._terminated = true;
1027
1244
  stub.close();
1028
1245
  });