@@ -251,3 +251,113 @@ def sync_recognise_emotion_with_http_info(self, body, **kwargs):
251251 _preload_content = params .get ('_preload_content' , True ),
252252 _request_timeout = params .get ('_request_timeout' ),
253253 collection_formats = collection_formats )
254+ def sync_text_recognise_emotion (self , body , ** kwargs ):
255+ """
256+ Find emotion in text
257+ Extract emotion from text.
258+ This method makes a synchronous HTTP request by default. To make an
259+ asynchronous HTTP request, please define a `callback` function
260+ to be invoked when receiving the response.
261+ >>> def callback_function(response):
262+ >>> pprint(response)
263+ >>>
264+ >>> thread = api.sync_text_recognise_emotion(body, callback=callback_function)
265+
266+ :param callback function: The callback function
267+ for asynchronous request. (optional)
268+ :param Text: Text that needs to be featurized. (required)
269+ :return: list[EmotionScore]
270+ If the method is called asynchronously,
271+ returns the request thread.
272+ """
273+ kwargs ['_return_http_data_only' ] = True
274+ if kwargs .get ('callback' ):
275+ return self .sync_text_recognise_emotion_with_http_info (body , ** kwargs )
276+ else :
277+ (data ) = self .sync_text_recognise_emotion_with_http_info (body , ** kwargs )
278+ return data
279+
280+ def sync_text_recognise_emotion_with_http_info (self , body , ** kwargs ):
281+ """
282+ Find emotion in text
283+ Extract emotion from text.
284+ This method makes a synchronous HTTP request by default. To make an
285+ asynchronous HTTP request, please define a `callback` function
286+ to be invoked when receiving the response.
287+ >>> def callback_function(response):
288+ >>> pprint(response)
289+ >>>
290+ >>> thread = api.sync_text_recognise_emotion_with_http_info(body, callback=callback_function)
291+
292+ :param callback function: The callback function
293+ for asynchronous request. (optional)
294+ :param Text body: Text that needs to be featurized. (required)
295+ :return: list[EmotionScore]
296+ If the method is called asynchronously,
297+ returns the request thread.
298+ """
299+
300+ all_params = ['body' ]
301+ all_params .append ('callback' )
302+ all_params .append ('_return_http_data_only' )
303+ all_params .append ('_preload_content' )
304+ all_params .append ('_request_timeout' )
305+
306+ params = locals ()
307+ for key , val in iteritems (params ['kwargs' ]):
308+ if key not in all_params :
309+ raise TypeError (
310+ "Got an unexpected keyword argument '%s'"
311+ " to method sync_text_recognise_emotion" % key
312+ )
313+ params [key ] = val
314+ del params ['kwargs' ]
315+ # verify the required parameter 'body' is set
316+ if ('body' not in params ) or (params ['body' ] is None ):
317+ raise ValueError (
318+ "Missing the required parameter `body` when calling `sync_text_recognise_emotion`" )
319+
320+ collection_formats = {}
321+
322+ resource_path = '/text/generic/api/latest/sync/text_recognise_emotion' .replace (
323+ '{format}' , 'json' )
324+ path_params = {}
325+
326+ query_params = []
327+
328+ header_params = {}
329+
330+ form_params = []
331+ local_var_files = {}
332+
333+ body_params = None
334+ if 'body' in params :
335+ body_params = params ['body' ]
336+ # HTTP header `Accept`
337+ header_params ['Accept' ] = self .api_client .\
338+ select_header_accept (['application/json' ])
339+
340+ # HTTP header `Content-Type`
341+ header_params ['Content-Type' ] = self .api_client .\
342+ select_header_content_type (['application/json' ])
343+
344+ # Authentication setting
345+ auth_settings = ['UserSecurity' ]
346+
347+ return self .api_client .call_api (resource_path , 'POST' ,
348+ path_params ,
349+ query_params ,
350+ header_params ,
351+ body = body_params ,
352+ post_params = form_params ,
353+ files = local_var_files ,
354+ response_type = 'json' ,
355+ auth_settings = auth_settings ,
356+ callback = params .get ('callback' ),
357+ _return_http_data_only = params .get (
358+ '_return_http_data_only' ),
359+ _preload_content = params .get (
360+ '_preload_content' , True ),
361+ _request_timeout = params .get (
362+ '_request_timeout' ),
363+ collection_formats = collection_formats )
0 commit comments