Skip to content

Commit f374267

Browse files
jmukstephenplusplus
authored andcommitted
Regenerate the codegen files to sync with the latest version. (#1640)
1 parent 98f0cfb commit f374267

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

packages/google-cloud-vision/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@
5151
],
5252
"dependencies": {
5353
"@google-cloud/common": "^0.6.0",
54-
"arguejs": "^0.2.3",
5554
"arrify": "^1.0.0",
5655
"async": "^2.0.1",
5756
"extend": "^3.0.0",
58-
"google-gax": "^0.6.0",
57+
"google-gax": "^0.7.0",
5958
"google-proto-files": "^0.8.0",
6059
"is": "^3.0.1",
6160
"propprop": "^0.3.0",

packages/google-cloud-vision/src/v1/image_annotator_api.js

+34-28
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/* jscs: disable maximumLineLength */
2828
'use strict';
2929

30-
var arguejs = require('arguejs');
3130
var configData = require('./image_annotator_client_config');
3231
var extend = require('extend');
3332
var gax = require('google-gax');
@@ -38,7 +37,6 @@ var DEFAULT_SERVICE_PORT = 443;
3837

3938
var CODE_GEN_NAME_VERSION = 'gapic/0.1.0';
4039

41-
var DEFAULT_TIMEOUT = 30;
4240

4341
/**
4442
* The scopes needed to make gRPC calls to all of the methods defined in
@@ -65,42 +63,43 @@ var ALL_SCOPES = [
6563
*
6664
* @class
6765
*/
68-
function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
66+
function ImageAnnotatorApi(gaxGrpc, grpcClients, opts) {
6967
opts = opts || {};
7068
var servicePath = opts.servicePath || SERVICE_ADDRESS;
7169
var port = opts.port || DEFAULT_SERVICE_PORT;
7270
var sslCreds = opts.sslCreds || null;
7371
var clientConfig = opts.clientConfig || {};
74-
var timeout = opts.timeout || DEFAULT_TIMEOUT;
7572
var appName = opts.appName || 'gax';
76-
var appVersion = opts.appVersion || gax.Version;
73+
var appVersion = opts.appVersion || gax.version;
7774

7875
var googleApiClient = [
7976
appName + '/' + appVersion,
8077
CODE_GEN_NAME_VERSION,
78+
'gax/' + gax.version,
8179
'nodejs/' + process.version].join(' ');
8280

8381
var defaults = gaxGrpc.constructSettings(
8482
'google.cloud.vision.v1.ImageAnnotator',
8583
configData,
8684
clientConfig,
87-
timeout,
8885
null,
8986
null,
9087
{'x-goog-api-client': googleApiClient});
9188

92-
var stub = gaxGrpc.createStub(
89+
var imageAnnotatorStub = gaxGrpc.createStub(
9390
servicePath,
9491
port,
95-
grpcClient.google.cloud.vision.v1.ImageAnnotator,
92+
grpcClients.imageAnnotatorClient.google.cloud.vision.v1.ImageAnnotator,
9693
{sslCreds: sslCreds});
97-
var methods = [
94+
var imageAnnotatorStubMethods = [
9895
'batchAnnotateImages'
9996
];
100-
methods.forEach(function(methodName) {
97+
imageAnnotatorStubMethods.forEach(function(methodName) {
10198
this['_' + methodName] = gax.createApiCall(
102-
stub.then(function(stub) { return stub[methodName].bind(stub); }),
103-
defaults[methodName]);
99+
imageAnnotatorStub.then(function(imageAnnotatorStub) {
100+
return imageAnnotatorStub[methodName].bind(imageAnnotatorStub);
101+
}),
102+
defaults[methodName]);
104103
}.bind(this));
105104
}
106105

@@ -113,9 +112,9 @@ function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
113112
* Individual image annotation requests for this batch.
114113
*
115114
* This object should have the same structure as [AnnotateImageRequest]{@link AnnotateImageRequest}
116-
* @param {gax.CallOptions=} options
117-
* Overrides the default settings for this call, e.g, timeout,
118-
* retries, etc.
115+
* @param {Object=} options
116+
* Optional parameters. You can override the default settings for this call, e.g, timeout,
117+
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
119118
* @param {function(?Error, ?Object)=} callback
120119
* The function which will be called with the result of the API call.
121120
*
@@ -135,28 +134,37 @@ function ImageAnnotatorApi(gaxGrpc, grpcClient, opts) {
135134
* // doThingsWith(response)
136135
* });
137136
*/
138-
ImageAnnotatorApi.prototype.batchAnnotateImages = function batchAnnotateImages() {
139-
var args = arguejs({
140-
requests: Array,
141-
options: [gax.CallOptions],
142-
callback: [Function]
143-
}, arguments);
137+
ImageAnnotatorApi.prototype.batchAnnotateImages = function batchAnnotateImages(
138+
requests,
139+
options,
140+
callback) {
141+
if (options instanceof Function && callback === undefined) {
142+
callback = options;
143+
options = {};
144+
}
145+
if (options === undefined) {
146+
options = {};
147+
}
144148
var req = {
145-
requests: args.requests
149+
requests: requests
146150
};
147-
return this._batchAnnotateImages(req, args.options, args.callback);
151+
return this._batchAnnotateImages(req, options, callback);
148152
};
149153

150154
function ImageAnnotatorApiBuilder(gaxGrpc) {
151155
if (!(this instanceof ImageAnnotatorApiBuilder)) {
152156
return new ImageAnnotatorApiBuilder(gaxGrpc);
153157
}
154158

155-
var grpcClient = gaxGrpc.load([{
159+
var imageAnnotatorClient = gaxGrpc.load([{
156160
root: require('google-proto-files')('..'),
157161
file: 'google/cloud/vision/v1/image_annotator.proto'
158162
}]);
159-
extend(this, grpcClient.google.cloud.vision.v1);
163+
extend(this, imageAnnotatorClient.google.cloud.vision.v1);
164+
165+
var grpcClients = {
166+
imageAnnotatorClient: imageAnnotatorClient
167+
};
160168

161169
/**
162170
* Build a new instance of {@link ImageAnnotatorApi}.
@@ -171,15 +179,13 @@ function ImageAnnotatorApiBuilder(gaxGrpc) {
171179
* @param {Object=} opts.clientConfig
172180
* The customized config to build the call settings. See
173181
* {@link gax.constructSettings} for the format.
174-
* @param {number=} opts.timeout
175-
* The default timeout, in seconds, for calls made through this client.
176182
* @param {number=} opts.appName
177183
* The codename of the calling service.
178184
* @param {String=} opts.appVersion
179185
* The version of the calling service.
180186
*/
181187
this.imageAnnotatorApi = function(opts) {
182-
return new ImageAnnotatorApi(gaxGrpc, grpcClient, opts);
188+
return new ImageAnnotatorApi(gaxGrpc, grpcClients, opts);
183189
};
184190
extend(this.imageAnnotatorApi, ImageAnnotatorApi);
185191
}

0 commit comments

Comments
 (0)