Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Intelligence 0.3.2 #2625

Merged
merged 6 commits into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion packages/video-intelligence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
],
"dependencies": {
"extend": "^3.0",
"google-gax": "^0.13.5"
"google-gax": "^0.14.0",
"protobufjs": "^6.8.0"
},
"devDependencies": {
"mocha": "^3.2.0"
Expand Down
30 changes: 15 additions & 15 deletions packages/video-intelligence/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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 +61,24 @@ 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')
.google.cloud.videointelligence.v1beta1);


/**
Expand Down Expand Up @@ -109,25 +110,24 @@ 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 @@ -31,6 +31,7 @@ var configData = require('./video_intelligence_service_client_config');
var extend = require('extend');
var gax = require('google-gax');
var path = require('path');
var protobuf = require('protobufjs');

var SERVICE_ADDRESS = 'videointelligence.googleapis.com';

Expand Down Expand Up @@ -76,11 +77,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 +271,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 All @@ -287,4 +296,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;
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var configData = require('./video_intelligence_service_client_config');
var extend = require('extend');
var gax = require('google-gax');
var path = require('path');
var protobuf = require('protobufjs');

var SERVICE_ADDRESS = 'videointelligence.googleapis.com';

Expand Down Expand Up @@ -76,11 +77,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 +140,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 +151,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 +192,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 +215,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 +261,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 All @@ -287,4 +286,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;
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