diff --git a/packages/google-cloud-mediatranslation/samples/generated/v1beta1/snippet_metadata.google.cloud.mediatranslation.v1beta1.json b/packages/google-cloud-mediatranslation/samples/generated/v1beta1/snippet_metadata.google.cloud.mediatranslation.v1beta1.json index 1ba6c0153d9..61282734805 100644 --- a/packages/google-cloud-mediatranslation/samples/generated/v1beta1/snippet_metadata.google.cloud.mediatranslation.v1beta1.json +++ b/packages/google-cloud-mediatranslation/samples/generated/v1beta1/snippet_metadata.google.cloud.mediatranslation.v1beta1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], diff --git a/packages/google-cloud-mediatranslation/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js b/packages/google-cloud-mediatranslation/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js index feaebce89e8..beab148da7e 100644 --- a/packages/google-cloud-mediatranslation/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js +++ b/packages/google-cloud-mediatranslation/samples/generated/v1beta1/speech_translation_service.streaming_translate_speech.js @@ -23,6 +23,9 @@ function main() { // [START mediatranslation_v1beta1_generated_SpeechTranslationService_StreamingTranslateSpeech_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-mediatranslation/src/v1beta1/speech_translation_service_client.ts b/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts index 679018723b0..08cec756204 100644 --- a/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts +++ b/packages/google-cloud-mediatranslation/src/v1beta1/speech_translation_service_client.ts @@ -246,7 +246,8 @@ export class SpeechTranslationServiceClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-mediatranslation/test/gapic_speech_translation_service_v1beta1.ts b/packages/google-cloud-mediatranslation/test/gapic_speech_translation_service_v1beta1.ts index a703fa613bc..4f35032bf94 100644 --- a/packages/google-cloud-mediatranslation/test/gapic_speech_translation_service_v1beta1.ts +++ b/packages/google-cloud-mediatranslation/test/gapic_speech_translation_service_v1beta1.ts @@ -51,124 +51,126 @@ function stubBidiStreamingCall( } describe('v1beta1.SpeechTranslationServiceClient', () => { - it('has servicePath', () => { - const servicePath = - speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient - .servicePath; - assert(servicePath); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient + .servicePath; + assert(servicePath); + }); - it('has apiEndpoint', () => { - const apiEndpoint = - speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient - .apiEndpoint; - assert(apiEndpoint); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); - it('has port', () => { - const port = - speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient - .port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = + speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - fallback: true, - } - ); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = + new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + fallback: true, + } + ); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.speechTranslationServiceStub, undefined); - await client.initialize(); - assert(client.speechTranslationServiceStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.speechTranslationServiceStub, undefined); + await client.initialize(); + assert(client.speechTranslationServiceStub); + }); - it('has close method for the initialized client', done => { - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - client.initialize(); - assert(client.speechTranslationServiceStub); - client.close().then(() => { - done(); + it('has close method for the initialized client', done => { + const client = + new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.speechTranslationServiceStub); + client.close().then(() => { + done(); + }); }); - }); - it('has close method for the non-initialized client', done => { - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); - assert.strictEqual(client.speechTranslationServiceStub, undefined); - client.close().then(() => { - done(); + it('has close method for the non-initialized client', done => { + const client = + new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.speechTranslationServiceStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - 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 speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + 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 speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( - { - 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 speechtranslationserviceModule.v1beta1.SpeechTranslationServiceClient( + { + 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('streamingTranslateSpeech', () => {