@@ -47,6 +47,7 @@ const version = require('../../../package.json').version;
4747export class ImageAnnotatorClient {
4848 private _terminated = false ;
4949 private _opts : ClientOptions ;
50+ private _providedCustomServicePath : boolean ;
5051 private _gaxModule : typeof gax | typeof gax . fallback ;
5152 private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ;
5253 private _protos : { } ;
@@ -58,6 +59,7 @@ export class ImageAnnotatorClient {
5859 longrunning : { } ,
5960 batching : { } ,
6061 } ;
62+ warn : ( code : string , message : string , warnType ?: string ) => void ;
6163 innerApiCalls : { [ name : string ] : Function } ;
6264 operationsClient : gax . OperationsClient ;
6365 imageAnnotatorStub ?: Promise < { [ name : string ] : Function } > ;
@@ -101,6 +103,9 @@ export class ImageAnnotatorClient {
101103 const staticMembers = this . constructor as typeof ImageAnnotatorClient ;
102104 const servicePath =
103105 opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ;
106+ this . _providedCustomServicePath = ! ! (
107+ opts ?. servicePath || opts ?. apiEndpoint
108+ ) ;
104109 const port = opts ?. port || staticMembers . port ;
105110 const clientConfig = opts ?. clientConfig ?? { } ;
106111 const fallback =
@@ -191,6 +196,9 @@ export class ImageAnnotatorClient {
191196 // of calling the API is handled in `google-gax`, with this code
192197 // merely providing the destination and request information.
193198 this . innerApiCalls = { } ;
199+
200+ // Add a warn function to the client constructor so it can be easily tested.
201+ this . warn = gax . warn ;
194202 }
195203
196204 /**
@@ -219,7 +227,8 @@ export class ImageAnnotatorClient {
219227 )
220228 : // eslint-disable-next-line @typescript-eslint/no-explicit-any
221229 ( this . _protos as any ) . google . cloud . vision . v1p2beta1 . ImageAnnotator ,
222- this . _opts
230+ this . _opts ,
231+ this . _providedCustomServicePath
223232 ) as Promise < { [ method : string ] : Function } > ;
224233
225234 // Iterate over each of the methods that the service provides
0 commit comments