Skip to content

Commit

Permalink
Regenerate the codegen files to sync with the latest version. (#1640)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuk authored and stephenplusplus committed Sep 28, 2016
1 parent 98f0cfb commit f374267
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
3 changes: 1 addition & 2 deletions packages/google-cloud-vision/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@
],
"dependencies": {
"@google-cloud/common": "^0.6.0",
"arguejs": "^0.2.3",
"arrify": "^1.0.0",
"async": "^2.0.1",
"extend": "^3.0.0",
"google-gax": "^0.6.0",
"google-gax": "^0.7.0",
"google-proto-files": "^0.8.0",
"is": "^3.0.1",
"propprop": "^0.3.0",
Expand Down
62 changes: 34 additions & 28 deletions packages/google-cloud-vision/src/v1/image_annotator_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
/* jscs: disable maximumLineLength */
'use strict';

var arguejs = require('arguejs');
var configData = require('./image_annotator_client_config');
var extend = require('extend');
var gax = require('google-gax');
Expand All @@ -38,7 +37,6 @@ var DEFAULT_SERVICE_PORT = 443;

var CODE_GEN_NAME_VERSION = 'gapic/0.1.0';

var DEFAULT_TIMEOUT = 30;

/**
* The scopes needed to make gRPC calls to all of the methods defined in
Expand All @@ -65,42 +63,43 @@ var ALL_SCOPES = [
*
* @class
*/
function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
function ImageAnnotatorApi(gaxGrpc, grpcClients, opts) {
opts = opts || {};
var servicePath = opts.servicePath || SERVICE_ADDRESS;
var port = opts.port || DEFAULT_SERVICE_PORT;
var sslCreds = opts.sslCreds || null;
var clientConfig = opts.clientConfig || {};
var timeout = opts.timeout || DEFAULT_TIMEOUT;
var appName = opts.appName || 'gax';
var appVersion = opts.appVersion || gax.Version;
var appVersion = opts.appVersion || gax.version;

var googleApiClient = [
appName + '/' + appVersion,
CODE_GEN_NAME_VERSION,
'gax/' + gax.version,
'nodejs/' + process.version].join(' ');

var defaults = gaxGrpc.constructSettings(
'google.cloud.vision.v1.ImageAnnotator',
configData,
clientConfig,
timeout,
null,
null,
{'x-goog-api-client': googleApiClient});

var stub = gaxGrpc.createStub(
var imageAnnotatorStub = gaxGrpc.createStub(
servicePath,
port,
grpcClient.google.cloud.vision.v1.ImageAnnotator,
grpcClients.imageAnnotatorClient.google.cloud.vision.v1.ImageAnnotator,
{sslCreds: sslCreds});
var methods = [
var imageAnnotatorStubMethods = [
'batchAnnotateImages'
];
methods.forEach(function(methodName) {
imageAnnotatorStubMethods.forEach(function(methodName) {
this['_' + methodName] = gax.createApiCall(
stub.then(function(stub) { return stub[methodName].bind(stub); }),
defaults[methodName]);
imageAnnotatorStub.then(function(imageAnnotatorStub) {
return imageAnnotatorStub[methodName].bind(imageAnnotatorStub);
}),
defaults[methodName]);
}.bind(this));
}

Expand All @@ -113,9 +112,9 @@ function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
* Individual image annotation requests for this batch.
*
* This object should have the same structure as [AnnotateImageRequest]{@link AnnotateImageRequest}
* @param {gax.CallOptions=} options
* Overrides the default settings for this call, e.g, timeout,
* retries, etc.
* @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.
*
Expand All @@ -135,28 +134,37 @@ function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
* // doThingsWith(response)
* });
*/
ImageAnnotatorApi.prototype.batchAnnotateImages = function batchAnnotateImages() {
var args = arguejs({
requests: Array,
options: [gax.CallOptions],
callback: [Function]
}, arguments);
ImageAnnotatorApi.prototype.batchAnnotateImages = function batchAnnotateImages(
requests,
options,
callback) {
if (options instanceof Function && callback === undefined) {
callback = options;
options = {};
}
if (options === undefined) {
options = {};
}
var req = {
requests: args.requests
requests: requests
};
return this._batchAnnotateImages(req, args.options, args.callback);
return this._batchAnnotateImages(req, options, callback);
};

function ImageAnnotatorApiBuilder(gaxGrpc) {
if (!(this instanceof ImageAnnotatorApiBuilder)) {
return new ImageAnnotatorApiBuilder(gaxGrpc);
}

var grpcClient = gaxGrpc.load([{
var imageAnnotatorClient = gaxGrpc.load([{
root: require('google-proto-files')('..'),
file: 'google/cloud/vision/v1/image_annotator.proto'
}]);
extend(this, grpcClient.google.cloud.vision.v1);
extend(this, imageAnnotatorClient.google.cloud.vision.v1);

var grpcClients = {
imageAnnotatorClient: imageAnnotatorClient
};

/**
* Build a new instance of {@link ImageAnnotatorApi}.
Expand All @@ -171,15 +179,13 @@ function ImageAnnotatorApiBuilder(gaxGrpc) {
* @param {Object=} opts.clientConfig
* The customized config to build the call settings. See
* {@link gax.constructSettings} for the format.
* @param {number=} opts.timeout
* The default timeout, in seconds, for calls made through this client.
* @param {number=} opts.appName
* The codename of the calling service.
* @param {String=} opts.appVersion
* The version of the calling service.
*/
this.imageAnnotatorApi = function(opts) {
return new ImageAnnotatorApi(gaxGrpc, grpcClient, opts);
return new ImageAnnotatorApi(gaxGrpc, grpcClients, opts);
};
extend(this.imageAnnotatorApi, ImageAnnotatorApi);
}
Expand Down

0 comments on commit f374267

Please sign in to comment.