Skip to content

Commit 8b70b95

Browse files
jmukstephenplusplus
authored andcommitted
Regenerate language service API (#1824)
1 parent 47526b9 commit 8b70b95

File tree

4 files changed

+49
-37
lines changed

4 files changed

+49
-37
lines changed

packages/google-cloud-language/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function Language(options) {
6464
}
6565

6666
this.api = {
67-
Language: v1(options).languageServiceApi(options)
67+
Language: v1(options).languageServiceClient(options)
6868
};
6969
}
7070

packages/google-cloud-language/src/v1/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
'use strict';
1717

18-
var languageServiceApi = require('./language_service_api');
18+
var languageServiceClient = require('./language_service_client');
1919
var extend = require('extend');
2020
var gax = require('google-gax');
2121

@@ -24,9 +24,9 @@ function v1(options) {
2424
scopes: v1.ALL_SCOPES
2525
}, options);
2626
var gaxGrpc = gax.grpc(options);
27-
return languageServiceApi(gaxGrpc);
27+
return languageServiceClient(gaxGrpc);
2828
}
2929

30-
v1.SERVICE_ADDRESS = languageServiceApi.SERVICE_ADDRESS;
31-
v1.ALL_SCOPES = languageServiceApi.ALL_SCOPES;
30+
v1.SERVICE_ADDRESS = languageServiceClient.SERVICE_ADDRESS;
31+
v1.ALL_SCOPES = languageServiceClient.ALL_SCOPES;
3232
module.exports = v1;

packages/google-cloud-language/src/v1/language_service_api.js renamed to packages/google-cloud-language/src/v1/language_service_client.js

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ var ALL_SCOPES = [
5151
*
5252
* This will be created through a builder function which can be obtained by the module.
5353
* See the following example of how to initialize the module and how to access to the builder.
54-
* @see {@link languageServiceApi}
54+
* @see {@link languageServiceClient}
5555
*
5656
* @example
5757
* var languageV1 = require('@google-cloud/language').v1({
5858
* // optional auth parameters.
5959
* });
60-
* var api = languageV1.languageServiceApi();
60+
* var client = languageV1.languageServiceClient();
6161
*
6262
* @class
6363
*/
64-
function LanguageServiceApi(gaxGrpc, grpcClients, opts) {
64+
function LanguageServiceClient(gaxGrpc, grpcClients, opts) {
6565
opts = opts || {};
6666
var servicePath = opts.servicePath || SERVICE_ADDRESS;
6767
var port = opts.port || DEFAULT_SERVICE_PORT;
@@ -126,27 +126,30 @@ function LanguageServiceApi(gaxGrpc, grpcClients, opts) {
126126
* The function which will be called with the result of the API call.
127127
*
128128
* The second parameter to the callback is an object representing [AnalyzeSentimentResponse]{@link AnalyzeSentimentResponse}.
129-
* @returns {Promise} - The promise which resolves to the response object.
129+
* @return {Promise} - The promise which resolves to an array.
130+
* The first element of the array is an object representing [AnalyzeSentimentResponse]{@link AnalyzeSentimentResponse}.
130131
* The promise has a method named "cancel" which cancels the ongoing API call.
131132
*
132133
* @example
133134
*
134-
* var api = languageV1.languageServiceApi();
135+
* var client = languageV1.languageServiceClient();
135136
* var document = {};
136-
* api.analyzeSentiment({document: document}).then(function(response) {
137+
* client.analyzeSentiment({document: document}).then(function(responses) {
138+
* var response = responses[0];
137139
* // doThingsWith(response)
138140
* }).catch(function(err) {
139141
* console.error(err);
140142
* });
141143
*/
142-
LanguageServiceApi.prototype.analyzeSentiment = function(request, options, callback) {
144+
LanguageServiceClient.prototype.analyzeSentiment = function(request, options, callback) {
143145
if (options instanceof Function && callback === undefined) {
144146
callback = options;
145147
options = {};
146148
}
147149
if (options === undefined) {
148150
options = {};
149151
}
152+
150153
return this._analyzeSentiment(request, options, callback);
151154
};
152155

@@ -171,32 +174,35 @@ LanguageServiceApi.prototype.analyzeSentiment = function(request, options, callb
171174
* The function which will be called with the result of the API call.
172175
*
173176
* The second parameter to the callback is an object representing [AnalyzeEntitiesResponse]{@link AnalyzeEntitiesResponse}.
174-
* @returns {Promise} - The promise which resolves to the response object.
177+
* @return {Promise} - The promise which resolves to an array.
178+
* The first element of the array is an object representing [AnalyzeEntitiesResponse]{@link AnalyzeEntitiesResponse}.
175179
* The promise has a method named "cancel" which cancels the ongoing API call.
176180
*
177181
* @example
178182
*
179-
* var api = languageV1.languageServiceApi();
183+
* var client = languageV1.languageServiceClient();
180184
* var document = {};
181-
* var encodingType = EncodingType.NONE;
185+
* var encodingType = languageV1.EncodingType.NONE;
182186
* var request = {
183187
* document: document,
184188
* encodingType: encodingType
185189
* };
186-
* api.analyzeEntities(request).then(function(response) {
190+
* client.analyzeEntities(request).then(function(responses) {
191+
* var response = responses[0];
187192
* // doThingsWith(response)
188193
* }).catch(function(err) {
189194
* console.error(err);
190195
* });
191196
*/
192-
LanguageServiceApi.prototype.analyzeEntities = function(request, options, callback) {
197+
LanguageServiceClient.prototype.analyzeEntities = function(request, options, callback) {
193198
if (options instanceof Function && callback === undefined) {
194199
callback = options;
195200
options = {};
196201
}
197202
if (options === undefined) {
198203
options = {};
199204
}
205+
200206
return this._analyzeEntities(request, options, callback);
201207
};
202208

@@ -222,32 +228,35 @@ LanguageServiceApi.prototype.analyzeEntities = function(request, options, callba
222228
* The function which will be called with the result of the API call.
223229
*
224230
* The second parameter to the callback is an object representing [AnalyzeSyntaxResponse]{@link AnalyzeSyntaxResponse}.
225-
* @returns {Promise} - The promise which resolves to the response object.
231+
* @return {Promise} - The promise which resolves to an array.
232+
* The first element of the array is an object representing [AnalyzeSyntaxResponse]{@link AnalyzeSyntaxResponse}.
226233
* The promise has a method named "cancel" which cancels the ongoing API call.
227234
*
228235
* @example
229236
*
230-
* var api = languageV1.languageServiceApi();
237+
* var client = languageV1.languageServiceClient();
231238
* var document = {};
232-
* var encodingType = EncodingType.NONE;
239+
* var encodingType = languageV1.EncodingType.NONE;
233240
* var request = {
234241
* document: document,
235242
* encodingType: encodingType
236243
* };
237-
* api.analyzeSyntax(request).then(function(response) {
244+
* client.analyzeSyntax(request).then(function(responses) {
245+
* var response = responses[0];
238246
* // doThingsWith(response)
239247
* }).catch(function(err) {
240248
* console.error(err);
241249
* });
242250
*/
243-
LanguageServiceApi.prototype.analyzeSyntax = function(request, options, callback) {
251+
LanguageServiceClient.prototype.analyzeSyntax = function(request, options, callback) {
244252
if (options instanceof Function && callback === undefined) {
245253
callback = options;
246254
options = {};
247255
}
248256
if (options === undefined) {
249257
options = {};
250258
}
259+
251260
return this._analyzeSyntax(request, options, callback);
252261
};
253262

@@ -276,40 +285,43 @@ LanguageServiceApi.prototype.analyzeSyntax = function(request, options, callback
276285
* The function which will be called with the result of the API call.
277286
*
278287
* The second parameter to the callback is an object representing [AnnotateTextResponse]{@link AnnotateTextResponse}.
279-
* @returns {Promise} - The promise which resolves to the response object.
288+
* @return {Promise} - The promise which resolves to an array.
289+
* The first element of the array is an object representing [AnnotateTextResponse]{@link AnnotateTextResponse}.
280290
* The promise has a method named "cancel" which cancels the ongoing API call.
281291
*
282292
* @example
283293
*
284-
* var api = languageV1.languageServiceApi();
294+
* var client = languageV1.languageServiceClient();
285295
* var document = {};
286296
* var features = {};
287-
* var encodingType = EncodingType.NONE;
297+
* var encodingType = languageV1.EncodingType.NONE;
288298
* var request = {
289299
* document: document,
290300
* features: features,
291301
* encodingType: encodingType
292302
* };
293-
* api.annotateText(request).then(function(response) {
303+
* client.annotateText(request).then(function(responses) {
304+
* var response = responses[0];
294305
* // doThingsWith(response)
295306
* }).catch(function(err) {
296307
* console.error(err);
297308
* });
298309
*/
299-
LanguageServiceApi.prototype.annotateText = function(request, options, callback) {
310+
LanguageServiceClient.prototype.annotateText = function(request, options, callback) {
300311
if (options instanceof Function && callback === undefined) {
301312
callback = options;
302313
options = {};
303314
}
304315
if (options === undefined) {
305316
options = {};
306317
}
318+
307319
return this._annotateText(request, options, callback);
308320
};
309321

310-
function LanguageServiceApiBuilder(gaxGrpc) {
311-
if (!(this instanceof LanguageServiceApiBuilder)) {
312-
return new LanguageServiceApiBuilder(gaxGrpc);
322+
function LanguageServiceClientBuilder(gaxGrpc) {
323+
if (!(this instanceof LanguageServiceClientBuilder)) {
324+
return new LanguageServiceClientBuilder(gaxGrpc);
313325
}
314326

315327
var languageServiceClient = gaxGrpc.load([{
@@ -323,7 +335,7 @@ function LanguageServiceApiBuilder(gaxGrpc) {
323335
};
324336

325337
/**
326-
* Build a new instance of {@link LanguageServiceApi}.
338+
* Build a new instance of {@link LanguageServiceClient}.
327339
*
328340
* @param {Object=} opts - The optional parameters.
329341
* @param {String=} opts.servicePath
@@ -340,11 +352,11 @@ function LanguageServiceApiBuilder(gaxGrpc) {
340352
* @param {String=} opts.appVersion
341353
* The version of the calling service.
342354
*/
343-
this.languageServiceApi = function(opts) {
344-
return new LanguageServiceApi(gaxGrpc, grpcClients, opts);
355+
this.languageServiceClient = function(opts) {
356+
return new LanguageServiceClient(gaxGrpc, grpcClients, opts);
345357
};
346-
extend(this.languageServiceApi, LanguageServiceApi);
358+
extend(this.languageServiceClient, LanguageServiceClient);
347359
}
348-
module.exports = LanguageServiceApiBuilder;
360+
module.exports = LanguageServiceClientBuilder;
349361
module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS;
350362
module.exports.ALL_SCOPES = ALL_SCOPES;

packages/google-cloud-language/test/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function fakeV1() {
4444
}
4545

4646
return {
47-
languageServiceApi: util.noop
47+
languageServiceClient: util.noop
4848
};
4949
}
5050

@@ -106,7 +106,7 @@ describe('Language', function() {
106106
assert.strictEqual(options, OPTIONS);
107107

108108
return {
109-
languageServiceApi: function(options) {
109+
languageServiceClient: function(options) {
110110
assert.strictEqual(options, OPTIONS);
111111
return expectedLanguageService;
112112
}

0 commit comments

Comments
 (0)