diff --git a/packages/video-intelligence/README.md b/packages/video-intelligence/README.md index 7cacd49704e0..9eaf25ef70e9 100644 --- a/packages/video-intelligence/README.md +++ b/packages/video-intelligence/README.md @@ -1,6 +1,6 @@ -# Node.js Client for Google Cloud Video Intelligence API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-node#versioning)) +# Node.js Client for Google Cloud Video Intelligence API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-node#versioning)) -Idiomatic Node.js client for [Google Cloud Video Intelligence API][Product Documentation] +[Google Cloud Video Intelligence API][Product Documentation]: Google Cloud Video Intelligence API. - [Client Library Documentation][] - [Product Documentation][] @@ -8,12 +8,12 @@ Idiomatic Node.js client for [Google Cloud Video Intelligence API][Product Docum In order to use this library, you first need to go through the following steps: 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) -2. [Enable the video-intelligence api.](https://console.cloud.google.com/apis/api/video-intelligence) +2. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence) 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/master/guides/authentication) ### Installation ``` -$ npm install @google-cloud/video-intelligence +$ npm install --save @google-cloud/videointelligence ``` ### Next Steps @@ -22,4 +22,4 @@ $ npm install @google-cloud/video-intelligence - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/README.md) to see the full list of Cloud APIs that we cover. [Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-node/#/docs/video-intelligence -[Product Documentation]: https://cloud.google.com/video-intelligence +[Product Documentation]: https://cloud.google.com/video-intelligence \ No newline at end of file diff --git a/packages/video-intelligence/package.json b/packages/video-intelligence/package.json index 0f63cab6ebfb..13de970ef763 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -1,16 +1,15 @@ { - "name": "@google-cloud/video-intelligence", - "version": "0.1.1", + "repository": "GoogleCloudPlatform/google-cloud-node", + "name": "@google-cloud/videointelligence", + "version": "0.1.0", "author": "Google Inc", "description": "Google Cloud Video Intelligence API client for Node.js", "main": "src/index.js", "files": [ "src", "AUTHORS", - "CONTRIBUTORS", "COPYING" ], - "repository": "googlecloudplatform/google-cloud-node", "keywords": [ "google apis client", "google api client", @@ -20,20 +19,22 @@ "google cloud platform", "google cloud", "cloud", - "google video intelligence", - "video intelligence", - "video" + "google video-intelligence", + "video-intelligence", + "Google Cloud Video Intelligence API" ], "dependencies": { - "extend": "^3.0.0", + "extend": "^3.0", "google-gax": "^0.13.2", "google-proto-files": "^0.12.0" }, "devDependencies": { - "mocha": "^3.2.0" + "mocha": "^3.2.0", + "through2": "^2.0.3" }, "scripts": { "publish-module": "node ../../scripts/publish.js video-intelligence", + "smoke-test": "mocha smoke-test/*.js --timeout 5000", "test": "mocha test/*.js" }, "license": "Apache-2.0", diff --git a/packages/video-intelligence/src/index.js b/packages/video-intelligence/src/index.js index 98aa372d51b5..a2277bc095db 100644 --- a/packages/video-intelligence/src/index.js +++ b/packages/video-intelligence/src/index.js @@ -1,11 +1,11 @@ /* - * Copyright 2017 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -13,60 +13,48 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/*! - * @module video-intelligence - */ - 'use strict'; -var v1beta1 = require('./v1beta1/index.js'); +var extend = require('extend'); +var gapic = { + v1beta1: require('./v1beta1') +}; +var gaxGrpc = require('google-gax').grpc(); const VERSION = require('../package.json').version; /** - * [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. + * Create an videoIntelligenceServiceClient with additional helpers for common + * tasks. * - * 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. + * Service that implements Google Cloud Video Intelligence API. * - * @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. + * @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 VideoIntelligence(options) { +function videoIntelligenceV1beta1(options) { // Define the header options. - options = options || {}; - options.libName = 'gccl'; - options.libVersion = VERSION; + options = extend({}, options, { + libName: 'gccl', + libVersion: VERSION + }); - // Create the image annotator client with the provided options. - var client = v1beta1(options).videoIntelligenceServiceClient(options); + // Create the client with the provided options. + var client = gapic.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 = VideoIntelligence; -module.exports.v1beta1 = v1beta1; +var v1beta1Protos = {}; + +extend(v1beta1Protos, gaxGrpc.load([{ + root: require('google-proto-files')('..'), + file: 'google/cloud/videointelligence/v1beta1/video_intelligence.proto' +}]).google.cloud.videointelligence.v1beta1); + +module.exports = videoIntelligenceV1beta1; +module.exports.types = v1beta1Protos; +module.exports.v1beta1 = videoIntelligenceV1beta1; +module.exports.v1beta1.types = v1beta1Protos; \ No newline at end of file diff --git a/packages/video-intelligence/src/v1beta1/index.js b/packages/video-intelligence/src/v1beta1/index.js index d7aa3548edb9..15dd940809a5 100644 --- a/packages/video-intelligence/src/v1beta1/index.js +++ b/packages/video-intelligence/src/v1beta1/index.js @@ -1,11 +1,11 @@ /* - * Copyright 2017 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -27,8 +27,8 @@ function v1beta1(options) { return videoIntelligenceServiceClient(gaxGrpc); } -v1beta1.GAPIC_VERSION = '0.7.1'; +v1beta1.GAPIC_VERSION = '0.0.5'; v1beta1.SERVICE_ADDRESS = videoIntelligenceServiceClient.SERVICE_ADDRESS; v1beta1.ALL_SCOPES = videoIntelligenceServiceClient.ALL_SCOPES; -module.exports = v1beta1; +module.exports = v1beta1; \ No newline at end of file diff --git a/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js index 52ee95379f57..dfb4488b0ffe 100644 --- a/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js +++ b/packages/video-intelligence/src/v1beta1/video_intelligence_service_client.js @@ -35,7 +35,7 @@ var SERVICE_ADDRESS = 'videointelligence.googleapis.com'; var DEFAULT_SERVICE_PORT = 443; -var CODE_GEN_NAME_VERSION = 'gapic/0.7.1'; +var CODE_GEN_NAME_VERSION = 'gapic/0.0.5'; /** * The scopes needed to make gRPC calls to all of the methods defined in @@ -48,15 +48,6 @@ var ALL_SCOPES = [ /** * 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 */ @@ -185,7 +176,12 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) { * * @example * - * var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + * var videointelligence = require('@google-cloud/videointelligence'); + * + * var client = videointelligence.v1beta1({ + * // optional auth parameters. + * }); + * * var inputUri = ''; * var features = []; * var request = { @@ -209,10 +205,18 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) { * * // The response of the api call returning the complete operation. * var finalApiResponse = responses[2]; - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); * + * var inputUri = ''; + * var features = []; + * var request = { + * inputUri: inputUri, + * features: features + * }; + * * // Handle the operation using the event emitter pattern. * client.annotateVideo(request).then(function(responses) { * var operation = responses[0]; @@ -234,7 +238,8 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) { * operation.on('error', function(err) { * // throw(err); * }) - * }).catch(function(err) { + * }) + * .catch(function(err) { * console.error(err); * }); */ @@ -283,4 +288,4 @@ function VideoIntelligenceServiceClientBuilder(gaxGrpc) { } module.exports = VideoIntelligenceServiceClientBuilder; module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS; -module.exports.ALL_SCOPES = ALL_SCOPES; +module.exports.ALL_SCOPES = ALL_SCOPES; \ No newline at end of file diff --git a/packages/video-intelligence/test/gapic-v1beta1.js b/packages/video-intelligence/test/gapic-v1beta1.js index 444dac98658c..aab6c6af542a 100644 --- a/packages/video-intelligence/test/gapic-v1beta1.js +++ b/packages/video-intelligence/test/gapic-v1beta1.js @@ -1,11 +1,11 @@ /* - * Copyright 2017 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +'use strict'; var assert = require('assert'); -var videointelligenceV1beta1 = require('../src/v1beta1')(); +var videointelligence = require('../src'); var FAKE_STATUS_CODE = 1; var error = new Error(); @@ -24,7 +25,8 @@ error.code = FAKE_STATUS_CODE; describe('VideoIntelligenceServiceClient', function() { describe('annotateVideo', function() { it('invokes annotateVideo without error', function(done) { - var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + var client = videointelligence.v1beta1(); + // Mock request var inputUri = 'inputUri1707300727'; var features = []; @@ -51,7 +53,8 @@ describe('VideoIntelligenceServiceClient', function() { }); it('invokes annotateVideo with error', function(done) { - var client = videointelligenceV1beta1.videoIntelligenceServiceClient(); + var client = videointelligence.v1beta1(); + // Mock request var inputUri = 'inputUri1707300727'; var features = []; @@ -98,7 +101,7 @@ function mockLongRunningGrpcMethod(expectedRequest, response, error) { promise: function() { return new Promise(function(resolve, reject) { if (error) { - reject(error) + reject(error); } else { resolve([response]); }