@@ -109,7 +109,9 @@ function LanguageServiceApi(gaxGrpc, grpcClients, opts) {
109109/**
110110 * Analyzes the sentiment of the provided text.
111111 *
112- * @param {Object } document
112+ * @param {Object } request
113+ * The request object that will be sent.
114+ * @param {Object } request.document
113115 * Input document. Currently, `analyzeSentiment` only supports English text
114116 * ({@link Document.language}="EN").
115117 *
@@ -121,47 +123,41 @@ function LanguageServiceApi(gaxGrpc, grpcClients, opts) {
121123 * The function which will be called with the result of the API call.
122124 *
123125 * The second parameter to the callback is an object representing [AnalyzeSentimentResponse]{@link AnalyzeSentimentResponse}
124- * @returns {gax.EventEmitter } - the event emitter to handle the call
125- * status .
126+ * @returns {Promise } - The promise which resolves to the response object.
127+ * The promise has a method named "cancel" which cancels the ongoing API call .
126128 *
127129 * @example
128130 *
129131 * var api = languageV1beta1.languageServiceApi();
130132 * var document = {};
131- * api.analyzeSentiment(document, function(err, response) {
132- * if (err) {
133- * console.error(err);
134- * return;
135- * }
133+ * api.analyzeSentiment({document: document}).then(function(response) {
136134 * // doThingsWith(response)
135+ * }).catch(function(err) {
136+ * console.error(err);
137137 * });
138138 */
139- LanguageServiceApi . prototype . analyzeSentiment = function analyzeSentiment (
140- document ,
141- options ,
142- callback ) {
139+ LanguageServiceApi . prototype . analyzeSentiment = function ( request , options , callback ) {
143140 if ( options instanceof Function && callback === undefined ) {
144141 callback = options ;
145142 options = { } ;
146143 }
147144 if ( options === undefined ) {
148145 options = { } ;
149146 }
150- var req = {
151- document : document
152- } ;
153- return this . _analyzeSentiment ( req , options , callback ) ;
147+ return this . _analyzeSentiment ( request , options , callback ) ;
154148} ;
155149
156150/**
157151 * Finds named entities (currently finds proper names) in the text,
158152 * entity types, salience, mentions for each entity, and other properties.
159153 *
160- * @param {Object } document
154+ * @param {Object } request
155+ * The request object that will be sent.
156+ * @param {Object } request.document
161157 * Input document.
162158 *
163159 * This object should have the same structure as [Document]{@link Document}
164- * @param {number } encodingType
160+ * @param {number } request. encodingType
165161 * The encoding type used by the API to calculate offsets.
166162 *
167163 * The number should be among the values of [EncodingType]{@link EncodingType}
@@ -172,39 +168,33 @@ LanguageServiceApi.prototype.analyzeSentiment = function analyzeSentiment(
172168 * The function which will be called with the result of the API call.
173169 *
174170 * The second parameter to the callback is an object representing [AnalyzeEntitiesResponse]{@link AnalyzeEntitiesResponse}
175- * @returns {gax.EventEmitter } - the event emitter to handle the call
176- * status .
171+ * @returns {Promise } - The promise which resolves to the response object.
172+ * The promise has a method named "cancel" which cancels the ongoing API call .
177173 *
178174 * @example
179175 *
180176 * var api = languageV1beta1.languageServiceApi();
181177 * var document = {};
182178 * var encodingType = EncodingType.NONE;
183- * api.analyzeEntities(document, encodingType, function(err, response) {
184- * if (err) {
185- * console.error(err);
186- * return ;
187- * }
179+ * var request = {
180+ * document: document,
181+ * encodingType: encodingType
182+ * } ;
183+ * api.analyzeEntities(request).then(function(response) {
188184 * // doThingsWith(response)
185+ * }).catch(function(err) {
186+ * console.error(err);
189187 * });
190188 */
191- LanguageServiceApi . prototype . analyzeEntities = function analyzeEntities (
192- document ,
193- encodingType ,
194- options ,
195- callback ) {
189+ LanguageServiceApi . prototype . analyzeEntities = function ( request , options , callback ) {
196190 if ( options instanceof Function && callback === undefined ) {
197191 callback = options ;
198192 options = { } ;
199193 }
200194 if ( options === undefined ) {
201195 options = { } ;
202196 }
203- var req = {
204- document : document ,
205- encodingType : encodingType
206- } ;
207- return this . _analyzeEntities ( req , options , callback ) ;
197+ return this . _analyzeEntities ( request , options , callback ) ;
208198} ;
209199
210200/**
@@ -213,15 +203,17 @@ LanguageServiceApi.prototype.analyzeEntities = function analyzeEntities(
213203 * API is intended for users who are familiar with machine learning and need
214204 * in-depth text features to build upon.
215205 *
216- * @param {Object } document
206+ * @param {Object } request
207+ * The request object that will be sent.
208+ * @param {Object } request.document
217209 * Input document.
218210 *
219211 * This object should have the same structure as [Document]{@link Document}
220- * @param {Object } features
212+ * @param {Object } request. features
221213 * The enabled features.
222214 *
223215 * This object should have the same structure as [Features]{@link Features}
224- * @param {number } encodingType
216+ * @param {number } request. encodingType
225217 * The encoding type used by the API to calculate offsets.
226218 *
227219 * The number should be among the values of [EncodingType]{@link EncodingType}
@@ -232,42 +224,35 @@ LanguageServiceApi.prototype.analyzeEntities = function analyzeEntities(
232224 * The function which will be called with the result of the API call.
233225 *
234226 * The second parameter to the callback is an object representing [AnnotateTextResponse]{@link AnnotateTextResponse}
235- * @returns {gax.EventEmitter } - the event emitter to handle the call
236- * status .
227+ * @returns {Promise } - The promise which resolves to the response object.
228+ * The promise has a method named "cancel" which cancels the ongoing API call .
237229 *
238230 * @example
239231 *
240232 * var api = languageV1beta1.languageServiceApi();
241233 * var document = {};
242234 * var features = {};
243235 * var encodingType = EncodingType.NONE;
244- * api.annotateText(document, features, encodingType, function(err, response) {
245- * if (err) {
246- * console.error(err);
247- * return;
248- * }
236+ * var request = {
237+ * document: document,
238+ * features: features,
239+ * encodingType: encodingType
240+ * };
241+ * api.annotateText(request).then(function(response) {
249242 * // doThingsWith(response)
243+ * }).catch(function(err) {
244+ * console.error(err);
250245 * });
251246 */
252- LanguageServiceApi . prototype . annotateText = function annotateText (
253- document ,
254- features ,
255- encodingType ,
256- options ,
257- callback ) {
247+ LanguageServiceApi . prototype . annotateText = function ( request , options , callback ) {
258248 if ( options instanceof Function && callback === undefined ) {
259249 callback = options ;
260250 options = { } ;
261251 }
262252 if ( options === undefined ) {
263253 options = { } ;
264254 }
265- var req = {
266- document : document ,
267- features : features ,
268- encodingType : encodingType
269- } ;
270- return this . _annotateText ( req , options , callback ) ;
255+ return this . _annotateText ( request , options , callback ) ;
271256} ;
272257
273258function LanguageServiceApiBuilder ( gaxGrpc ) {
0 commit comments