Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit 7989746

Browse files
yoshi-automationJustinBeckwith
authored andcommitted
feat: support apiEndpoint override in client constructor (#41)
1 parent c5c449b commit 7989746

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

src/v1beta1/data_labeling_service_client.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ class DataLabelingServiceClient {
5656
constructor(opts) {
5757
this._descriptors = {};
5858

59+
const servicePath =
60+
opts.servicePath || opts.apiEndpoint || this.constructor.servicePath;
61+
5962
// Ensure that options include the service address and port.
6063
opts = Object.assign(
6164
{
6265
clientConfig: {},
6366
port: this.constructor.port,
64-
servicePath: this.constructor.servicePath,
67+
servicePath,
6568
},
6669
opts
6770
);
@@ -328,6 +331,14 @@ class DataLabelingServiceClient {
328331
return 'datalabeling.googleapis.com';
329332
}
330333

334+
/**
335+
* The DNS address for this API service - same as servicePath(),
336+
* exists for compatibility reasons.
337+
*/
338+
static get apiEndpoint() {
339+
return 'datalabeling.googleapis.com';
340+
}
341+
331342
/**
332343
* The port for this API service.
333344
*/

synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-05-21T11:11:35.488382Z",
2+
"updateTime": "2019-06-04T19:29:25.101947Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.20.0",
8-
"dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec"
7+
"version": "0.23.0",
8+
"dockerImage": "googleapis/artman@sha256:846102ebf7ea2239162deea69f64940443b4147f7c2e68d64b332416f74211ba"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160",
16-
"internalRef": "249058354"
15+
"sha": "0026f4b890ed9e2388fb0573c0727defa6f5b82e",
16+
"internalRef": "251265049"
1717
}
1818
},
1919
{

test/gapic-v1beta1.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ const error = new Error();
2323
error.code = FAKE_STATUS_CODE;
2424

2525
describe('DataLabelingServiceClient', () => {
26+
it('has servicePath', () => {
27+
const servicePath =
28+
datalabelingModule.v1beta1.DataLabelingServiceClient.servicePath;
29+
assert(servicePath);
30+
});
31+
32+
it('has apiEndpoint', () => {
33+
const apiEndpoint =
34+
datalabelingModule.v1beta1.DataLabelingServiceClient.apiEndpoint;
35+
assert(apiEndpoint);
36+
});
37+
38+
it('has port', () => {
39+
const port = datalabelingModule.v1beta1.DataLabelingServiceClient.port;
40+
assert(port);
41+
assert(typeof port === 'number');
42+
});
43+
2644
describe('createDataset', () => {
2745
it('invokes createDataset without error', done => {
2846
const client = new datalabelingModule.v1beta1.DataLabelingServiceClient({

0 commit comments

Comments
 (0)