Skip to content

Commit c9adc61

Browse files
fix: [Many APIs] await/catch promises, and update listOperationsAsync return type (#6191)
* feat: await/catch promises, and update listOperationsAsync return type PiperOrigin-RevId: 738212310 Source-Link: googleapis/googleapis@803b234 Source-Link: googleapis/googleapis-gen@4f44bd2 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LWludmVudG9yaWVzLy5Pd2xCb3QueWFtbCIsImgiOiI0ZjQ0YmQyYmFhOGRkNWE3MWNhMGNlYmRiMTY0YzNjMzQzNDFlZDg3In0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LWxmcC8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LW5vdGlmaWNhdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjRmNDRiZDJiYWE4ZGQ1YTcxY2EwY2ViZGIxNjRjM2MzNDM0MWVkODcifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXByb2R1Y3RzLy5Pd2xCb3QueWFtbCIsImgiOiI0ZjQ0YmQyYmFhOGRkNWE3MWNhMGNlYmRiMTY0YzNjMzQzNDFlZDg3In0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXByb21vdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjRmNDRiZDJiYWE4ZGQ1YTcxY2EwY2ViZGIxNjRjM2MzNDM0MWVkODcifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXF1b3RhLy5Pd2xCb3QueWFtbCIsImgiOiI0ZjQ0YmQyYmFhOGRkNWE3MWNhMGNlYmRiMTY0YzNjMzQzNDFlZDg3In0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXJlcG9ydHMvLk93bEJvdC55YW1sIiwiaCI6IjRmNDRiZDJiYWE4ZGQ1YTcxY2EwY2ViZGIxNjRjM2MzNDM0MWVkODcifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXJldmlld3MvLk93bEJvdC55YW1sIiwiaCI6IjRmNDRiZDJiYWE4ZGQ1YTcxY2EwY2ViZGIxNjRjM2MzNDM0MWVkODcifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXN0b3JhZ2UtY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXN0b3JhZ2V0cmFuc2Zlci8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLXN0cmVldHZpZXctcHVibGlzaC8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ3JhZmVhcy8uT3dsQm90LnlhbWwiLCJoIjoiNGY0NGJkMmJhYThkZDVhNzFjYTBjZWJkYjE2NGMzYzM0MzQxZWQ4NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update gax --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Sofia Leon <[email protected]>
1 parent 0eab6d4 commit c9adc61

59 files changed

Lines changed: 964 additions & 684 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-shopping-merchant-inventories/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"prelint": "cd samples; npm link ../; npm i"
4646
},
4747
"dependencies": {
48-
"google-gax": "^5.0.0-rc.0"
48+
"google-gax": "^5.0.1-rc.0"
4949
},
5050
"devDependencies": {
5151
"@types/mocha": "^10.0.10",

packages/google-shopping-merchant-inventories/samples/generated/v1beta/snippet_metadata_google.shopping.merchant.inventories.v1beta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"clientLibrary": {
33
"name": "nodejs-inventories",
4-
"version": "0.6.0",
4+
"version": "0.7.0",
55
"language": "TYPESCRIPT",
66
"apis": [
77
{

packages/google-shopping-merchant-inventories/src/v1beta/local_inventory_service_client.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ export class LocalInventoryServiceClient {
499499
this._gaxModule.routingHeader.fromParams({
500500
parent: request.parent ?? '',
501501
});
502-
this.initialize();
502+
this.initialize().catch(err => {
503+
throw err;
504+
});
503505
this._log.info('insertLocalInventory request %j', request);
504506
const wrappedCallback:
505507
| Callback<
@@ -630,7 +632,9 @@ export class LocalInventoryServiceClient {
630632
this._gaxModule.routingHeader.fromParams({
631633
name: request.name ?? '',
632634
});
633-
this.initialize();
635+
this.initialize().catch(err => {
636+
throw err;
637+
});
634638
this._log.info('deleteLocalInventory request %j', request);
635639
const wrappedCallback:
636640
| Callback<
@@ -774,7 +778,9 @@ export class LocalInventoryServiceClient {
774778
this._gaxModule.routingHeader.fromParams({
775779
parent: request.parent ?? '',
776780
});
777-
this.initialize();
781+
this.initialize().catch(err => {
782+
throw err;
783+
});
778784
const wrappedCallback:
779785
| PaginationCallback<
780786
protos.google.shopping.merchant.inventories.v1beta.IListLocalInventoriesRequest,
@@ -851,7 +857,9 @@ export class LocalInventoryServiceClient {
851857
});
852858
const defaultCallSettings = this._defaults['listLocalInventories'];
853859
const callSettings = defaultCallSettings.merge(options);
854-
this.initialize();
860+
this.initialize().catch(err => {
861+
throw err;
862+
});
855863
this._log.info('listLocalInventories stream %j', request);
856864
return this.descriptors.page.listLocalInventories.createStream(
857865
this.innerApiCalls.listLocalInventories as GaxCall,
@@ -910,7 +918,9 @@ export class LocalInventoryServiceClient {
910918
});
911919
const defaultCallSettings = this._defaults['listLocalInventories'];
912920
const callSettings = defaultCallSettings.merge(options);
913-
this.initialize();
921+
this.initialize().catch(err => {
922+
throw err;
923+
});
914924
this._log.info('listLocalInventories iterate %j', request);
915925
return this.descriptors.page.listLocalInventories.asyncIterate(
916926
this.innerApiCalls['listLocalInventories'] as GaxCall,

packages/google-shopping-merchant-inventories/src/v1beta/regional_inventory_service_client.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ export class RegionalInventoryServiceClient {
500500
this._gaxModule.routingHeader.fromParams({
501501
parent: request.parent ?? '',
502502
});
503-
this.initialize();
503+
this.initialize().catch(err => {
504+
throw err;
505+
});
504506
this._log.info('insertRegionalInventory request %j', request);
505507
const wrappedCallback:
506508
| Callback<
@@ -631,7 +633,9 @@ export class RegionalInventoryServiceClient {
631633
this._gaxModule.routingHeader.fromParams({
632634
name: request.name ?? '',
633635
});
634-
this.initialize();
636+
this.initialize().catch(err => {
637+
throw err;
638+
});
635639
this._log.info('deleteRegionalInventory request %j', request);
636640
const wrappedCallback:
637641
| Callback<
@@ -774,7 +778,9 @@ export class RegionalInventoryServiceClient {
774778
this._gaxModule.routingHeader.fromParams({
775779
parent: request.parent ?? '',
776780
});
777-
this.initialize();
781+
this.initialize().catch(err => {
782+
throw err;
783+
});
778784
const wrappedCallback:
779785
| PaginationCallback<
780786
protos.google.shopping.merchant.inventories.v1beta.IListRegionalInventoriesRequest,
@@ -850,7 +856,9 @@ export class RegionalInventoryServiceClient {
850856
});
851857
const defaultCallSettings = this._defaults['listRegionalInventories'];
852858
const callSettings = defaultCallSettings.merge(options);
853-
this.initialize();
859+
this.initialize().catch(err => {
860+
throw err;
861+
});
854862
this._log.info('listRegionalInventories stream %j', request);
855863
return this.descriptors.page.listRegionalInventories.createStream(
856864
this.innerApiCalls.listRegionalInventories as GaxCall,
@@ -908,7 +916,9 @@ export class RegionalInventoryServiceClient {
908916
});
909917
const defaultCallSettings = this._defaults['listRegionalInventories'];
910918
const callSettings = defaultCallSettings.merge(options);
911-
this.initialize();
919+
this.initialize().catch(err => {
920+
throw err;
921+
});
912922
this._log.info('listRegionalInventories iterate %j', request);
913923
return this.descriptors.page.listRegionalInventories.asyncIterate(
914924
this.innerApiCalls['listRegionalInventories'] as GaxCall,

packages/google-shopping-merchant-inventories/test/gapic_local_inventory_service_v1beta.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ describe('v1beta.LocalInventoryServiceClient', () => {
265265
credentials: {client_email: 'bogus', private_key: 'bogus'},
266266
projectId: 'bogus',
267267
});
268-
client.initialize();
268+
client.initialize().catch(err => {
269+
throw err;
270+
});
269271
assert(client.localInventoryServiceStub);
270272
client.close().then(() => {
271273
done();
@@ -328,7 +330,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
328330
credentials: {client_email: 'bogus', private_key: 'bogus'},
329331
projectId: 'bogus',
330332
});
331-
client.initialize();
333+
await client.initialize();
332334
const request = generateSampleMessage(
333335
new protos.google.shopping.merchant.inventories.v1beta.InsertLocalInventoryRequest()
334336
);
@@ -361,7 +363,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
361363
credentials: {client_email: 'bogus', private_key: 'bogus'},
362364
projectId: 'bogus',
363365
});
364-
client.initialize();
366+
await client.initialize();
365367
const request = generateSampleMessage(
366368
new protos.google.shopping.merchant.inventories.v1beta.InsertLocalInventoryRequest()
367369
);
@@ -409,7 +411,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
409411
credentials: {client_email: 'bogus', private_key: 'bogus'},
410412
projectId: 'bogus',
411413
});
412-
client.initialize();
414+
await client.initialize();
413415
const request = generateSampleMessage(
414416
new protos.google.shopping.merchant.inventories.v1beta.InsertLocalInventoryRequest()
415417
);
@@ -441,7 +443,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
441443
credentials: {client_email: 'bogus', private_key: 'bogus'},
442444
projectId: 'bogus',
443445
});
444-
client.initialize();
446+
await client.initialize();
445447
const request = generateSampleMessage(
446448
new protos.google.shopping.merchant.inventories.v1beta.InsertLocalInventoryRequest()
447449
);
@@ -463,7 +465,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
463465
credentials: {client_email: 'bogus', private_key: 'bogus'},
464466
projectId: 'bogus',
465467
});
466-
client.initialize();
468+
await client.initialize();
467469
const request = generateSampleMessage(
468470
new protos.google.shopping.merchant.inventories.v1beta.DeleteLocalInventoryRequest()
469471
);
@@ -496,7 +498,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
496498
credentials: {client_email: 'bogus', private_key: 'bogus'},
497499
projectId: 'bogus',
498500
});
499-
client.initialize();
501+
await client.initialize();
500502
const request = generateSampleMessage(
501503
new protos.google.shopping.merchant.inventories.v1beta.DeleteLocalInventoryRequest()
502504
);
@@ -544,7 +546,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
544546
credentials: {client_email: 'bogus', private_key: 'bogus'},
545547
projectId: 'bogus',
546548
});
547-
client.initialize();
549+
await client.initialize();
548550
const request = generateSampleMessage(
549551
new protos.google.shopping.merchant.inventories.v1beta.DeleteLocalInventoryRequest()
550552
);
@@ -576,7 +578,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
576578
credentials: {client_email: 'bogus', private_key: 'bogus'},
577579
projectId: 'bogus',
578580
});
579-
client.initialize();
581+
await client.initialize();
580582
const request = generateSampleMessage(
581583
new protos.google.shopping.merchant.inventories.v1beta.DeleteLocalInventoryRequest()
582584
);
@@ -598,7 +600,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
598600
credentials: {client_email: 'bogus', private_key: 'bogus'},
599601
projectId: 'bogus',
600602
});
601-
client.initialize();
603+
await client.initialize();
602604
const request = generateSampleMessage(
603605
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
604606
);
@@ -639,7 +641,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
639641
credentials: {client_email: 'bogus', private_key: 'bogus'},
640642
projectId: 'bogus',
641643
});
642-
client.initialize();
644+
await client.initialize();
643645
const request = generateSampleMessage(
644646
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
645647
);
@@ -697,7 +699,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
697699
credentials: {client_email: 'bogus', private_key: 'bogus'},
698700
projectId: 'bogus',
699701
});
700-
client.initialize();
702+
await client.initialize();
701703
const request = generateSampleMessage(
702704
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
703705
);
@@ -729,7 +731,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
729731
credentials: {client_email: 'bogus', private_key: 'bogus'},
730732
projectId: 'bogus',
731733
});
732-
client.initialize();
734+
await client.initialize();
733735
const request = generateSampleMessage(
734736
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
735737
);
@@ -793,7 +795,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
793795
credentials: {client_email: 'bogus', private_key: 'bogus'},
794796
projectId: 'bogus',
795797
});
796-
client.initialize();
798+
await client.initialize();
797799
const request = generateSampleMessage(
798800
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
799801
);
@@ -846,7 +848,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
846848
credentials: {client_email: 'bogus', private_key: 'bogus'},
847849
projectId: 'bogus',
848850
});
849-
client.initialize();
851+
await client.initialize();
850852
const request = generateSampleMessage(
851853
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
852854
);
@@ -897,7 +899,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
897899
credentials: {client_email: 'bogus', private_key: 'bogus'},
898900
projectId: 'bogus',
899901
});
900-
client.initialize();
902+
await client.initialize();
901903
const request = generateSampleMessage(
902904
new protos.google.shopping.merchant.inventories.v1beta.ListLocalInventoriesRequest()
903905
);
@@ -935,7 +937,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
935937
});
936938

937939
describe('Path templates', () => {
938-
describe('localInventory', () => {
940+
describe('localInventory', async () => {
939941
const fakePath = '/rendered/path/localInventory';
940942
const expectedParameters = {
941943
account: 'accountValue',
@@ -947,7 +949,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
947949
credentials: {client_email: 'bogus', private_key: 'bogus'},
948950
projectId: 'bogus',
949951
});
950-
client.initialize();
952+
await client.initialize();
951953
client.pathTemplates.localInventoryPathTemplate.render = sinon
952954
.stub()
953955
.returns(fakePath);
@@ -1000,7 +1002,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
10001002
});
10011003
});
10021004

1003-
describe('product', () => {
1005+
describe('product', async () => {
10041006
const fakePath = '/rendered/path/product';
10051007
const expectedParameters = {
10061008
account: 'accountValue',
@@ -1011,7 +1013,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
10111013
credentials: {client_email: 'bogus', private_key: 'bogus'},
10121014
projectId: 'bogus',
10131015
});
1014-
client.initialize();
1016+
await client.initialize();
10151017
client.pathTemplates.productPathTemplate.render = sinon
10161018
.stub()
10171019
.returns(fakePath);
@@ -1050,7 +1052,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
10501052
});
10511053
});
10521054

1053-
describe('regionalInventory', () => {
1055+
describe('regionalInventory', async () => {
10541056
const fakePath = '/rendered/path/regionalInventory';
10551057
const expectedParameters = {
10561058
account: 'accountValue',
@@ -1062,7 +1064,7 @@ describe('v1beta.LocalInventoryServiceClient', () => {
10621064
credentials: {client_email: 'bogus', private_key: 'bogus'},
10631065
projectId: 'bogus',
10641066
});
1065-
client.initialize();
1067+
await client.initialize();
10661068
client.pathTemplates.regionalInventoryPathTemplate.render = sinon
10671069
.stub()
10681070
.returns(fakePath);

0 commit comments

Comments
 (0)