From e1cba421ce420a23062b244df2cfc98008d4bada Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Mon, 8 May 2017 15:05:18 -0700 Subject: [PATCH 01/13] Add video intelligence GAPIC-only release. --- packages/video-intelligence/package.json | 27 ++ packages/video-intelligence/src/index.js | 27 ++ .../video-intelligence/src/v1beta1/index.js | 34 +++ .../video_intelligence_service_client.js | 286 ++++++++++++++++++ ...eo_intelligence_service_client_config.json | 33 ++ .../video-intelligence/test/test_v1beta1.js | 110 +++++++ 6 files changed, 517 insertions(+) create mode 100644 packages/video-intelligence/package.json create mode 100644 packages/video-intelligence/src/index.js create mode 100644 packages/video-intelligence/src/v1beta1/index.js create mode 100644 packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js create mode 100644 packages/video-intelligence/src/v1beta1/video_intelligence_service_client_config.json create mode 100644 packages/video-intelligence/test/test_v1beta1.js diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json new file mode 100644 index 00000000000..c325f070c94 --- /dev/null +++ b/packages/video-intelligence/package.json @@ -0,0 +1,27 @@ +{ + "url": "https://github.com/googleapis/googleapis", + "name": "@google-cloud/video-intelligence", + "version": "0.7.1", + "author": "Google Inc", + "description": "Google Cloud Video Intelligence API client for Node.js", + "main": "src/index.js", + "files": [ + "src" + ], + "dependencies": { + "google-proto-files": "^0.8.6", + "google-gax": "^0.12.2", + "extend": "^3.0.0" + }, + "devDependencies": { + "mocha": "3.2.0", + "through2": "2.0.3" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=4.0.0" + }, + "scripts": { + "test": "mocha" + } +} diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js new file mode 100644 index 00000000000..a82682def28 --- /dev/null +++ b/packages/video-intelligence/src/index.js @@ -0,0 +1,27 @@ +/* + * Copyright 2016 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +// Include each version packaged with this module. +var v1beta1 = require('./v1beta1'); + +// The default export should be the latest version. +// Assign all versions as version properties on the default. +var default_ = v1beta1; +default_.v1beta1 = v1beta1; + +// Export +module.exports = default_; diff --git a/packages/video-intelligence/src/v1beta1/index.js b/packages/video-intelligence/src/v1beta1/index.js new file mode 100644 index 00000000000..8d804acbf19 --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/index.js @@ -0,0 +1,34 @@ +/* + * Copyright 2016 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +var videoIntelligenceServiceClient = require('./video_intelligence_service_client'); +var gax = require('google-gax'); +var extend = require('extend'); + +function v1beta1(options) { + options = extend({ + scopes: v1beta1.ALL_SCOPES + }, options); + var gaxGrpc = gax.grpc(options); + return videoIntelligenceServiceClient(gaxGrpc); +} + +v1beta1.GAPIC_VERSION = '0.7.1'; +v1beta1.SERVICE_ADDRESS = videoIntelligenceServiceClient.SERVICE_ADDRESS; +v1beta1.ALL_SCOPES = videoIntelligenceServiceClient.ALL_SCOPES; + +module.exports = v1beta1; diff --git a/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js new file mode 100644 index 00000000000..52ee95379f5 --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js @@ -0,0 +1,286 @@ +/* + * Copyright 2017, Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * EDITING INSTRUCTIONS + * This file was generated from the file + * https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto, + * and updates to that file get reflected here through a refresh process. + * For the short term, the refresh process will only be runnable by Google + * engineers. + * + * The only allowed edits are to method and file documentation. A 3-way + * merge preserves those additions if the generated source changes. + */ +/* TODO: introduce line-wrapping so that it never exceeds the limit. */ +/* jscs: disable maximumLineLength */ +'use strict'; + +var configData = require('./video_intelligence_service_client_config'); +var extend = require('extend'); +var gax = require('google-gax'); + +var SERVICE_ADDRESS = 'videointelligence.googleapis.com'; + +var DEFAULT_SERVICE_PORT = 443; + +var CODE_GEN_NAME_VERSION = 'gapic/0.7.1'; + +/** + * The scopes needed to make gRPC calls to all of the methods defined in + * this service. + */ +var ALL_SCOPES = [ + 'https://www.googleapis.com/auth/cloud-platform' +]; + +/** + * Service that implements Google Cloud Video Intelligence API. + * + * This will be created through a builder function which can be obtained by the module. + * See the following example of how to initialize the module and how to access to the builder. + * @see {@link videoIntelligenceServiceClient} + * + * @example + * var videointelligenceV1beta1 = require('@google-cloud/videointelligence').v1beta1({ + * // optional auth parameters. + * }); + * var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + * + * @class + */ +function VideoIntelligenceServiceClient(gaxGrpc, grpcClients, opts) { + opts = extend({ + servicePath: SERVICE_ADDRESS, + port: DEFAULT_SERVICE_PORT, + clientConfig: {} + }, opts); + + var googleApiClient = [ + 'gl-node/' + process.versions.node + ]; + if (opts.libName && opts.libVersion) { + googleApiClient.push(opts.libName + '/' + opts.libVersion); + } + googleApiClient.push( + CODE_GEN_NAME_VERSION, + 'gax/' + gax.version, + 'grpc/' + gaxGrpc.grpcVersion + ); + + this.operationsClient = new gax.lro({ + auth: gaxGrpc.auth, + grpc: gaxGrpc.grpc + }).operationsClient(opts); + + this.longrunningDescriptors = { + annotateVideo: new gax.LongrunningDescriptor( + this.operationsClient, + grpcClients.google.cloud.videointelligence.v1beta1.AnnotateVideoResponse.decode, + grpcClients.google.cloud.videointelligence.v1beta1.AnnotateVideoProgress.decode) + }; + + var defaults = gaxGrpc.constructSettings( + 'google.cloud.videointelligence.v1beta1.VideoIntelligenceService', + configData, + opts.clientConfig, + {'x-goog-api-client': googleApiClient.join(' ')}); + + var self = this; + + this.auth = gaxGrpc.auth; + var videoIntelligenceServiceStub = gaxGrpc.createStub( + grpcClients.google.cloud.videointelligence.v1beta1.VideoIntelligenceService, + opts); + var videoIntelligenceServiceStubMethods = [ + 'annotateVideo' + ]; + videoIntelligenceServiceStubMethods.forEach(function(methodName) { + self['_' + methodName] = gax.createApiCall( + videoIntelligenceServiceStub.then(function(videoIntelligenceServiceStub) { + return function() { + var args = Array.prototype.slice.call(arguments, 0); + return videoIntelligenceServiceStub[methodName].apply(videoIntelligenceServiceStub, args); + }; + }), + defaults[methodName], + self.longrunningDescriptors[methodName]); + }); +} + + +/** + * Get the project ID used by this class. + * @param {function(Error, string)} callback - the callback to be called with + * the current project Id. + */ +VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) { + return this.auth.getProjectId(callback); +}; + +// Service calls + +/** + * Performs asynchronous video annotation. Progress and results can be + * retrieved through the `google.longrunning.Operations` interface. + * `Operation.metadata` contains `AnnotateVideoProgress` (progress). + * `Operation.response` contains `AnnotateVideoResponse` (results). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.inputUri + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * {@link google.rpc.Code.INVALID_ARGUMENT}). For more information, see + * [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + * A video URI may include wildcards in `object-id`, and thus identify + * multiple videos. Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * @param {number[]} request.features + * Requested video annotation features. + * + * The number should be among the values of [Feature]{@link Feature} + * @param {string=} request.inputContent + * The video data bytes. Encoding: base64. If unset, the input video(s) + * should be specified via `input_uri`. If set, `input_uri` should be unset. + * @param {Object=} request.videoContext + * Additional video context and/or feature-specific parameters. + * + * This object should have the same structure as [VideoContext]{@link VideoContext} + * @param {string=} request.outputUri + * Optional location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * {@link google.rpc.Code.INVALID_ARGUMENT}). For more information, see + * [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + * @param {string=} request.locationId + * Optional cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/Operation} object. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + * var inputUri = ''; + * var features = []; + * var request = { + * inputUri: inputUri, + * features: features + * }; + * + * // Handle the operation using the promise pattern. + * client.annotateVideo(request).then(function(responses) { + * var operation = responses[0]; + * var initialApiResponse = responses[1]; + * + * // Operation#promise starts polling for the completion of the LRO. + * return operation.promise(); + * }).then(function(responses) { + * // The final result of the operation. + * var result = responses[0]; + * + * // The metadata value of the completed operation. + * var metadata = responses[1]; + * + * // The response of the api call returning the complete operation. + * var finalApiResponse = responses[2]; + * }).catch(function(err) { + * console.error(err); + * }); + * + * // Handle the operation using the event emitter pattern. + * client.annotateVideo(request).then(function(responses) { + * var operation = responses[0]; + * var initialApiResponse = responses[1]; + * + * // Adding a listener for the "complete" event starts polling for the + * // completion of the operation. + * operation.on('complete', function(result, metadata, finalApiResponse) { + * // doSomethingWith(result); + * }); + * + * // Adding a listener for the "progress" event causes the callback to be + * // called on any change in metadata when the operation is polled. + * operation.on('progress', function(metadata, apiResponse) { + * // doSomethingWith(metadata) + * }) + * + * // Adding a listener for the "error" event handles any errors found during polling. + * operation.on('error', function(err) { + * // throw(err); + * }) + * }).catch(function(err) { + * console.error(err); + * }); + */ +VideoIntelligenceServiceClient.prototype.annotateVideo = function(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + if (options === undefined) { + options = {}; + } + + return this._annotateVideo(request, options, callback); +}; + +function VideoIntelligenceServiceClientBuilder(gaxGrpc) { + if (!(this instanceof VideoIntelligenceServiceClientBuilder)) { + return new VideoIntelligenceServiceClientBuilder(gaxGrpc); + } + + var videoIntelligenceServiceClient = gaxGrpc.load([{ + root: require('google-proto-files')('..'), + file: 'google/cloud/videointelligence/v1beta1/video_intelligence.proto' + }]); + extend(this, videoIntelligenceServiceClient.google.cloud.videointelligence.v1beta1); + + + /** + * Build a new instance of {@link VideoIntelligenceServiceClient}. + * + * @param {Object=} opts - The optional parameters. + * @param {String=} opts.servicePath + * The domain name of the API remote host. + * @param {number=} opts.port + * The port on which to connect to the remote host. + * @param {grpc.ClientCredentials=} opts.sslCreds + * A ClientCredentials for use with an SSL-enabled channel. + * @param {Object=} opts.clientConfig + * The customized config to build the call settings. See + * {@link gax.constructSettings} for the format. + */ + this.videoIntelligenceServiceClient = function(opts) { + return new VideoIntelligenceServiceClient(gaxGrpc, videoIntelligenceServiceClient, opts); + }; + extend(this.videoIntelligenceServiceClient, VideoIntelligenceServiceClient); +} +module.exports = VideoIntelligenceServiceClientBuilder; +module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS; +module.exports.ALL_SCOPES = ALL_SCOPES; diff --git a/packages/video-intelligence/src/v1beta1/video_intelligence_service_client_config.json b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client_config.json new file mode 100644 index 00000000000..7dd61bbb7b5 --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client_config.json @@ -0,0 +1,33 @@ +{ + "interfaces": { + "google.cloud.videointelligence.v1beta1.VideoIntelligenceService": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2.5, + "max_retry_delay_millis": 120000, + "initial_rpc_timeout_millis": 120000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 120000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AnnotateVideo": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/video-intelligence/test/test_v1beta1.js b/packages/video-intelligence/test/test_v1beta1.js new file mode 100644 index 00000000000..ed3b79f936f --- /dev/null +++ b/packages/video-intelligence/test/test_v1beta1.js @@ -0,0 +1,110 @@ +/* + * Copyright 2016 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var assert = require('assert'); +var videointelligenceV1beta1 = require('../src/').v1beta1(); + +var FAKE_STATUS_CODE = 1; +var error = new Error(); +error.code = FAKE_STATUS_CODE; + +describe('VideoIntelligenceServiceClient', function() { + describe('annotateVideo', function() { + it('invokes annotateVideo without error', function(done) { + var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + // Mock request + var inputUri = 'inputUri1707300727'; + var features = []; + var request = { + inputUri : inputUri, + features : features + }; + + // Mock response + var expectedResponse = {}; + + // Mock Grpc layer + client._annotateVideo = mockLongRunningGrpcMethod(request, expectedResponse); + + client.annotateVideo(request).then(function(responses) { + var operation = responses[0]; + return operation.promise(); + }).then(function(responses) { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }).catch(function(err) { + done(err); + }); + }); + + it('invokes annotateVideo with error', function(done) { + var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + // Mock request + var inputUri = 'inputUri1707300727'; + var features = []; + var request = { + inputUri : inputUri, + features : features + }; + + // Mock Grpc layer + client._annotateVideo = mockLongRunningGrpcMethod(request, null, error); + + client.annotateVideo(request).then(function(responses) { + var operation = responses[0]; + return operation.promise(); + }).then(function(responses) { + assert.fail(); + }).catch(function(err) { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + +}); + +function mockSimpleGrpcMethod(expectedRequest, response, error) { + return function(actualRequest, options, callback) { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} + +function mockLongRunningGrpcMethod(expectedRequest, response, error) { + return function(request) { + assert.deepStrictEqual(request, expectedRequest); + var mockOperation = { + promise: function() { + return new Promise(function(resolve, reject) { + if (error) { + reject(error) + } else { + resolve([response]); + } + }); + } + }; + return Promise.resolve([mockOperation]); + }; +} From 38d576a69a635ae61e28de3e35724ac5f3881d20 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Fri, 12 May 2017 09:43:43 -0700 Subject: [PATCH 02/13] Make video intelligence GAPIC-only conform to Vision semi-GAPIC idioms. --- packages/video-intelligence/package.json | 2 +- packages/video-intelligence/src/index.js | 44 +++++++++++++++---- .../{test_v1beta1.js => gapic-v1beta1.js} | 2 +- 3 files changed, 38 insertions(+), 10 deletions(-) rename packages/video-intelligence/test/{test_v1beta1.js => gapic-v1beta1.js} (98%) diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index c325f070c94..8c8479ff28d 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -1,7 +1,7 @@ { "url": "https://github.com/googleapis/googleapis", "name": "@google-cloud/video-intelligence", - "version": "0.7.1", + "version": "0.1.0", "author": "Google Inc", "description": "Google Cloud Video Intelligence API client for Node.js", "main": "src/index.js", diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index a82682def28..11caaf2ec26 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -13,15 +13,43 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -// Include each version packaged with this module. -var v1beta1 = require('./v1beta1'); + 'use strict'; + + var gapic = { + v1beta1: require('./v1beta1'), + }; + + const VERSION = require('../package.json').version; + + + /** + * Create an imageAnnotatorClient with additional helpers for common + * tasks. + * + * @param {Object=} opts - The optional parameters. + * @param {String=} opts.servicePath + * The domain name of the API remote host. + * @param {number=} opts.port + * The port on which to connect to the remote host. + * @param {grpc.ClientCredentials=} opts.sslCreds + * A ClientCredentials for use with an SSL-enabled channel. + * @param {Object=} opts.clientConfig + * The customized config to build the call settings. See + * {@link gax.constructSettings} for the format. + */ + function videointelligence_v1beta1(opts) { + // Define the header options. + opts = opts || {}; + opts.libName = 'gccl'; + opts.libVersion = VERSION; + + // Create the image annotator client with the provided options. + var client = gapic.v1beta1(opts).videoIntelligenceServiceClient(opts); + return client; + } // The default export should be the latest version. // Assign all versions as version properties on the default. -var default_ = v1beta1; -default_.v1beta1 = v1beta1; - -// Export -module.exports = default_; +module.exports = videointelligence_v1beta1; +module.exports.v1beta1 = videointelligence_v1beta1; diff --git a/packages/video-intelligence/test/test_v1beta1.js b/packages/video-intelligence/test/gapic-v1beta1.js similarity index 98% rename from packages/video-intelligence/test/test_v1beta1.js rename to packages/video-intelligence/test/gapic-v1beta1.js index ed3b79f936f..c3501705780 100644 --- a/packages/video-intelligence/test/test_v1beta1.js +++ b/packages/video-intelligence/test/gapic-v1beta1.js @@ -15,7 +15,7 @@ */ var assert = require('assert'); -var videointelligenceV1beta1 = require('../src/').v1beta1(); +var videointelligenceV1beta1 = require('../src/v1beta1')(); var FAKE_STATUS_CODE = 1; var error = new Error(); From 3e655733e38a6090883539a896d926d7c9e4e6a4 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 13:01:15 -0700 Subject: [PATCH 03/13] Updates based on CI and @stephenplusplus feedback. --- .jscsrc | 4 +++- .jshintignore | 2 ++ packages/video-intelligence/package.json | 4 ++-- packages/video-intelligence/src/index.js | 7 +++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.jscsrc b/.jscsrc index 91d4a292952..0be5bbf66a1 100644 --- a/.jscsrc +++ b/.jscsrc @@ -22,7 +22,9 @@ "excludeFiles": [ "**/src/*/**/*", "**/system-test/*/**/*", + "**/test/**/gapic-*.js", "**/test/*/**/*", - "**/node_modules/" + "**/node_modules/", + "**/.coverage/**/*.js", ] } diff --git a/.jshintignore b/.jshintignore index 626b737fbdc..deb103b74e2 100644 --- a/.jshintignore +++ b/.jshintignore @@ -2,3 +2,5 @@ **/system-test/*/**/* **/test/*/**/* **/node_modules/ +**/coverage +**/gapic*.js diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index 8c8479ff28d..43ace0cda1a 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -1,7 +1,7 @@ { - "url": "https://github.com/googleapis/googleapis", "name": "@google-cloud/video-intelligence", - "version": "0.1.0", + "repository": "googlecloudplatform/google-cloud-node", + "version": "0.0.0", "author": "Google Inc", "description": "Google Cloud Video Intelligence API client for Node.js", "main": "src/index.js", diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index 11caaf2ec26..7e333d4e1a3 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,14 @@ 'use strict'; var gapic = { - v1beta1: require('./v1beta1'), + v1beta1: require('./v1beta1/index.js'), }; const VERSION = require('../package.json').version; /** - * Create an imageAnnotatorClient with additional helpers for common - * tasks. + * Create an imageAnnotatorClientfor the appropriate version. * * @param {Object=} opts - The optional parameters. * @param {String=} opts.servicePath From fe021c0d439e0f0763addb51ff660cf34577284f Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 13:01:54 -0700 Subject: [PATCH 04/13] Add publish-module' --- packages/video-intelligence/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index 43ace0cda1a..b79d334eb12 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -22,6 +22,7 @@ "node": ">=4.0.0" }, "scripts": { + "publish-module": "node ../../scripts/publish.js video-intelligence", "test": "mocha" } } From 75c0b64492f415bcfc3e6379a7e51ff36a7c680e Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 13:49:05 -0700 Subject: [PATCH 05/13] Fix lint. --- packages/video-intelligence/src/index.js | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index 7e333d4e1a3..2e126628e54 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -14,41 +14,41 @@ * limitations under the License. */ - 'use strict'; +'use strict'; - var gapic = { - v1beta1: require('./v1beta1/index.js'), - }; +var gapic = { + v1beta1: require('./v1beta1/index.js'), +}; - const VERSION = require('../package.json').version; +const VERSION = require('../package.json').version; - /** - * Create an imageAnnotatorClientfor the appropriate version. - * - * @param {Object=} opts - The optional parameters. - * @param {String=} opts.servicePath - * The domain name of the API remote host. - * @param {number=} opts.port - * The port on which to connect to the remote host. - * @param {grpc.ClientCredentials=} opts.sslCreds - * A ClientCredentials for use with an SSL-enabled channel. - * @param {Object=} opts.clientConfig - * The customized config to build the call settings. See - * {@link gax.constructSettings} for the format. - */ - function videointelligence_v1beta1(opts) { - // Define the header options. - opts = opts || {}; - opts.libName = 'gccl'; - opts.libVersion = VERSION; +/** + * Create an imageAnnotatorClientfor the appropriate version. + * + * @param {Object=} opts - The optional parameters. + * @param {String=} opts.servicePath + * The domain name of the API remote host. + * @param {number=} opts.port + * The port on which to connect to the remote host. + * @param {grpc.ClientCredentials=} opts.sslCreds + * A ClientCredentials for use with an SSL-enabled channel. + * @param {Object=} opts.clientConfig + * The customized config to build the call settings. See + * {@link gax.constructSettings} for the format. + */ +function videointelligenceV1beta1(opts) { + // Define the header options. + opts = opts || {}; + opts.libName = 'gccl'; + opts.libVersion = VERSION; - // Create the image annotator client with the provided options. - var client = gapic.v1beta1(opts).videoIntelligenceServiceClient(opts); - return client; - } + // Create the image annotator client with the provided options. + var client = gapic.v1beta1(opts).videoIntelligenceServiceClient(opts); + return client; +} // The default export should be the latest version. // Assign all versions as version properties on the default. module.exports = videointelligence_v1beta1; -module.exports.v1beta1 = videointelligence_v1beta1; +module.exports.v1beta1 = videointelligenceV1beta1; From 2aba91fb4920a164888722e862ac4921a267d8e9 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 14:08:14 -0700 Subject: [PATCH 06/13] Derp. --- packages/video-intelligence/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index 2e126628e54..5707370a29b 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -50,5 +50,5 @@ function videointelligenceV1beta1(opts) { // The default export should be the latest version. // Assign all versions as version properties on the default. -module.exports = videointelligence_v1beta1; +module.exports = videointelligenceV1beta1; module.exports.v1beta1 = videointelligenceV1beta1; From 704b6538a8107b469f18fb6c14126d54c58551a1 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 15:02:05 -0700 Subject: [PATCH 07/13] Ignore videointelligence for docs. --- scripts/docs/config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/docs/config.js b/scripts/docs/config.js index 8857ef3ede1..40e9daaf990 100644 --- a/scripts/docs/config.js +++ b/scripts/docs/config.js @@ -39,6 +39,7 @@ module.exports = { 'spanner/src/session.js', 'spanner/src/transaction-request.js', 'storage/src/acl.js' + 'videointelligence', ], OVERVIEW_TEMPLATE: 'templates/overview.html', OVERVIEW: { From 0b2f332e6041ff898a5c86c782d9e8a7ae400395 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 15:43:39 -0700 Subject: [PATCH 08/13] Fix a stupid error. --- scripts/docs/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/docs/config.js b/scripts/docs/config.js index 40e9daaf990..0a5cdcf5c60 100644 --- a/scripts/docs/config.js +++ b/scripts/docs/config.js @@ -38,8 +38,8 @@ module.exports = { 'spanner/src/session-pool.js', 'spanner/src/session.js', 'spanner/src/transaction-request.js', - 'storage/src/acl.js' - 'videointelligence', + 'storage/src/acl.js', + 'videointelligence' ], OVERVIEW_TEMPLATE: 'templates/overview.html', OVERVIEW: { From 54a4a30ff7b830a5d21b1cdbc38dbd87e37d5800 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 17 May 2017 16:35:25 -0700 Subject: [PATCH 09/13] Hyphens, how do they work? --- scripts/docs/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docs/config.js b/scripts/docs/config.js index 0a5cdcf5c60..7aae0449911 100644 --- a/scripts/docs/config.js +++ b/scripts/docs/config.js @@ -39,7 +39,7 @@ module.exports = { 'spanner/src/session.js', 'spanner/src/transaction-request.js', 'storage/src/acl.js', - 'videointelligence' + 'video-intelligence' ], OVERVIEW_TEMPLATE: 'templates/overview.html', OVERVIEW: { From df819044ea6ff1e6d26a89cad3d464523495bda7 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Wed, 17 May 2017 20:17:14 -0400 Subject: [PATCH 10/13] update deps --- packages/video-intelligence/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index b79d334eb12..c40dac0279e 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -9,8 +9,8 @@ "src" ], "dependencies": { - "google-proto-files": "^0.8.6", - "google-gax": "^0.12.2", + "google-proto-files": "^0.12.0", + "google-gax": "^0.13.2", "extend": "^3.0.0" }, "devDependencies": { From 4785160f12c3efa7ca262a4e80875c36cc51fdc5 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Wed, 17 May 2017 20:38:40 -0400 Subject: [PATCH 11/13] add intro, docs, params --- packages/video-intelligence/src/index.js | 64 ++++++++++++------- .../video-intelligence/src/v1beta1/index.js | 2 +- .../video-intelligence/test/gapic-v1beta1.js | 2 +- scripts/docs/config.js | 3 +- 4 files changed, 44 insertions(+), 27 deletions(-) diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index 5707370a29b..98aa372d51b 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -14,41 +14,59 @@ * limitations under the License. */ +/*! + * @module video-intelligence + */ + 'use strict'; -var gapic = { - v1beta1: require('./v1beta1/index.js'), -}; +var v1beta1 = require('./v1beta1/index.js'); const VERSION = require('../package.json').version; - /** - * Create an imageAnnotatorClientfor the appropriate version. - * - * @param {Object=} opts - The optional parameters. - * @param {String=} opts.servicePath - * The domain name of the API remote host. - * @param {number=} opts.port - * The port on which to connect to the remote host. - * @param {grpc.ClientCredentials=} opts.sslCreds - * A ClientCredentials for use with an SSL-enabled channel. - * @param {Object=} opts.clientConfig - * The customized config to build the call settings. See - * {@link gax.constructSettings} for the format. + * [Google Cloud Video Intelligence API](https://cloud.google.com/video-intelligence) + * makes videos searchable, and discoverable, by extracting metadata with an + * easy to use REST API. You can now search every moment of every video file in + * your catalog and find every occurrence as well as its significance. It + * quickly annotates videos stored in Google Cloud Storage, and helps you + * identify key nouns entities of your video, and when they occur within the + * video. Separate signal from noise, by retrieving relevant information at the + * video, shot or per frame. + * + *

This is an auto-generated API

+ * + * It does not follow the conventions you're familiar with from other parts of + * our library. A handwritten layer is not yet available. + * + * The example below shows you how to instantiate the generated client. For + * further documentation, please browse the + * [Video Intelligence .proto files](https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto) + * on GitHub. + * + * @constructor + * @alias module:video-intelligence + * + * @resource [Cloud Video Intelligence](https://cloud.google.com/video-intelligence) + * + * @param {object} options - [Configuration object](#/docs). + * @param {number=} options.port - The port on which to connect to the remote + * host. + * @param {string=} options.servicePath - The domain name of the API remote + * host. */ -function videointelligenceV1beta1(opts) { +function VideoIntelligence(options) { // Define the header options. - opts = opts || {}; - opts.libName = 'gccl'; - opts.libVersion = VERSION; + options = options || {}; + options.libName = 'gccl'; + options.libVersion = VERSION; // Create the image annotator client with the provided options. - var client = gapic.v1beta1(opts).videoIntelligenceServiceClient(opts); + var client = v1beta1(options).videoIntelligenceServiceClient(options); return client; } // The default export should be the latest version. // Assign all versions as version properties on the default. -module.exports = videointelligenceV1beta1; -module.exports.v1beta1 = videointelligenceV1beta1; +module.exports = VideoIntelligence; +module.exports.v1beta1 = v1beta1; diff --git a/packages/video-intelligence/src/v1beta1/index.js b/packages/video-intelligence/src/v1beta1/index.js index 8d804acbf19..d7aa3548edb 100644 --- a/packages/video-intelligence/src/v1beta1/index.js +++ b/packages/video-intelligence/src/v1beta1/index.js @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/video-intelligence/test/gapic-v1beta1.js b/packages/video-intelligence/test/gapic-v1beta1.js index c3501705780..444dac98658 100644 --- a/packages/video-intelligence/test/gapic-v1beta1.js +++ b/packages/video-intelligence/test/gapic-v1beta1.js @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All rights reserved. + * Copyright 2017 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/scripts/docs/config.js b/scripts/docs/config.js index 7aae0449911..8857ef3ede1 100644 --- a/scripts/docs/config.js +++ b/scripts/docs/config.js @@ -38,8 +38,7 @@ module.exports = { 'spanner/src/session-pool.js', 'spanner/src/session.js', 'spanner/src/transaction-request.js', - 'storage/src/acl.js', - 'video-intelligence' + 'storage/src/acl.js' ], OVERVIEW_TEMPLATE: 'templates/overview.html', OVERVIEW: { From bb3c63facf4ef41158c5b11001887a9d0ff667fd Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Wed, 17 May 2017 20:45:33 -0400 Subject: [PATCH 12/13] add VI to docs config --- scripts/docs/config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/docs/config.js b/scripts/docs/config.js index 8857ef3ede1..74cc8b665c4 100644 --- a/scripts/docs/config.js +++ b/scripts/docs/config.js @@ -103,6 +103,9 @@ module.exports = { translate: { title: 'Cloud Translation API' }, + 'video-intelligence': { + title: 'Cloud Video Intelligence' + }, vision: { title: 'Cloud Vision' } From d328897f89a96dc1ed3928807c924244e026a8a4 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Wed, 17 May 2017 20:57:31 -0400 Subject: [PATCH 13/13] remove through2 from dev deps --- packages/video-intelligence/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index c40dac0279e..5f4b7637ac1 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -14,8 +14,7 @@ "extend": "^3.0.0" }, "devDependencies": { - "mocha": "3.2.0", - "through2": "2.0.3" + "mocha": "3.2.0" }, "license": "Apache-2.0", "engines": {