From 7454e9e96d35da8f0dd253719011bb4b4cdbcd26 Mon Sep 17 00:00:00 2001 From: Ernest Landrito Date: Fri, 30 Jun 2017 15:22:37 -0700 Subject: [PATCH] VideoIntelligence: regeneration --- packages/video-intelligence/README.md | 10 +- packages/video-intelligence/package.json | 17 +- packages/video-intelligence/src/index.js | 78 ++- .../v1beta1/doc/doc_google_protobuf_any.js | 121 ++++ .../src/v1beta1/doc/doc_google_rpc_status.js | 92 ++++ .../src/v1beta1/doc/doc_video_intelligence.js | 519 ++++++++++++++++++ .../video-intelligence/src/v1beta1/index.js | 8 +- .../video_intelligence_service_client.js | 33 +- .../video-intelligence/test/gapic-v1beta1.js | 15 +- 9 files changed, 811 insertions(+), 82 deletions(-) create mode 100644 packages/video-intelligence/src/v1beta1/doc/doc_google_protobuf_any.js create mode 100644 packages/video-intelligence/src/v1beta1/doc/doc_google_rpc_status.js create mode 100644 packages/video-intelligence/src/v1beta1/doc/doc_video_intelligence.js diff --git a/packages/video-intelligence/README.md b/packages/video-intelligence/README.md index 7cacd49704e..9eaf25ef70e 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 b8eba5f14c4..756a1ca5c9e 100644 --- a/packages/video-intelligence/package.json +++ b/packages/video-intelligence/package.json @@ -1,4 +1,5 @@ { + "repository": "GoogleCloudPlatform/google-cloud-node", "name": "@google-cloud/video-intelligence", "version": "0.1.0", "author": "Google Inc", @@ -7,10 +8,8 @@ "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", + "google-proto-files": "^0.12.0", "google-gax": "^0.13.2", - "google-proto-files": "^0.12.0" + "extend": "^3.0.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 98aa372d51b..a2277bc095d 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/doc/doc_google_protobuf_any.js b/packages/video-intelligence/src/v1beta1/doc/doc_google_protobuf_any.js new file mode 100644 index 00000000000..0697ec15814 --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/doc/doc_google_protobuf_any.js @@ -0,0 +1,121 @@ +/* + * 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. + */ + +/* + * Note: this file is purely for documentation. Any contents are not expected + * to be loaded as the JS file. + */ + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * # JSON + * + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message {@link google.protobuf.Duration}): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * + * @external "google.protobuf.Any" + * @property {string} typeUrl + * A URL/resource name whose content describes the type of the + * serialized protocol buffer message. + * + * For URLs which use the scheme `http`, `https`, or no scheme, the + * following restrictions and interpretations apply: + * + * * If no scheme is provided, `https` is assumed. + * * The last segment of the URL's path must represent the fully + * qualified name of the type (as in `path/google.protobuf.Duration`). + * The name should be in a canonical form (e.g., leading "." is + * not accepted). + * * An HTTP GET on the URL must yield a {@link google.protobuf.Type} + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * @property {string} value + * Must be a valid serialized protocol buffer of the above specified type. + * + * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} + */ \ No newline at end of file diff --git a/packages/video-intelligence/src/v1beta1/doc/doc_google_rpc_status.js b/packages/video-intelligence/src/v1beta1/doc/doc_google_rpc_status.js new file mode 100644 index 00000000000..c85f1befe90 --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/doc/doc_google_rpc_status.js @@ -0,0 +1,92 @@ +/* + * 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. + */ + +/* + * Note: this file is purely for documentation. Any contents are not expected + * to be loaded as the JS file. + */ + +/** + * The `Status` type defines a logical error model that is suitable for different + * programming environments, including REST APIs and RPC APIs. It is used by + * [gRPC](https://github.com/grpc). The error model is designed to be: + * + * - Simple to use and understand for most users + * - Flexible enough to meet unexpected needs + * + * # Overview + * + * The `Status` message contains three pieces of data: error code, error message, + * and error details. The error code should be an enum value of + * {@link google.rpc.Code}, but it may accept additional error codes if needed. The + * error message should be a developer-facing English message that helps + * developers *understand* and *resolve* the error. If a localized user-facing + * error message is needed, put the localized message in the error details or + * localize it in the client. The optional error details may contain arbitrary + * information about the error. There is a predefined set of error detail types + * in the package `google.rpc` which can be used for common error conditions. + * + * # Language mapping + * + * The `Status` message is the logical representation of the error model, but it + * is not necessarily the actual wire format. When the `Status` message is + * exposed in different client libraries and different wire protocols, it can be + * mapped differently. For example, it will likely be mapped to some exceptions + * in Java, but more likely mapped to some error codes in C. + * + * # Other uses + * + * The error model and the `Status` message can be used in a variety of + * environments, either with or without APIs, to provide a + * consistent developer experience across different environments. + * + * Example uses of this error model include: + * + * - Partial errors. If a service needs to return partial errors to the client, + * it may embed the `Status` in the normal response to indicate the partial + * errors. + * + * - Workflow errors. A typical workflow has multiple steps. Each step may + * have a `Status` message for error reporting purpose. + * + * - Batch operations. If a client uses batch request and batch response, the + * `Status` message should be used directly inside batch response, one for + * each error sub-response. + * + * - Asynchronous operations. If an API call embeds asynchronous operation + * results in its response, the status of those operations should be + * represented directly using the `Status` message. + * + * - Logging. If some API errors are stored in logs, the message `Status` could + * be used directly after any stripping needed for security/privacy reasons. + * + * @external "google.rpc.Status" + * @property {number} code + * The status code, which should be an enum value of {@link google.rpc.Code}. + * + * @property {string} message + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * {@link google.rpc.Status.details} field, or localized by the client. + * + * @property {Object[]} details + * A list of messages that carry the error details. There will be a + * common set of message types for APIs to use. + * + * This object should have the same structure as [google.protobuf.Any]{@link external:"google.protobuf.Any"} + * + * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} + */ \ No newline at end of file diff --git a/packages/video-intelligence/src/v1beta1/doc/doc_video_intelligence.js b/packages/video-intelligence/src/v1beta1/doc/doc_video_intelligence.js new file mode 100644 index 00000000000..d20f31cf39e --- /dev/null +++ b/packages/video-intelligence/src/v1beta1/doc/doc_video_intelligence.js @@ -0,0 +1,519 @@ +/* + * 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. + */ + +/* + * Note: this file is purely for documentation. Any contents are not expected + * to be loaded as the JS file. + */ + +/** + * Video annotation request. + * + * @property {string} 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. + * + * @property {string} 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. + * + * @property {number[]} features + * Requested video annotation features. + * + * The number should be among the values of [Feature]{@link Feature} + * + * @property {Object} videoContext + * Additional video context and/or feature-specific parameters. + * + * This object should have the same structure as [VideoContext]{@link VideoContext} + * + * @property {string} 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). + * + * @property {string} 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. + * + * @class + * @see [google.cloud.videointelligence.v1beta1.AnnotateVideoRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var AnnotateVideoRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Video context and/or feature-specific parameters. + * + * @property {Object[]} segments + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video + * is treated as a single segment. + * + * This object should have the same structure as [VideoSegment]{@link VideoSegment} + * + * @property {number} labelDetectionMode + * If label detection has been requested, what labels should be detected + * in addition to video-level labels or segment-level labels. If unspecified, + * defaults to `SHOT_MODE`. + * + * The number should be among the values of [LabelDetectionMode]{@link LabelDetectionMode} + * + * @property {boolean} stationaryCamera + * Whether the video has been shot from a stationary (i.e. non-moving) camera. + * When set to true, might improve detection accuracy for moving objects. + * + * @property {string} labelDetectionModel + * Model to use for label detection. + * Supported values: "latest" and "stable" (the default). + * + * @property {string} faceDetectionModel + * Model to use for face detection. + * Supported values: "latest" and "stable" (the default). + * + * @property {string} shotChangeDetectionModel + * Model to use for shot change detection. + * Supported values: "latest" and "stable" (the default). + * + * @property {string} safeSearchDetectionModel + * Model to use for safe search detection. + * Supported values: "latest" and "stable" (the default). + * + * @class + * @see [google.cloud.videointelligence.v1beta1.VideoContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var VideoContext = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Video segment. + * + * @property {number} startTimeOffset + * Start offset in microseconds (inclusive). Unset means 0. + * + * @property {number} endTimeOffset + * End offset in microseconds (inclusive). Unset means 0. + * + * @class + * @see [google.cloud.videointelligence.v1beta1.VideoSegment definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var VideoSegment = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Label location. + * + * @property {Object} segment + * Video segment. Set to [-1, -1] for video-level labels. + * Set to [timestamp, timestamp] for frame-level labels. + * Otherwise, corresponds to one of `AnnotateSpec.segments` + * (if specified) or to shot boundaries (if requested). + * + * This object should have the same structure as [VideoSegment]{@link VideoSegment} + * + * @property {number} confidence + * Confidence that the label is accurate. Range: [0, 1]. + * + * @property {number} level + * Label level. + * + * The number should be among the values of [LabelLevel]{@link LabelLevel} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.LabelLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var LabelLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Label annotation. + * + * @property {string} description + * Textual description, e.g. `Fixed-gear bicycle`. + * + * @property {string} languageCode + * Language code for `description` in BCP-47 format. + * + * @property {Object[]} locations + * Where the label was detected and with what confidence. + * + * This object should have the same structure as [LabelLocation]{@link LabelLocation} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.LabelAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var LabelAnnotation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Safe search annotation (based on per-frame visual signals only). + * If no unsafe content has been detected in a frame, no annotations + * are present for that frame. If only some types of unsafe content + * have been detected in a frame, the likelihood is set to `UNKNOWN` + * for all other types of unsafe content. + * + * @property {number} adult + * Likelihood of adult content. + * + * The number should be among the values of [Likelihood]{@link Likelihood} + * + * @property {number} spoof + * Likelihood that an obvious modification was made to the original + * version to make it appear funny or offensive. + * + * The number should be among the values of [Likelihood]{@link Likelihood} + * + * @property {number} medical + * Likelihood of medical content. + * + * The number should be among the values of [Likelihood]{@link Likelihood} + * + * @property {number} violent + * Likelihood of violent content. + * + * The number should be among the values of [Likelihood]{@link Likelihood} + * + * @property {number} racy + * Likelihood of racy content. + * + * The number should be among the values of [Likelihood]{@link Likelihood} + * + * @property {number} timeOffset + * Video time offset in microseconds. + * + * @class + * @see [google.cloud.videointelligence.v1beta1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var SafeSearchAnnotation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Bounding box. + * + * @property {number} left + * Left X coordinate. + * + * @property {number} right + * Right X coordinate. + * + * @property {number} bottom + * Bottom Y coordinate. + * + * @property {number} top + * Top Y coordinate. + * + * @class + * @see [google.cloud.videointelligence.v1beta1.BoundingBox definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var BoundingBox = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Face location. + * + * @property {Object} boundingBox + * Bounding box in a frame. + * + * This object should have the same structure as [BoundingBox]{@link BoundingBox} + * + * @property {number} timeOffset + * Video time offset in microseconds. + * + * @class + * @see [google.cloud.videointelligence.v1beta1.FaceLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var FaceLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Face annotation. + * + * @property {string} thumbnail + * Thumbnail of a representative face view (in JPEG format). Encoding: base64. + * + * @property {Object[]} segments + * All locations where a face was detected. + * Faces are detected and tracked on a per-video basis + * (as opposed to across multiple videos). + * + * This object should have the same structure as [VideoSegment]{@link VideoSegment} + * + * @property {Object[]} locations + * Face locations at one frame per second. + * + * This object should have the same structure as [FaceLocation]{@link FaceLocation} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var FaceAnnotation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Annotation results for a single video. + * + * @property {string} inputUri + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * @property {Object[]} labelAnnotations + * Label annotations. There is exactly one element for each unique label. + * + * This object should have the same structure as [LabelAnnotation]{@link LabelAnnotation} + * + * @property {Object[]} faceAnnotations + * Face annotations. There is exactly one element for each unique face. + * + * This object should have the same structure as [FaceAnnotation]{@link FaceAnnotation} + * + * @property {Object[]} shotAnnotations + * Shot annotations. Each shot is represented as a video segment. + * + * This object should have the same structure as [VideoSegment]{@link VideoSegment} + * + * @property {Object[]} safeSearchAnnotations + * Safe search annotations. + * + * This object should have the same structure as [SafeSearchAnnotation]{@link SafeSearchAnnotation} + * + * @property {Object} error + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * This object should have the same structure as [google.rpc.Status]{@link external:"google.rpc.Status"} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.VideoAnnotationResults definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var VideoAnnotationResults = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Video annotation response. Included in the `response` + * field of the `Operation` returned by the `GetOperation` + * call of the `google::longrunning::Operations` service. + * + * @property {Object[]} annotationResults + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * This object should have the same structure as [VideoAnnotationResults]{@link VideoAnnotationResults} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.AnnotateVideoResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var AnnotateVideoResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Annotation progress for a single video. + * + * @property {string} inputUri + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * @property {number} progressPercent + * Approximate percentage processed thus far. + * Guaranteed to be 100 when fully processed. + * + * @property {Object} startTime + * Time when the request was received. + * + * This object should have the same structure as [google.protobuf.Timestamp]{@link external:"google.protobuf.Timestamp"} + * + * @property {Object} updateTime + * Time of the most recent update. + * + * This object should have the same structure as [google.protobuf.Timestamp]{@link external:"google.protobuf.Timestamp"} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.VideoAnnotationProgress definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var VideoAnnotationProgress = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Video annotation progress. Included in the `metadata` + * field of the `Operation` returned by the `GetOperation` + * call of the `google::longrunning::Operations` service. + * + * @property {Object[]} annotationProgress + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * This object should have the same structure as [VideoAnnotationProgress]{@link VideoAnnotationProgress} + * + * @class + * @see [google.cloud.videointelligence.v1beta1.AnnotateVideoProgress definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/videointelligence/v1beta1/video_intelligence.proto} + */ +var AnnotateVideoProgress = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Video annotation feature. + * + * @enum {number} + */ +var Feature = { + + /** + * Unspecified. + */ + FEATURE_UNSPECIFIED: 0, + + /** + * Label detection. Detect objects, such as dog or flower. + */ + LABEL_DETECTION: 1, + + /** + * Human face detection and tracking. + */ + FACE_DETECTION: 2, + + /** + * Shot change detection. + */ + SHOT_CHANGE_DETECTION: 3, + + /** + * Safe search detection. + */ + SAFE_SEARCH_DETECTION: 4 +}; + +/** + * Label level (scope). + * + * @enum {number} + */ +var LabelLevel = { + + /** + * Unspecified. + */ + LABEL_LEVEL_UNSPECIFIED: 0, + + /** + * Video-level. Corresponds to the whole video. + */ + VIDEO_LEVEL: 1, + + /** + * Segment-level. Corresponds to one of `AnnotateSpec.segments`. + */ + SEGMENT_LEVEL: 2, + + /** + * Shot-level. Corresponds to a single shot (i.e. a series of frames + * without a major camera position or background change). + */ + SHOT_LEVEL: 3, + + /** + * Frame-level. Corresponds to a single video frame. + */ + FRAME_LEVEL: 4 +}; + +/** + * Label detection mode. + * + * @enum {number} + */ +var LabelDetectionMode = { + + /** + * Unspecified. + */ + LABEL_DETECTION_MODE_UNSPECIFIED: 0, + + /** + * Detect shot-level labels. + */ + SHOT_MODE: 1, + + /** + * Detect frame-level labels. + */ + FRAME_MODE: 2, + + /** + * Detect both shot-level and frame-level labels. + */ + SHOT_AND_FRAME_MODE: 3 +}; + +/** + * Bucketized representation of likelihood. + * + * @enum {number} + */ +var Likelihood = { + + /** + * Unknown likelihood. + */ + UNKNOWN: 0, + + /** + * Very unlikely. + */ + VERY_UNLIKELY: 1, + + /** + * Unlikely. + */ + UNLIKELY: 2, + + /** + * Possible. + */ + POSSIBLE: 3, + + /** + * Likely. + */ + LIKELY: 4, + + /** + * Very likely. + */ + VERY_LIKELY: 5 +}; \ 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 d7aa3548edb..d3d5df8b0c9 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.1.0'; 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 52ee95379f5..e660a2428f4 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.1.0'; /** * 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 444dac98658..aab6c6af542 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]); }