def update_params_for_auth(self, headers, querys, auth_settings):
        """Updates header and query params based on authentication setting.

        :param headers: Header parameters dict to be updated.
        :param querys: Query parameters tuple list to be updated.
        :param auth_settings: Authentication setting identifiers list.
        """
        if not auth_settings:
            return

        for auth in auth_settings:
            auth_setting = self.configuration.auth_settings().get(auth)
            if auth_setting:
                if auth_setting['in'] == 'cookie':
                    headers['Cookie'] = auth_setting['value']
                elif auth_setting['in'] == 'header':
                    headers[auth_setting['key']] = auth_setting['value']
                elif auth_setting['in'] == 'query':
                    querys.append((auth_setting['key'], auth_setting['value']))
                else:
                    raise ApiValueError(
                        'Authentication token must be in `query` or `header`')
    def v3_stream_sid_share_post_with_http_info(self, sid, session_token,
                                                share_content,
                                                **kwargs):  # noqa: E501
        """PROVISIONAL -  Share a piece of content into Symphony  # noqa: E501

        Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v3_stream_sid_share_post_with_http_info(sid, session_token, share_content, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str sid: Stream ID (required)
        :param str session_token: Session authentication token. (required)
        :param ShareContent share_content: (required)
        :param str key_manager_token: Key Manager authentication token.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(V2Message, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'sid', 'session_token', 'share_content', 'key_manager_token'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method v3_stream_sid_share_post" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'sid' is set
        if self.api_client.client_side_validation and (
                'sid' not in local_var_params or  # noqa: E501
                local_var_params['sid'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `sid` when calling `v3_stream_sid_share_post`"
            )  # noqa: E501
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v3_stream_sid_share_post`"
            )  # noqa: E501
        # verify the required parameter 'share_content' is set
        if self.api_client.client_side_validation and (
                'share_content' not in local_var_params or  # noqa: E501
                local_var_params['share_content'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `share_content` when calling `v3_stream_sid_share_post`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'sid' in local_var_params:
            path_params['sid'] = local_var_params['sid']  # noqa: E501

        query_params = []

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'share_content' in local_var_params:
            body_params = local_var_params['share_content']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v3/stream/{sid}/share',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V2Message',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
예제 #3
0
    def request(self,
                method,
                url,
                query_params=None,
                headers=None,
                body=None,
                post_params=None,
                _preload_content=True,
                _request_timeout=None):
        """Perform requests.

        :param method: http request method
        :param url: http request url
        :param query_params: query parameters in the url
        :param headers: http request headers
        :param body: request json body, for `application/json`
        :param post_params: request post parameters,
                            `application/x-www-form-urlencoded`
                            and `multipart/form-data`
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        """
        method = method.upper()
        assert method in [
            'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'
        ]

        if post_params and body:
            raise ApiValueError(
                "body parameter cannot be used with post_params parameter.")

        post_params = post_params or {}
        headers = headers or {}

        timeout = None
        if _request_timeout:
            if isinstance(_request_timeout, (int, ) if six.PY3 else
                          (int, long)):  # noqa: E501,F821
                timeout = urllib3.Timeout(total=_request_timeout)
            elif (isinstance(_request_timeout, tuple)
                  and len(_request_timeout) == 2):
                timeout = urllib3.Timeout(connect=_request_timeout[0],
                                          read=_request_timeout[1])

        if 'Content-Type' not in headers:
            headers['Content-Type'] = 'application/json'

        try:
            # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
            if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
                if query_params:
                    url += '?' + urlencode(query_params)
                if re.search('json', headers['Content-Type'], re.IGNORECASE):
                    request_body = None
                    if body is not None:
                        request_body = json.dumps(body)
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers[
                        'Content-Type'] == 'application/x-www-form-urlencoded':  # noqa: E501
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=False,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                elif headers['Content-Type'] == 'multipart/form-data':
                    # must del headers['Content-Type'], or the correct
                    # Content-Type which generated by urllib3 will be
                    # overwritten.
                    del headers['Content-Type']
                    r = self.pool_manager.request(
                        method,
                        url,
                        fields=post_params,
                        encode_multipart=True,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                # Pass a `string` parameter directly in the body to support
                # other content types than Json when `body` argument is
                # provided in serialized form
                elif isinstance(body, str) or isinstance(body, bytes):
                    request_body = body
                    r = self.pool_manager.request(
                        method,
                        url,
                        body=request_body,
                        preload_content=_preload_content,
                        timeout=timeout,
                        headers=headers)
                else:
                    # Cannot generate the request from given parameters
                    msg = """Cannot prepare a request message for provided
                             arguments. Please check that your arguments match
                             declared content type."""
                    raise ApiException(status=0, reason=msg)
            # For `GET`, `HEAD`
            else:
                r = self.pool_manager.request(method,
                                              url,
                                              fields=query_params,
                                              preload_content=_preload_content,
                                              timeout=timeout,
                                              headers=headers)
        except urllib3.exceptions.SSLError as e:
            msg = "{0}\n{1}".format(type(e).__name__, str(e))
            raise ApiException(status=0, reason=msg)

        if _preload_content:
            r = RESTResponse(r)

            # log response body
            logger.debug("response body: %s", r.data)

        if not 200 <= r.status <= 299:
            raise ApiException(http_resp=r)

        return r
예제 #4
0
    def v1_audittrail_privilegeduser_get_with_http_info(
            self, session_token, key_manager_token, start_timestamp,
            **kwargs):  # noqa: E501
        """Get a list of  actions performed by a privileged account acting as privileged user given a period of time.  # noqa: E501

        Get a list of actions performed by a privileged account acting as privileged user given a period of time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_audittrail_privilegeduser_get_with_http_info(session_token, key_manager_token, start_timestamp, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param int start_timestamp: Start timestamp in unix timestamp in millseconds.  (required)
        :param int end_timestamp: End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time. 
        :param str before: Return results from an opaque “before” cursor value as presented via a response cursor. 
        :param str after: Return results from an opaque “after” cursor value as presented via a response cursor. 
        :param int limit: Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. 
        :param int initiator_id: If present, only the initiator with this initiator <user id> will be returned. 
        :param str role: If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) 
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(V1AuditTrailInitiatorList, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'session_token', 'key_manager_token', 'start_timestamp',
            'end_timestamp', 'before', 'after', 'limit', 'initiator_id', 'role'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v1_audittrail_privilegeduser_get" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v1_audittrail_privilegeduser_get`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `v1_audittrail_privilegeduser_get`"
            )  # noqa: E501
        # verify the required parameter 'start_timestamp' is set
        if self.api_client.client_side_validation and (
                'start_timestamp' not in local_var_params or  # noqa: E501
                local_var_params['start_timestamp'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `start_timestamp` when calling `v1_audittrail_privilegeduser_get`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'start_timestamp' in local_var_params and local_var_params[
                'start_timestamp'] is not None:  # noqa: E501
            query_params.append(
                ('startTimestamp',
                 local_var_params['start_timestamp']))  # noqa: E501
        if 'end_timestamp' in local_var_params and local_var_params[
                'end_timestamp'] is not None:  # noqa: E501
            query_params.append(
                ('endTimestamp',
                 local_var_params['end_timestamp']))  # noqa: E501
        if 'before' in local_var_params and local_var_params[
                'before'] is not None:  # noqa: E501
            query_params.append(
                ('before', local_var_params['before']))  # noqa: E501
        if 'after' in local_var_params and local_var_params[
                'after'] is not None:  # noqa: E501
            query_params.append(
                ('after', local_var_params['after']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'initiator_id' in local_var_params and local_var_params[
                'initiator_id'] is not None:  # noqa: E501
            query_params.append(
                ('initiatorId',
                 local_var_params['initiator_id']))  # noqa: E501
        if 'role' in local_var_params and local_var_params[
                'role'] is not None:  # noqa: E501
            query_params.append(
                ('role', local_var_params['role']))  # noqa: E501

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/audittrail/privilegeduser',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V1AuditTrailInitiatorList',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def v1_stream_sid_attachment_get_with_http_info(self, sid, file_id,
                                                    message_id, session_token,
                                                    key_manager_token,
                                                    **kwargs):  # noqa: E501
        """Download an attachment.  # noqa: E501

        Downloads the attachment body by the attachment ID, stream ID, and message ID.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_stream_sid_attachment_get_with_http_info(sid, file_id, message_id, session_token, key_manager_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str sid: Stream ID (required)
        :param str file_id: The attachment ID (Base64-encoded) (required)
        :param str message_id: The ID of the message containing the attachment (required)
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(str, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'sid', 'file_id', 'message_id', 'session_token',
            'key_manager_token'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method v1_stream_sid_attachment_get" %
                                   key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'sid' is set
        if self.api_client.client_side_validation and (
                'sid' not in local_var_params or  # noqa: E501
                local_var_params['sid'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `sid` when calling `v1_stream_sid_attachment_get`"
            )  # noqa: E501
        # verify the required parameter 'file_id' is set
        if self.api_client.client_side_validation and (
                'file_id' not in local_var_params or  # noqa: E501
                local_var_params['file_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `file_id` when calling `v1_stream_sid_attachment_get`"
            )  # noqa: E501
        # verify the required parameter 'message_id' is set
        if self.api_client.client_side_validation and (
                'message_id' not in local_var_params or  # noqa: E501
                local_var_params['message_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `message_id` when calling `v1_stream_sid_attachment_get`"
            )  # noqa: E501
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v1_stream_sid_attachment_get`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `v1_stream_sid_attachment_get`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'sid' in local_var_params:
            path_params['sid'] = local_var_params['sid']  # noqa: E501

        query_params = []
        if 'file_id' in local_var_params and local_var_params[
                'file_id'] is not None:  # noqa: E501
            query_params.append(
                ('fileId', local_var_params['file_id']))  # noqa: E501
        if 'message_id' in local_var_params and local_var_params[
                'message_id'] is not None:  # noqa: E501
            query_params.append(
                ('messageId', local_var_params['message_id']))  # noqa: E501

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/octet-stream'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/stream/{sid}/attachment',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
 def request(self,
             method,
             url,
             query_params=None,
             headers=None,
             post_params=None,
             body=None,
             _preload_content=True,
             _request_timeout=None):
     """Makes the HTTP request using RESTClient."""
     if method == "GET":
         return self.rest_client.GET(url,
                                     query_params=query_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     headers=headers)
     elif method == "HEAD":
         return self.rest_client.HEAD(url,
                                      query_params=query_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      headers=headers)
     elif method == "OPTIONS":
         return self.rest_client.OPTIONS(url,
                                         query_params=query_params,
                                         headers=headers,
                                         _preload_content=_preload_content,
                                         _request_timeout=_request_timeout)
     elif method == "POST":
         return self.rest_client.POST(url,
                                      query_params=query_params,
                                      headers=headers,
                                      post_params=post_params,
                                      _preload_content=_preload_content,
                                      _request_timeout=_request_timeout,
                                      body=body)
     elif method == "PUT":
         return self.rest_client.PUT(url,
                                     query_params=query_params,
                                     headers=headers,
                                     post_params=post_params,
                                     _preload_content=_preload_content,
                                     _request_timeout=_request_timeout,
                                     body=body)
     elif method == "PATCH":
         return self.rest_client.PATCH(url,
                                       query_params=query_params,
                                       headers=headers,
                                       post_params=post_params,
                                       _preload_content=_preload_content,
                                       _request_timeout=_request_timeout,
                                       body=body)
     elif method == "DELETE":
         return self.rest_client.DELETE(url,
                                        query_params=query_params,
                                        headers=headers,
                                        _preload_content=_preload_content,
                                        _request_timeout=_request_timeout,
                                        body=body)
     else:
         raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`,"
                             " `POST`, `PATCH`, `PUT` or `DELETE`.")
    def v1_util_echo_post_with_http_info(self, session_token,
                                         key_manager_token, echo_input,
                                         **kwargs):  # noqa: E501
        """Test endpoint, returns input.  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_util_echo_post_with_http_info(session_token, key_manager_token, echo_input, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param SimpleMessage echo_input: Message in plain text (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(SimpleMessage, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['session_token', 'key_manager_token', 'echo_input']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method v1_util_echo_post" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v1_util_echo_post`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `v1_util_echo_post`"
            )  # noqa: E501
        # verify the required parameter 'echo_input' is set
        if self.api_client.client_side_validation and (
                'echo_input' not in local_var_params or  # noqa: E501
                local_var_params['echo_input'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `echo_input` when calling `v1_util_echo_post`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'echo_input' in local_var_params:
            body_params = local_var_params['echo_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/util/echo',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SimpleMessage',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def v4_datafeed_id_read_get_with_http_info(self, id, session_token,
                                               key_manager_token,
                                               **kwargs):  # noqa: E501
        """Read a given datafeed.  # noqa: E501

        Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method.  A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v4_datafeed_id_read_get_with_http_info(id, session_token, key_manager_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str id: Datafeed ID  (required)
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param int limit: Max No. of messages to return. 
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[V4Event], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['id', 'session_token', 'key_manager_token', 'limit']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method v4_datafeed_id_read_get" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'id' is set
        if self.api_client.client_side_validation and (
                'id' not in local_var_params or  # noqa: E501
                local_var_params['id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `id` when calling `v4_datafeed_id_read_get`"
            )  # noqa: E501
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v4_datafeed_id_read_get`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `v4_datafeed_id_read_get`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'id' in local_var_params:
            path_params['id'] = local_var_params['id']  # noqa: E501

        query_params = []
        if 'limit' in local_var_params and local_var_params[
                'limit'] is not None:  # noqa: E501
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v4/datafeed/{id}/read',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[V4Event]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def create_datafeed_with_http_info(self, session_token, key_manager_token,
                                       **kwargs):  # noqa: E501
        """Create a new real time messages / events stream (\"datafeed\").  # noqa: E501

        _Available on Agent 2.57.0 and above._  The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file)  Returns the ID of the datafeed that has just been created. This ID should then be used as input to the Read Messages/Events Stream v4 endpoint.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_datafeed_with_http_info(session_token, key_manager_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(V5Datafeed, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['session_token', 'key_manager_token']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method create_datafeed" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `create_datafeed`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `create_datafeed`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v5/datafeeds',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V5Datafeed',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def v4_datafeed_create_post_with_http_info(self, session_token,
                                               key_manager_token,
                                               **kwargs):  # noqa: E501
        """Create a new real time message event stream.  # noqa: E501

        A datafeed provides the messages in all conversations that a user is in. This also includes system messages like new users joining a chatroom.  A datafeed will expire if it isn't read before its capacity is reached.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v4_datafeed_create_post_with_http_info(session_token, key_manager_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(Datafeed, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['session_token', 'key_manager_token']
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method v4_datafeed_create_post" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `v4_datafeed_create_post`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `v4_datafeed_create_post`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v4/datafeed/create',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Datafeed',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
    def read_datafeed_with_http_info(self, datafeed_id, session_token,
                                     key_manager_token,
                                     **kwargs):  # noqa: E501
        """Read the specified real time message / event stream (\"datafeed\").  # noqa: E501

        _Available on Agent 2.57.0 and above._  The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file)  Read the specified datafeed.  The ackId sent as parameter can be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId; datafeed will remove the events associated with that ackId from your queue   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.read_datafeed_with_http_info(datafeed_id, session_token, key_manager_token, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str datafeed_id: ID of the datafeed (required)
        :param str session_token: Session authentication token. (required)
        :param str key_manager_token: Key Manager authentication token. (required)
        :param AckId ack_id: ackId received from last POST Base64 encoded.
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(V5EventList, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'datafeed_id', 'session_token', 'key_manager_token', 'ack_id'
        ]
        all_params.extend([
            'async_req', '_return_http_data_only', '_preload_content',
            '_request_timeout'
        ])

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method read_datafeed" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'datafeed_id' is set
        if self.api_client.client_side_validation and (
                'datafeed_id' not in local_var_params or  # noqa: E501
                local_var_params['datafeed_id'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `datafeed_id` when calling `read_datafeed`"
            )  # noqa: E501
        # verify the required parameter 'session_token' is set
        if self.api_client.client_side_validation and (
                'session_token' not in local_var_params or  # noqa: E501
                local_var_params['session_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `session_token` when calling `read_datafeed`"
            )  # noqa: E501
        # verify the required parameter 'key_manager_token' is set
        if self.api_client.client_side_validation and (
                'key_manager_token' not in local_var_params or  # noqa: E501
                local_var_params['key_manager_token'] is None):  # noqa: E501
            raise ApiValueError(
                "Missing the required parameter `key_manager_token` when calling `read_datafeed`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'datafeed_id' in local_var_params:
            path_params['datafeedId'] = local_var_params[
                'datafeed_id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'session_token' in local_var_params:
            header_params['sessionToken'] = local_var_params[
                'session_token']  # noqa: E501
        if 'key_manager_token' in local_var_params:
            header_params['keyManagerToken'] = local_var_params[
                'key_manager_token']  # noqa: E501

        form_params = []
        local_var_files = {}

        body_params = None
        if 'ack_id' in local_var_params:
            body_params = local_var_params['ack_id']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v5/datafeeds/{datafeedId}/read',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='V5EventList',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)