diff --git a/src/v1/image_annotator_client.ts b/src/v1/image_annotator_client.ts index e8e2b8ef..c543a372 100644 --- a/src/v1/image_annotator_client.ts +++ b/src/v1/image_annotator_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class ImageAnnotatorClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -58,6 +59,7 @@ export class ImageAnnotatorClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -102,6 +104,9 @@ export class ImageAnnotatorClient { const staticMembers = this.constructor as typeof ImageAnnotatorClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -222,6 +227,9 @@ export class ImageAnnotatorClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -250,7 +258,8 @@ export class ImageAnnotatorClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1.ImageAnnotator, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1/product_search_client.ts b/src/v1/product_search_client.ts index 7362a5fd..3ab1f21a 100644 --- a/src/v1/product_search_client.ts +++ b/src/v1/product_search_client.ts @@ -62,6 +62,7 @@ const version = require('../../../package.json').version; export class ProductSearchClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -73,6 +74,7 @@ export class ProductSearchClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -117,6 +119,9 @@ export class ProductSearchClient { const staticMembers = this.constructor as typeof ProductSearchClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -258,6 +263,9 @@ export class ProductSearchClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -286,7 +294,8 @@ export class ProductSearchClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1.ProductSearch, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p1beta1/image_annotator_client.ts b/src/v1p1beta1/image_annotator_client.ts index 9c6a1ccf..cbafd0a3 100644 --- a/src/v1p1beta1/image_annotator_client.ts +++ b/src/v1p1beta1/image_annotator_client.ts @@ -41,6 +41,7 @@ const version = require('../../../package.json').version; export class ImageAnnotatorClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -52,6 +53,7 @@ export class ImageAnnotatorClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; imageAnnotatorStub?: Promise<{[name: string]: Function}>; @@ -94,6 +96,9 @@ export class ImageAnnotatorClient { const staticMembers = this.constructor as typeof ImageAnnotatorClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -153,6 +158,9 @@ export class ImageAnnotatorClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -181,7 +189,8 @@ export class ImageAnnotatorClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p1beta1.ImageAnnotator, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p2beta1/image_annotator_client.ts b/src/v1p2beta1/image_annotator_client.ts index bed840f2..54a0090f 100644 --- a/src/v1p2beta1/image_annotator_client.ts +++ b/src/v1p2beta1/image_annotator_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class ImageAnnotatorClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -58,6 +59,7 @@ export class ImageAnnotatorClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; operationsClient: gax.OperationsClient; imageAnnotatorStub?: Promise<{[name: string]: Function}>; @@ -101,6 +103,9 @@ export class ImageAnnotatorClient { const staticMembers = this.constructor as typeof ImageAnnotatorClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -191,6 +196,9 @@ export class ImageAnnotatorClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -219,7 +227,8 @@ export class ImageAnnotatorClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p2beta1.ImageAnnotator, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p3beta1/image_annotator_client.ts b/src/v1p3beta1/image_annotator_client.ts index 25b22473..11b2d0c1 100644 --- a/src/v1p3beta1/image_annotator_client.ts +++ b/src/v1p3beta1/image_annotator_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class ImageAnnotatorClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -58,6 +59,7 @@ export class ImageAnnotatorClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -102,6 +104,9 @@ export class ImageAnnotatorClient { const staticMembers = this.constructor as typeof ImageAnnotatorClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -207,6 +212,9 @@ export class ImageAnnotatorClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -235,7 +243,8 @@ export class ImageAnnotatorClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p3beta1.ImageAnnotator, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p3beta1/product_search_client.ts b/src/v1p3beta1/product_search_client.ts index 34f9be8d..787adcc5 100644 --- a/src/v1p3beta1/product_search_client.ts +++ b/src/v1p3beta1/product_search_client.ts @@ -62,6 +62,7 @@ const version = require('../../../package.json').version; export class ProductSearchClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -73,6 +74,7 @@ export class ProductSearchClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -117,6 +119,9 @@ export class ProductSearchClient { const staticMembers = this.constructor as typeof ProductSearchClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -247,6 +252,9 @@ export class ProductSearchClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -275,7 +283,8 @@ export class ProductSearchClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p3beta1.ProductSearch, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p4beta1/image_annotator_client.ts b/src/v1p4beta1/image_annotator_client.ts index e091415a..8263df36 100644 --- a/src/v1p4beta1/image_annotator_client.ts +++ b/src/v1p4beta1/image_annotator_client.ts @@ -47,6 +47,7 @@ const version = require('../../../package.json').version; export class ImageAnnotatorClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -58,6 +59,7 @@ export class ImageAnnotatorClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -102,6 +104,9 @@ export class ImageAnnotatorClient { const staticMembers = this.constructor as typeof ImageAnnotatorClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -222,6 +227,9 @@ export class ImageAnnotatorClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -250,7 +258,8 @@ export class ImageAnnotatorClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p4beta1.ImageAnnotator, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/src/v1p4beta1/product_search_client.ts b/src/v1p4beta1/product_search_client.ts index 38e602eb..0bb2d629 100644 --- a/src/v1p4beta1/product_search_client.ts +++ b/src/v1p4beta1/product_search_client.ts @@ -66,6 +66,7 @@ const version = require('../../../package.json').version; export class ProductSearchClient { private _terminated = false; private _opts: ClientOptions; + private _providedCustomServicePath: boolean; private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; @@ -77,6 +78,7 @@ export class ProductSearchClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; @@ -121,6 +123,9 @@ export class ProductSearchClient { const staticMembers = this.constructor as typeof ProductSearchClient; const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; const fallback = @@ -262,6 +267,9 @@ export class ProductSearchClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -290,7 +298,8 @@ export class ProductSearchClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vision.v1p4beta1.ProductSearch, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides