@@ -39,6 +39,7 @@ const version = require('../../../package.json').version;
3939export class TextToSpeechClient {
4040 private _terminated = false ;
4141 private _opts : ClientOptions ;
42+ private _providedCustomServicePath : boolean ;
4243 private _gaxModule : typeof gax | typeof gax . fallback ;
4344 private _gaxGrpc : gax . GrpcClient | gax . fallback . GrpcClient ;
4445 private _protos : { } ;
@@ -50,6 +51,7 @@ export class TextToSpeechClient {
5051 longrunning : { } ,
5152 batching : { } ,
5253 } ;
54+ warn : ( code : string , message : string , warnType ?: string ) => void ;
5355 innerApiCalls : { [ name : string ] : Function } ;
5456 textToSpeechStub ?: Promise < { [ name : string ] : Function } > ;
5557
@@ -92,6 +94,9 @@ export class TextToSpeechClient {
9294 const staticMembers = this . constructor as typeof TextToSpeechClient ;
9395 const servicePath =
9496 opts ?. servicePath || opts ?. apiEndpoint || staticMembers . servicePath ;
97+ this . _providedCustomServicePath = ! ! (
98+ opts ?. servicePath || opts ?. apiEndpoint
99+ ) ;
95100 const port = opts ?. port || staticMembers . port ;
96101 const clientConfig = opts ?. clientConfig ?? { } ;
97102 const fallback =
@@ -151,6 +156,9 @@ export class TextToSpeechClient {
151156 // of calling the API is handled in `google-gax`, with this code
152157 // merely providing the destination and request information.
153158 this . innerApiCalls = { } ;
159+
160+ // Add a warn function to the client constructor so it can be easily tested.
161+ this . warn = gax . warn ;
154162 }
155163
156164 /**
@@ -179,7 +187,8 @@ export class TextToSpeechClient {
179187 )
180188 : // eslint-disable-next-line @typescript-eslint/no-explicit-any
181189 ( this . _protos as any ) . google . cloud . texttospeech . v1beta1 . TextToSpeech ,
182- this . _opts
190+ this . _opts ,
191+ this . _providedCustomServicePath
183192 ) as Promise < { [ method : string ] : Function } > ;
184193
185194 // Iterate over each of the methods that the service provides
0 commit comments