diff --git a/packages/google-cloud-translate/src/v3beta1/translation_service_client.js b/packages/google-cloud-translate/src/v3beta1/translation_service_client.js index ae1ef1035eb..90c8871516f 100644 --- a/packages/google-cloud-translate/src/v3beta1/translation_service_client.js +++ b/packages/google-cloud-translate/src/v3beta1/translation_service_client.js @@ -56,14 +56,18 @@ class TranslationServiceClient { * API remote host. */ constructor(opts) { + opts = opts || {}; this._descriptors = {}; + const servicePath = + opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; + // Ensure that options include the service address and port. opts = Object.assign( { clientConfig: {}, port: this.constructor.port, - servicePath: this.constructor.servicePath, + servicePath, }, opts ); @@ -231,6 +235,14 @@ class TranslationServiceClient { return 'translate.googleapis.com'; } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'translate.googleapis.com'; + } + /** * The port for this API service. */ diff --git a/packages/google-cloud-translate/synth.metadata b/packages/google-cloud-translate/synth.metadata index 88a89f706ac..da727dd0576 100644 --- a/packages/google-cloud-translate/synth.metadata +++ b/packages/google-cloud-translate/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-05-29T11:22:38.021811Z", + "updateTime": "2019-06-05T14:29:10.487929Z", "sources": [ { "generator": { "name": "artman", - "version": "0.21.0", - "dockerImage": "googleapis/artman@sha256:28d4271586772b275cd3bc95cb46bd227a24d3c9048de45dccdb7f3afb0bfba9" + "version": "0.23.1", + "dockerImage": "googleapis/artman@sha256:9d5cae1454da64ac3a87028f8ef486b04889e351c83bb95e83b8fab3959faed0" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "fa15c3006e27b87a20c7a9ffbb7bbe4149c61387", - "internalRef": "250401304" + "sha": "47c142a7cecc6efc9f6f8af804b8be55392b795b", + "internalRef": "251635729" } }, { diff --git a/packages/google-cloud-translate/test/gapic-v3beta1.js b/packages/google-cloud-translate/test/gapic-v3beta1.js index 31be4271d46..c1332cb8588 100644 --- a/packages/google-cloud-translate/test/gapic-v3beta1.js +++ b/packages/google-cloud-translate/test/gapic-v3beta1.js @@ -23,6 +23,29 @@ const error = new Error(); error.code = FAKE_STATUS_CODE; describe('TranslationServiceClient', () => { + it('has servicePath', () => { + const servicePath = + translateModule.v3beta1.TranslationServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + translateModule.v3beta1.TranslationServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = translateModule.v3beta1.TranslationServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no options', () => { + const client = new translateModule.v3beta1.TranslationServiceClient(); + assert(client); + }); + describe('translateText', () => { it('invokes translateText without error', done => { const client = new translateModule.v3beta1.TranslationServiceClient({