From 8bc3e263c8d01b55efcb79a6dba3b681f3cfe26c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 23 Nov 2020 12:19:24 -0800 Subject: [PATCH] fix(browser): check for fetch on window (#501) --- .../package.json | 3 +- .../protos/protos.json | 144 ++++++++++++++++-- .../v1/video_intelligence_service_client.ts | 26 ++-- .../video_intelligence_service_client.ts | 26 ++-- .../video_intelligence_service_client.ts | 26 ++-- .../video_intelligence_service_client.ts | 26 ++-- ...aming_video_intelligence_service_client.ts | 18 ++- .../video_intelligence_service_client.ts | 26 ++-- .../synth.metadata | 14 +- .../gapic_video_intelligence_service_v1.ts | 9 -- ...apic_video_intelligence_service_v1beta2.ts | 9 -- ...ic_video_intelligence_service_v1p1beta1.ts | 9 -- ...ic_video_intelligence_service_v1p2beta1.ts | 9 -- ...ic_video_intelligence_service_v1p3beta1.ts | 9 -- 14 files changed, 244 insertions(+), 110 deletions(-) diff --git a/packages/google-cloud-videointelligence/package.json b/packages/google-cloud-videointelligence/package.json index a00fc28c477..fae1f6fc8fd 100644 --- a/packages/google-cloud-videointelligence/package.json +++ b/packages/google-cloud-videointelligence/package.json @@ -67,7 +67,6 @@ "prettier": "^2.1.2", "sinon": "^9.0.2", "ts-loader": "^8.0.0", - "typescript": "^3.8.3", - "webpack-cli": "^3.3.11" + "typescript": "^3.8.3" } } diff --git a/packages/google-cloud-videointelligence/protos/protos.json b/packages/google-cloud-videointelligence/protos/protos.json index 992dde4e349..7d0e322a1c5 100644 --- a/packages/google-cloud-videointelligence/protos/protos.json +++ b/packages/google-cloud-videointelligence/protos/protos.json @@ -32,7 +32,24 @@ "(google.api.method_signature)": "input_uri,features", "(google.longrunning.operation_info).response_type": "AnnotateVideoResponse", "(google.longrunning.operation_info).metadata_type": "AnnotateVideoProgress" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/videos:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "input_uri,features" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "AnnotateVideoResponse", + "metadata_type": "AnnotateVideoProgress" + } + } + ] } } }, @@ -964,7 +981,24 @@ "(google.api.method_signature)": "input_uri,features", "(google.longrunning.operation_info).response_type": "AnnotateVideoResponse", "(google.longrunning.operation_info).metadata_type": "AnnotateVideoProgress" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta2/videos:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "input_uri,features" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "AnnotateVideoResponse", + "metadata_type": "AnnotateVideoProgress" + } + } + ] } } }, @@ -1364,7 +1398,24 @@ "(google.api.method_signature)": "input_uri,features", "(google.longrunning.operation_info).response_type": "AnnotateVideoResponse", "(google.longrunning.operation_info).metadata_type": "AnnotateVideoProgress" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1p1beta1/videos:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "input_uri,features" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "AnnotateVideoResponse", + "metadata_type": "AnnotateVideoProgress" + } + } + ] } } }, @@ -1798,7 +1849,24 @@ "(google.api.method_signature)": "input_uri,features", "(google.longrunning.operation_info).response_type": "AnnotateVideoResponse", "(google.longrunning.operation_info).metadata_type": "AnnotateVideoProgress" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1p2beta1/videos:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "input_uri,features" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "AnnotateVideoResponse", + "metadata_type": "AnnotateVideoProgress" + } + } + ] } } }, @@ -2257,7 +2325,24 @@ "(google.api.method_signature)": "input_uri,features", "(google.longrunning.operation_info).response_type": "AnnotateVideoResponse", "(google.longrunning.operation_info).metadata_type": "AnnotateVideoProgress" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1p3beta1/videos:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "input_uri,features" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "AnnotateVideoResponse", + "metadata_type": "AnnotateVideoProgress" + } + } + ] } } }, @@ -4441,7 +4526,17 @@ "options": { "(google.api.http).get": "/v1/{name=operations}", "(google.api.method_signature)": "name,filter" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] }, "GetOperation": { "requestType": "GetOperationRequest", @@ -4449,7 +4544,17 @@ "options": { "(google.api.http).get": "/v1/{name=operations/**}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "DeleteOperation": { "requestType": "DeleteOperationRequest", @@ -4457,7 +4562,17 @@ "options": { "(google.api.http).delete": "/v1/{name=operations/**}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "CancelOperation": { "requestType": "CancelOperationRequest", @@ -4466,7 +4581,18 @@ "(google.api.http).post": "/v1/{name=operations/**}:cancel", "(google.api.http).body": "*", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "WaitOperation": { "requestType": "WaitOperationRequest", diff --git a/packages/google-cloud-videointelligence/src/v1/video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1/video_intelligence_service_client.ts index e941db337d3..bae2f4273d3 100644 --- a/packages/google-cloud-videointelligence/src/v1/video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1/video_intelligence_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1/video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './video_intelligence_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -80,9 +86,9 @@ export class VideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -96,7 +102,9 @@ export class VideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -326,7 +334,7 @@ export class VideoIntelligenceServiceClient { >; annotateVideo( request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.videointelligence.v1.IAnnotateVideoResponse, @@ -404,7 +412,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.videointelligence.v1.IAnnotateVideoResponse, @@ -432,12 +440,12 @@ export class VideoIntelligenceServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); diff --git a/packages/google-cloud-videointelligence/src/v1beta2/video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1beta2/video_intelligence_service_client.ts index c77cb7901e8..f0a07cf5c18 100644 --- a/packages/google-cloud-videointelligence/src/v1beta2/video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1beta2/video_intelligence_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1beta2/video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './video_intelligence_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -80,9 +86,9 @@ export class VideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -96,7 +102,9 @@ export class VideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1beta2.IAnnotateVideoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -326,7 +334,7 @@ export class VideoIntelligenceServiceClient { >; annotateVideo( request: protos.google.cloud.videointelligence.v1beta2.IAnnotateVideoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.videointelligence.v1beta2.IAnnotateVideoResponse, @@ -401,7 +409,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1beta2.IAnnotateVideoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.videointelligence.v1beta2.IAnnotateVideoResponse, @@ -429,12 +437,12 @@ export class VideoIntelligenceServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); diff --git a/packages/google-cloud-videointelligence/src/v1p1beta1/video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1p1beta1/video_intelligence_service_client.ts index f15cc441a83..b09080e5662 100644 --- a/packages/google-cloud-videointelligence/src/v1p1beta1/video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1p1beta1/video_intelligence_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1p1beta1/video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './video_intelligence_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -80,9 +86,9 @@ export class VideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -96,7 +102,9 @@ export class VideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p1beta1.IAnnotateVideoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -326,7 +334,7 @@ export class VideoIntelligenceServiceClient { >; annotateVideo( request: protos.google.cloud.videointelligence.v1p1beta1.IAnnotateVideoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.videointelligence.v1p1beta1.IAnnotateVideoResponse, @@ -401,7 +409,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p1beta1.IAnnotateVideoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.videointelligence.v1p1beta1.IAnnotateVideoResponse, @@ -429,12 +437,12 @@ export class VideoIntelligenceServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); diff --git a/packages/google-cloud-videointelligence/src/v1p2beta1/video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1p2beta1/video_intelligence_service_client.ts index 36e15d538ac..8605b0b30d8 100644 --- a/packages/google-cloud-videointelligence/src/v1p2beta1/video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1p2beta1/video_intelligence_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1p2beta1/video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './video_intelligence_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -80,9 +86,9 @@ export class VideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -96,7 +102,9 @@ export class VideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p2beta1.IAnnotateVideoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -326,7 +334,7 @@ export class VideoIntelligenceServiceClient { >; annotateVideo( request: protos.google.cloud.videointelligence.v1p2beta1.IAnnotateVideoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.videointelligence.v1p2beta1.IAnnotateVideoResponse, @@ -401,7 +409,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p2beta1.IAnnotateVideoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.videointelligence.v1p2beta1.IAnnotateVideoResponse, @@ -429,12 +437,12 @@ export class VideoIntelligenceServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); diff --git a/packages/google-cloud-videointelligence/src/v1p3beta1/streaming_video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1p3beta1/streaming_video_intelligence_service_client.ts index 22c2637aa98..e87a8f0b687 100644 --- a/packages/google-cloud-videointelligence/src/v1p3beta1/streaming_video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1p3beta1/streaming_video_intelligence_service_client.ts @@ -16,11 +16,17 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1p3beta1/streaming_video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './streaming_video_intelligence_service_client_config.json'; const version = require('../../../package.json').version; @@ -73,9 +79,9 @@ export class StreamingVideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -89,7 +95,9 @@ export class StreamingVideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -304,7 +312,7 @@ export class StreamingVideoIntelligenceServiceClient { * stream.write(request); * stream.end(); */ - streamingAnnotateVideo(options?: gax.CallOptions): gax.CancellableStream { + streamingAnnotateVideo(options?: CallOptions): gax.CancellableStream { this.initialize(); return this.innerApiCalls.streamingAnnotateVideo(options); } diff --git a/packages/google-cloud-videointelligence/src/v1p3beta1/video_intelligence_service_client.ts b/packages/google-cloud-videointelligence/src/v1p3beta1/video_intelligence_service_client.ts index fce52a913a3..cdf59694a82 100644 --- a/packages/google-cloud-videointelligence/src/v1p3beta1/video_intelligence_service_client.ts +++ b/packages/google-cloud-videointelligence/src/v1p3beta1/video_intelligence_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -27,6 +28,11 @@ import { import * as path from 'path'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1p3beta1/video_intelligence_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './video_intelligence_service_client_config.json'; import {operationsProtos} from 'google-gax'; const version = require('../../../package.json').version; @@ -80,9 +86,9 @@ export class VideoIntelligenceServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -96,7 +102,9 @@ export class VideoIntelligenceServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p3beta1.IAnnotateVideoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ LROperation< @@ -326,7 +334,7 @@ export class VideoIntelligenceServiceClient { >; annotateVideo( request: protos.google.cloud.videointelligence.v1p3beta1.IAnnotateVideoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< LROperation< protos.google.cloud.videointelligence.v1p3beta1.IAnnotateVideoResponse, @@ -404,7 +412,7 @@ export class VideoIntelligenceServiceClient { annotateVideo( request: protos.google.cloud.videointelligence.v1p3beta1.IAnnotateVideoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< LROperation< protos.google.cloud.videointelligence.v1p3beta1.IAnnotateVideoResponse, @@ -432,12 +440,12 @@ export class VideoIntelligenceServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); diff --git a/packages/google-cloud-videointelligence/synth.metadata b/packages/google-cloud-videointelligence/synth.metadata index 0198700d1d8..49d9e888a59 100644 --- a/packages/google-cloud-videointelligence/synth.metadata +++ b/packages/google-cloud-videointelligence/synth.metadata @@ -3,8 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-video-intelligence.git", - "sha": "78853bdb31bfd5ab192431be7104f146cd9019c6" + "remote": "https://github.com/googleapis/nodejs-video-intelligence.git", + "sha": "00e4715e30bfa33393ef501295275ec0615aa105" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "2f019bf70bfe06f1e2af1b04011b0a2405190e43", + "internalRef": "343202295" } }, { @@ -115,7 +123,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.1898363003", "protos/google/cloud/videointelligence/v1/video_intelligence.proto", "protos/google/cloud/videointelligence/v1beta2/video_intelligence.proto", "protos/google/cloud/videointelligence/v1p1beta1/video_intelligence.proto", @@ -126,7 +133,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.1526100258", "src/index.ts", "src/v1/index.ts", "src/v1/video_intelligence_service_client.ts", diff --git a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1.ts b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1.ts index 4566c9546d4..1fa231b8120 100644 --- a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1.ts +++ b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1.ts @@ -41,15 +41,6 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - function stubLongRunningCall( response?: ResponseType, callError?: Error, diff --git a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1beta2.ts b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1beta2.ts index b1bb2769fa5..40ba2118222 100644 --- a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1beta2.ts +++ b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1beta2.ts @@ -41,15 +41,6 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - function stubLongRunningCall( response?: ResponseType, callError?: Error, diff --git a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p1beta1.ts b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p1beta1.ts index fa35877752f..100f45b45b6 100644 --- a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p1beta1.ts +++ b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p1beta1.ts @@ -41,15 +41,6 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - function stubLongRunningCall( response?: ResponseType, callError?: Error, diff --git a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p2beta1.ts b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p2beta1.ts index 9e4d4c36ab9..718ca8bf20a 100644 --- a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p2beta1.ts +++ b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p2beta1.ts @@ -41,15 +41,6 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - function stubLongRunningCall( response?: ResponseType, callError?: Error, diff --git a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p3beta1.ts b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p3beta1.ts index cf7ea8523fe..88ed9a90157 100644 --- a/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p3beta1.ts +++ b/packages/google-cloud-videointelligence/test/gapic_video_intelligence_service_v1p3beta1.ts @@ -41,15 +41,6 @@ function stubSimpleCall(response?: ResponseType, error?: Error) { : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - function stubLongRunningCall( response?: ResponseType, callError?: Error,