# coding: utf-8

"""
    ASR documentation

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: 1.1

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from speechpro.cloud.speech.recognition.rest.cloud_client.cloud_api_client import CloudApiClient


class RecognizeApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = CloudApiClient()
        self.api_client = api_client

    def close(self, x_session_id, x_transaction_id, **kwargs):  # noqa: E501
        """Close transaction  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.close(x_session_id, x_transaction_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param str x_transaction_id: Session identifier (required)
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.close_with_http_info(x_session_id, x_transaction_id, **kwargs)  # noqa: E501
        else:
            (data) = self.close_with_http_info(x_session_id, x_transaction_id, **kwargs)  # noqa: E501
            return data

    def close_with_http_info(self, x_session_id, x_transaction_id, **kwargs):  # noqa: E501
        """Close transaction  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.close_with_http_info(x_session_id, x_transaction_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param str x_transaction_id: Session identifier (required)
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_session_id', 'x_transaction_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method close" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'x_session_id' is set
        if ('x_session_id' not in params or
                params['x_session_id'] is None):
            raise ValueError("Missing the required parameter `x_session_id` when calling `close`")  # noqa: E501
        # verify the required parameter 'x_transaction_id' is set
        if ('x_transaction_id' not in params or
                params['x_transaction_id'] is None):
            raise ValueError("Missing the required parameter `x_transaction_id` when calling `close`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_session_id' in params:
            header_params['X-Session-ID'] = params['x_session_id']  # noqa: E501
        if 'x_transaction_id' in params:
            header_params['X-Transaction-Id'] = params['x_transaction_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/stream', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ASRResultDto',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def recognize(self, x_session_id, body, **kwargs):  # noqa: E501
        """Get speech recognition result  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.recognize_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.recognize_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
            return data

    def recognize_with_http_info(self, x_session_id, body, **kwargs):  # noqa: E501
        """Get speech recognition result  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_with_http_info(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_session_id', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recognize" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'x_session_id' is set
        if ('x_session_id' not in params or
                params['x_session_id'] is None):
            raise ValueError("Missing the required parameter `x_session_id` when calling `recognize`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `recognize`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_session_id' in params:
            header_params['X-Session-ID'] = params['x_session_id']  # noqa: E501
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ASRResultDto',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def recognize_advanced(self, x_session_id, body, **kwargs):  # noqa: E501
        """Recognize speech with advanced options  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_advanced(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param AdvancedRecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: list[ASRAdvancedResultDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.recognize_advanced_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.recognize_advanced_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
            return data

    def recognize_advanced_with_http_info(self, x_session_id, body, **kwargs):  # noqa: E501
        """Recognize speech with advanced options  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_advanced_with_http_info(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param AdvancedRecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: list[ASRAdvancedResultDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_session_id', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recognize_advanced" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'x_session_id' is set
        if ('x_session_id' not in params or
                params['x_session_id'] is None):
            raise ValueError("Missing the required parameter `x_session_id` when calling `recognize_advanced`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `recognize_advanced`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_session_id' in params:
            header_params['X-Session-ID'] = params['x_session_id']  # noqa: E501
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/advanced', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[ASRAdvancedResultDto]',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def recognize_sessionless(self, body, **kwargs):  # noqa: E501
        """Get speech recognition result  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_sessionless(body, async=True)
        >>> result = thread.get()

        :param async bool
        :param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
        :param str x_request_id: Request identifier
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.recognize_sessionless_with_http_info(body, **kwargs)  # noqa: E501
        else:
            (data) = self.recognize_sessionless_with_http_info(body, **kwargs)  # noqa: E501
            return data

    def recognize_sessionless_with_http_info(self, body, **kwargs):  # noqa: E501
        """Get speech recognition result  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_sessionless_with_http_info(body, async=True)
        >>> result = thread.get()

        :param async bool
        :param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
        :param str x_request_id: Request identifier
        :return: ASRResultDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recognize_sessionless" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `recognize_sessionless`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/sessionless', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ASRResultDto',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def recognize_words(self, x_session_id, body, **kwargs):  # noqa: E501
        """Recognize speech and return word list  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_words(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: list[WordDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.recognize_words_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.recognize_words_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
            return data

    def recognize_words_with_http_info(self, x_session_id, body, **kwargs):  # noqa: E501
        """Recognize speech and return word list  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_words_with_http_info(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param RecognitionRequestDto body: Recognition request with audio file, mime type and package ID (required)
        :param str x_request_id: Request identifier
        :return: list[WordDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_session_id', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recognize_words" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'x_session_id' is set
        if ('x_session_id' not in params or
                params['x_session_id'] is None):
            raise ValueError("Missing the required parameter `x_session_id` when calling `recognize_words`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `recognize_words`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_session_id' in params:
            header_params['X-Session-ID'] = params['x_session_id']  # noqa: E501
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/words', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[WordDto]',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def recognize_words_sessionless(self, body, **kwargs):  # noqa: E501
        """Recognize speech without session and return word list  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_words_sessionless(body, async=True)
        >>> result = thread.get()

        :param async bool
        :param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
        :param str x_request_id: Request identifier
        :return: list[WordDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.recognize_words_sessionless_with_http_info(body, **kwargs)  # noqa: E501
        else:
            (data) = self.recognize_words_sessionless_with_http_info(body, **kwargs)  # noqa: E501
            return data

    def recognize_words_sessionless_with_http_info(self, body, **kwargs):  # noqa: E501
        """Recognize speech without session and return word list  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.recognize_words_sessionless_with_http_info(body, async=True)
        >>> result = thread.get()

        :param async bool
        :param SessionlessRecognitionRequestDto body: Request with user login data and recognition request (required)
        :param str x_request_id: Request identifier
        :return: list[WordDto]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recognize_words_sessionless" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `recognize_words_sessionless`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/sessionless/words', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[WordDto]',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def start(self, x_session_id, body, **kwargs):  # noqa: E501
        """Start recognition stream  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.start(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param StreamRequestDto body: Transaction parameters (required)
        :param str x_request_id: Request identifier
        :return: StreamResponseDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.start_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.start_with_http_info(x_session_id, body, **kwargs)  # noqa: E501
            return data

    def start_with_http_info(self, x_session_id, body, **kwargs):  # noqa: E501
        """Start recognition stream  # noqa: E501

          # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.start_with_http_info(x_session_id, body, async=True)
        >>> result = thread.get()

        :param async bool
        :param str x_session_id: Session identifier (required)
        :param StreamRequestDto body: Transaction parameters (required)
        :param str x_request_id: Request identifier
        :return: StreamResponseDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['x_session_id', 'body', 'x_request_id']  # noqa: E501
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method start" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'x_session_id' is set
        if ('x_session_id' not in params or
                params['x_session_id'] is None):
            raise ValueError("Missing the required parameter `x_session_id` when calling `start`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `start`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'x_session_id' in params:
            header_params['X-Session-ID'] = params['x_session_id']  # noqa: E501
        if 'x_request_id' in params:
            header_params['X-Request-Id'] = params['x_request_id']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=UTF-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json;charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/vkasr/rest/v1/recognize/stream', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='StreamResponseDto',  # noqa: E501
            auth_settings=auth_settings,
            async_=params.get('async'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
