diff --git a/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata.google.cloud.webrisk.v1.json b/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata.google.cloud.webrisk.v1.json index dc2de91964c..48c5d7f6ff8 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata.google.cloud.webrisk.v1.json +++ b/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata.google.cloud.webrisk.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 63, + "end": 66, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -158,7 +158,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], diff --git a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.compute_threat_list_diff.js b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.compute_threat_list_diff.js index 597c7b19a7c..56f188376ad 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.compute_threat_list_diff.js +++ b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.compute_threat_list_diff.js @@ -23,6 +23,9 @@ function main(threatType, constraints) { // [START webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.create_submission.js b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.create_submission.js index 5f81d5c7314..f02867c1aca 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.create_submission.js +++ b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.create_submission.js @@ -23,6 +23,9 @@ function main(parent, submission) { // [START webrisk_v1_generated_WebRiskService_CreateSubmission_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_hashes.js b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_hashes.js index a43eb9d36ff..4b26a9347e0 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_hashes.js +++ b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_hashes.js @@ -23,6 +23,9 @@ function main(threatTypes) { // [START webrisk_v1_generated_WebRiskService_SearchHashes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_uris.js b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_uris.js index 1ca2ddfe77b..3bfd8cf6bdb 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_uris.js +++ b/packages/google-cloud-webrisk/samples/generated/v1/web_risk_service.search_uris.js @@ -23,6 +23,9 @@ function main(uri, threatTypes) { // [START webrisk_v1_generated_WebRiskService_SearchUris_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata.google.cloud.webrisk.v1beta1.json b/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata.google.cloud.webrisk.v1beta1.json index 34decea336d..3c6f6bbb2b0 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata.google.cloud.webrisk.v1beta1.json +++ b/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata.google.cloud.webrisk.v1beta1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -70,7 +70,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], @@ -114,7 +114,7 @@ "segments": [ { "start": 25, - "end": 55, + "end": 58, "type": "FULL" } ], diff --git a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js index 3c947259ea5..a595206ab85 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js +++ b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js @@ -23,6 +23,9 @@ function main(threatType, constraints) { // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js index 833229adb5b..0c13f6d0c82 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js +++ b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js @@ -23,6 +23,9 @@ function main(threatTypes) { // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js index a0b6bac424b..eaef0fcef14 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js +++ b/packages/google-cloud-webrisk/samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js @@ -23,6 +23,9 @@ function main(uri, threatTypes) { // [START webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts index 663c36787f7..21c9841004f 100644 --- a/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts +++ b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts @@ -234,7 +234,8 @@ export class WebRiskServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts index c62720e44b7..e5fd483cc86 100644 --- a/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts +++ b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts @@ -225,7 +225,8 @@ export class WebRiskServiceV1Beta1Client { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts index 8e7670a11a7..30bce996b35 100644 --- a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts +++ b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts @@ -50,101 +50,103 @@ function stubSimpleCallWithCallback( } describe('v1.WebRiskServiceClient', () => { - it('has servicePath', () => { - const servicePath = - webriskserviceModule.v1.WebRiskServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = - webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = webriskserviceModule.v1.WebRiskServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + webriskserviceModule.v1.WebRiskServiceClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = + webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = webriskserviceModule.v1.WebRiskServiceClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.webRiskServiceStub, undefined); - await client.initialize(); - assert(client.webRiskServiceStub); - }); - it('has close method for the initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + assert(client); }); - client.initialize(); - assert(client.webRiskServiceStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + await client.initialize(); + assert(client.webRiskServiceStub); }); - assert.strictEqual(client.webRiskServiceStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webRiskServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('computeThreatListDiff', () => { diff --git a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts index 7a4d20faaf3..5a69d105250 100644 --- a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts +++ b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts @@ -50,111 +50,113 @@ function stubSimpleCallWithCallback( } describe('v1beta1.WebRiskServiceV1Beta1Client', () => { - it('has servicePath', () => { - const servicePath = - webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client - .servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client - .apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - await client.initialize(); - assert(client.webRiskServiceV1Beta1Stub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + await client.initialize(); + assert(client.webRiskServiceV1Beta1Stub); + }); - it('has close method for the initialized client', done => { - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webRiskServiceV1Beta1Stub); + client.close().then(() => { + done(); }); - client.initialize(); - assert(client.webRiskServiceV1Beta1Stub); - client.close().then(() => { - done(); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + client.close().then(() => { + done(); }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - client.close().then(() => { - done(); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('computeThreatListDiff', () => {