Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/video-intelligence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
],
"dependencies": {
"extend": "^3.0",
"google-gax": "^0.13.5"
"google-gax": "^0.14.0",
"google-proto-files": "^0.12.0",

This comment was marked as spam.

"protobufjs": "^6.8.0"
},
"devDependencies": {
"mocha": "^3.2.0"
"mocha": "^3.2.0",
"through2": "^2.0.3"

This comment was marked as spam.

This comment was marked as spam.

},
"scripts": {
"publish-module": "node ../../scripts/publish.js video-intelligence",
Expand Down
35 changes: 14 additions & 21 deletions packages/video-intelligence/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*!

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

* @module video-intelligence
* @name VideoIntelligence
*/

'use strict';

var extend = require('extend');
Expand All @@ -27,10 +21,12 @@ var gapic = {
v1beta2: require('./v1beta2'),
};
var gaxGrpc = require('google-gax').grpc();
var googleProtoFiles = require('google-proto-files');

This comment was marked as spam.

This comment was marked as spam.

var path = require('path');

const VERSION = require('../package.json').version;


/**
* Create an videoIntelligenceServiceClient with additional helpers for common
* tasks.
Expand Down Expand Up @@ -60,24 +56,23 @@ const VERSION = require('../package.json').version;
* @param {string=} options.servicePath - The domain name of the
* API remote host.
*/
function videoIntelligenceV1beta2(options) {
function videoIntelligenceV1beta1(options) {
// Define the header options.
options = extend({}, options, {
libName: 'gccl',
libVersion: VERSION
});

// Create the client with the provided options.
var client = gapic.v1beta2(options).videoIntelligenceServiceClient(options);
var client = gapic.v1beta1(options).videoIntelligenceServiceClient(options);
return client;
}

var v1beta2Protos = {};
var v1beta1Protos = {};

extend(v1beta2Protos, gaxGrpc.loadProto(
path.join(__dirname, '..', 'protos',
'google/cloud/videointelligence/v1beta2/video_intelligence.proto')
).google.cloud.videointelligence.v1beta2);
extend(v1beta1Protos, gaxGrpc.loadProto(
path.join(__dirname, '..', 'protos'), 'google/cloud/videointelligence/v1beta1/video_intelligence.proto')

This comment was marked as spam.

This comment was marked as spam.

.google.cloud.videointelligence.v1beta1);


/**
Expand Down Expand Up @@ -109,25 +104,23 @@ extend(v1beta2Protos, gaxGrpc.loadProto(
* @param {string=} options.servicePath - The domain name of the
* API remote host.
*/
function videoIntelligenceV1beta1(options) {
function videoIntelligenceV1beta2(options) {
// Define the header options.
options = extend({}, options, {
libName: 'gccl',
libVersion: VERSION
});

// Create the client with the provided options.
var client = gapic.v1beta1(options).videoIntelligenceServiceClient(options);
var client = gapic.v1beta2(options).videoIntelligenceServiceClient(options);
return client;
}

var v1beta1Protos = {};

extend(v1beta1Protos, gaxGrpc.loadProto(
path.join(__dirname, '..', 'protos',
'google/cloud/videointelligence/v1beta1/video_intelligence.proto')
).google.cloud.videointelligence.v1beta1);
var v1beta2Protos = {};

extend(v1beta2Protos, gaxGrpc.loadProto(
path.join(__dirname, '..', 'protos'), 'google/cloud/videointelligence/v1beta2/video_intelligence.proto')
.google.cloud.videointelligence.v1beta2);

module.exports = videoIntelligenceV1beta2;
module.exports.types = v1beta2Protos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
var configData = require('./video_intelligence_service_client_config');
var extend = require('extend');
var gax = require('google-gax');
var googleProtoFiles = require('google-proto-files');
var path = require('path');
var protobuf = require('protobufjs');

var SERVICE_ADDRESS = 'videointelligence.googleapis.com';

Expand Down Expand Up @@ -76,11 +78,19 @@ function VideoIntelligenceServiceClient(gaxGrpc, loadedProtos, opts) {
grpc: gaxGrpc.grpc
}).operationsClient(opts);

var protoFilesRoot = new gax.grpc.GoogleProtoFilesRoot();
protoFilesRoot = protobuf.loadSync(

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

path.join(__dirname, '..', '..', 'protos', 'google/cloud/videointelligence/v1beta1/video_intelligence.proto'),
protoFilesRoot);

var annotateVideoResponse = protoFilesRoot.lookup('google.cloud.videointelligence.v1beta1.AnnotateVideoResponse');
var annotateVideoMetadata = protoFilesRoot.lookup('google.cloud.videointelligence.v1beta1.AnnotateVideoProgress');

this.longrunningDescriptors = {
annotateVideo: new gax.LongrunningDescriptor(
this.operationsClient,
loadedProtos.google.cloud.videointelligence.v1beta1.AnnotateVideoResponse.decode,
loadedProtos.google.cloud.videointelligence.v1beta1.AnnotateVideoProgress.decode)
annotateVideoResponse.decode.bind(annotateVideoResponse),
annotateVideoMetadata.decode.bind(annotateVideoMetadata))
};

var defaults = gaxGrpc.constructSettings(
Expand Down Expand Up @@ -262,7 +272,7 @@ function VideoIntelligenceServiceClientBuilder(gaxGrpc) {
}

var videoIntelligenceServiceStubProtos = gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos', 'google/cloud/videointelligence/v1beta1/video_intelligence.proto'));
path.join(__dirname, '..', '..', 'protos'), 'google/cloud/videointelligence/v1beta1/video_intelligence.proto');
extend(this, videoIntelligenceServiceStubProtos.google.cloud.videointelligence.v1beta1);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
var configData = require('./video_intelligence_service_client_config');
var extend = require('extend');
var gax = require('google-gax');
var googleProtoFiles = require('google-proto-files');
var path = require('path');
var protobuf = require('protobufjs');

var SERVICE_ADDRESS = 'videointelligence.googleapis.com';

Expand Down Expand Up @@ -76,11 +78,19 @@ function VideoIntelligenceServiceClient(gaxGrpc, loadedProtos, opts) {
grpc: gaxGrpc.grpc
}).operationsClient(opts);

var protoFilesRoot = new gax.grpc.GoogleProtoFilesRoot();
protoFilesRoot = protobuf.loadSync(
path.join(__dirname, '..', '..', 'protos', 'google/cloud/videointelligence/v1beta2/video_intelligence.proto'),
protoFilesRoot);

var annotateVideoResponse = protoFilesRoot.lookup('google.cloud.videointelligence.v1beta2.AnnotateVideoResponse');
var annotateVideoMetadata = protoFilesRoot.lookup('google.cloud.videointelligence.v1beta2.AnnotateVideoProgress');

this.longrunningDescriptors = {
annotateVideo: new gax.LongrunningDescriptor(
this.operationsClient,
loadedProtos.google.cloud.videointelligence.v1beta2.AnnotateVideoResponse.decode,
loadedProtos.google.cloud.videointelligence.v1beta2.AnnotateVideoProgress.decode)
annotateVideoResponse.decode.bind(annotateVideoResponse),
annotateVideoMetadata.decode.bind(annotateVideoMetadata))
};

var defaults = gaxGrpc.constructSettings(
Expand Down Expand Up @@ -131,7 +141,7 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) {
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.inputUri
* @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:
Expand All @@ -142,13 +152,13 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) {
* 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 {number[]=} request.features
* Requested video annotation features.
*
* The number should be among the values of [Feature]{@link Feature}
* @param {Object=} request.videoContext
* Additional video context and/or feature-specific parameters.
*
Expand Down Expand Up @@ -183,15 +193,10 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) {
* // optional auth parameters.
* });
*
* var inputUri = '';
* var features = [];
* var request = {
* inputUri: inputUri,
* features: features
* };
*
*
* // Handle the operation using the promise pattern.
* client.annotateVideo(request).then(function(responses) {
* client.annotateVideo({}).then(function(responses) {
* var operation = responses[0];
* var initialApiResponse = responses[1];
*
Expand All @@ -211,15 +216,10 @@ VideoIntelligenceServiceClient.prototype.getProjectId = function(callback) {
* 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) {
* client.annotateVideo({}).then(function(responses) {
* var operation = responses[0];
* var initialApiResponse = responses[1];
*
Expand Down Expand Up @@ -262,7 +262,7 @@ function VideoIntelligenceServiceClientBuilder(gaxGrpc) {
}

var videoIntelligenceServiceStubProtos = gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos', 'google/cloud/videointelligence/v1beta2/video_intelligence.proto'));
path.join(__dirname, '..', '..', 'protos'), 'google/cloud/videointelligence/v1beta2/video_intelligence.proto');
extend(this, videoIntelligenceServiceStubProtos.google.cloud.videointelligence.v1beta2);


Expand Down
6 changes: 6 additions & 0 deletions packages/video-intelligence/test/gapic-v1beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ describe('VideoIntelligenceServiceClient', function() {
done();
});
});

it('has longrunning decoder functions', function() {
var client = videointelligence.v1beta1();
assert(client.longrunningDescriptors.annotateVideo.responseDecoder instanceof Function);
assert(client.longrunningDescriptors.annotateVideo.metadataDecoder instanceof Function);
});
});

});
Expand Down
20 changes: 8 additions & 12 deletions packages/video-intelligence/test/gapic-v1beta2.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ describe('VideoIntelligenceServiceClient', function() {
var client = videoIntelligence.v1beta2();

// Mock request
var inputUri = 'inputUri1707300727';
var features = [];
var request = {
inputUri : inputUri,
features : features
};
var request = {};

// Mock response
var expectedResponse = {};
Expand All @@ -56,12 +51,7 @@ describe('VideoIntelligenceServiceClient', function() {
var client = videoIntelligence.v1beta2();

// Mock request
var inputUri = 'inputUri1707300727';
var features = [];
var request = {
inputUri : inputUri,
features : features
};
var request = {};

// Mock Grpc layer
client._annotateVideo = mockLongRunningGrpcMethod(request, null, error);
Expand All @@ -77,6 +67,12 @@ describe('VideoIntelligenceServiceClient', function() {
done();
});
});

it('has longrunning decoder functions', function() {
var client = videoIntelligence.v1beta2();
assert(client.longrunningDescriptors.annotateVideo.responseDecoder instanceof Function);
assert(client.longrunningDescriptors.annotateVideo.metadataDecoder instanceof Function);
});
});

});
Expand Down