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 accept_control_with_http_info(self, app_id, conversation_id, accept_control_body, **kwargs): # noqa: E501 """Accept Control # noqa: E501 The acceptControl action transfers the control of the conversation to the pending switchboard integration. When using integration auth scope, a 403 is returned if the pending switchboard integration is not the authenticated integration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.accept_control_with_http_info(app_id, conversation_id, accept_control_body, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str conversation_id: Identifies the conversation. (required) :param AcceptControlBody accept_control_body: (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(object, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['app_id', 'conversation_id', 'accept_control_body'] 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 accept_control" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ( 'app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `app_id` when calling `accept_control`" ) # noqa: E501 # verify the required parameter 'conversation_id' is set if self.api_client.client_side_validation and ( 'conversation_id' not in local_var_params or # noqa: E501 local_var_params['conversation_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `conversation_id` when calling `accept_control`" ) # noqa: E501 # verify the required parameter 'accept_control_body' is set if self.api_client.client_side_validation and ( 'accept_control_body' not in local_var_params or # noqa: E501 local_var_params['accept_control_body'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `accept_control_body` when calling `accept_control`" ) # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'conversation_id' in local_var_params: path_params['conversationId'] = local_var_params[ 'conversation_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'accept_control_body' in local_var_params: body_params = local_var_params['accept_control_body'] # 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/conversations/{conversationId}/acceptControl', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', # 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 list_participants_with_http_info(self, app_id, conversation_id, **kwargs): # noqa: E501 """List Participants # noqa: E501 Lists all the participants of a particular conversation. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). ```shell /v2/apps/:appId/conversations/:conversationId/participants?page[before]=26508c10541a4b0ff472e5e2 ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_participants_with_http_info(app_id, conversation_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str conversation_id: Identifies the conversation. (required) :param Page page: Contains parameters for applying cursor pagination. :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(ParticipantListResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'app_id', 'conversation_id', 'page' ] 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 list_participants" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ('app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `app_id` when calling `list_participants`") # noqa: E501 # verify the required parameter 'conversation_id' is set if self.api_client.client_side_validation and ('conversation_id' not in local_var_params or # noqa: E501 local_var_params['conversation_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `conversation_id` when calling `list_participants`") # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'conversation_id' in local_var_params: path_params['conversationId'] = local_var_params['conversation_id'] # noqa: E501 query_params = [] if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 header_params = {} 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/conversations/{conversationId}/participants', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ParticipantListResponse', # 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_app_with_http_info(self, app_create_body, **kwargs): # noqa: E501 """Create App # noqa: E501 Creates a new app. When using [service account](#service-accounts) credentials, the service account is automatically granted access to the app. # 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_app_with_http_info(app_create_body, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param AppCreateBody app_create_body: (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(AppResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'app_create_body' ] 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_app" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_create_body' is set if self.api_client.client_side_validation and ('app_create_body' not in local_var_params or # noqa: E501 local_var_params['app_create_body'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `app_create_body` when calling `create_app`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'app_create_body' in local_var_params: body_params = local_var_params['app_create_body'] # 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='AppResponse', # 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 delete_conversation_with_http_info(self, app_id, conversation_id, **kwargs): # noqa: E501 """Delete Conversation # noqa: E501 Delete an entire conversation record, along with its messages and attachments. Note that the default conversation cannot be deleted, but the messages contained [can be](#deleteAllMessages). # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_conversation_with_http_info(app_id, conversation_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str conversation_id: Identifies the conversation. (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(object, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'app_id', 'conversation_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 delete_conversation" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ('app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `app_id` when calling `delete_conversation`") # noqa: E501 # verify the required parameter 'conversation_id' is set if self.api_client.client_side_validation and ('conversation_id' not in local_var_params or # noqa: E501 local_var_params['conversation_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `conversation_id` when calling `delete_conversation`") # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'conversation_id' in local_var_params: path_params['conversationId'] = local_var_params['conversation_id'] # noqa: E501 query_params = [] header_params = {} 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/conversations/{conversationId}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', # 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 list_switchboard_integrations_with_http_info(self, app_id, switchboard_id, **kwargs): # noqa: E501 """List Switchboard Integrations # noqa: E501 Lists all switchboard integrations linked to the switchboard. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_switchboard_integrations_with_http_info(app_id, switchboard_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str switchboard_id: Identifies the switchboard. (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(SwitchboardIntegrationListResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['app_id', 'switchboard_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 list_switchboard_integrations" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ( 'app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `app_id` when calling `list_switchboard_integrations`" ) # noqa: E501 # verify the required parameter 'switchboard_id' is set if self.api_client.client_side_validation and ( 'switchboard_id' not in local_var_params or # noqa: E501 local_var_params['switchboard_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `switchboard_id` when calling `list_switchboard_integrations`" ) # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'switchboard_id' in local_var_params: path_params['switchboardId'] = local_var_params[ 'switchboard_id'] # noqa: E501 query_params = [] header_params = {} 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='SwitchboardIntegrationListResponse', # 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_client_with_http_info(self, app_id, user_id_or_external_id, client_create, **kwargs): # noqa: E501 """Create Client # noqa: E501 Create a client and link it to a channel specified by the `matchCriteria.type`. Note that the client is initially created with a `pending` status. The status of the linking request can be tracked by listening to the `link:match`, `link:success` and `link:failure` webhooks (only available in v1). For more information, see [link-events](https://docs.smooch.io/rest/v1/#link-events). # 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_client_with_http_info(app_id, user_id_or_external_id, client_create, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str user_id_or_external_id: The user's id or externalId. (required) :param ClientCreate client_create: (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(ClientResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['app_id', 'user_id_or_external_id', 'client_create'] 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_client" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ( 'app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `app_id` when calling `create_client`" ) # noqa: E501 # verify the required parameter 'user_id_or_external_id' is set if self.api_client.client_side_validation and ( 'user_id_or_external_id' not in local_var_params or # noqa: E501 local_var_params['user_id_or_external_id'] is None ): # noqa: E501 raise ApiValueError( "Missing the required parameter `user_id_or_external_id` when calling `create_client`" ) # noqa: E501 # verify the required parameter 'client_create' is set if self.api_client.client_side_validation and ( 'client_create' not in local_var_params or # noqa: E501 local_var_params['client_create'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `client_create` when calling `create_client`" ) # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'user_id_or_external_id' in local_var_params: path_params['userIdOrExternalId'] = local_var_params[ 'user_id_or_external_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'client_create' in local_var_params: body_params = local_var_params['client_create'] # 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/users/{userIdOrExternalId}/clients', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ClientResponse', # 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 delete_user_personal_information_with_http_info( self, app_id, user_id_or_external_id, **kwargs): # noqa: E501 """Delete User Personal Information # noqa: E501 Delete a user’s personal information. Calling this API will clear `givenName`, `surname`, `email` and `avatarUrl` and every custom property for the specified user. For every client owned by the user, it will also clear `displayName`, `avatarUrl` and any channel specific information stored in the info and raw fields. Calling this API doesn’t delete the user’s conversation history. To fully delete the user, see [Delete User](#operation/deleteUser). # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_user_personal_information_with_http_info(app_id, user_id_or_external_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param str user_id_or_external_id: The user's id or externalId. (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(UserResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['app_id', 'user_id_or_external_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 delete_user_personal_information" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ( 'app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `app_id` when calling `delete_user_personal_information`" ) # noqa: E501 # verify the required parameter 'user_id_or_external_id' is set if self.api_client.client_side_validation and ( 'user_id_or_external_id' not in local_var_params or # noqa: E501 local_var_params['user_id_or_external_id'] is None ): # noqa: E501 raise ApiValueError( "Missing the required parameter `user_id_or_external_id` when calling `delete_user_personal_information`" ) # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 if 'user_id_or_external_id' in local_var_params: path_params['userIdOrExternalId'] = local_var_params[ 'user_id_or_external_id'] # noqa: E501 query_params = [] header_params = {} 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UserResponse', # 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_integration_with_http_info(self, app_id, integration, **kwargs): # noqa: E501 """Create Integration # noqa: E501 The Create Integration endpoint allows you to provision apps with front-end messaging channels. Selecting a `custom` integration allows the creation of webhooks. # 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_integration_with_http_info(app_id, integration, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str app_id: Identifies the app. (required) :param Integration integration: (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(IntegrationResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'app_id', 'integration' ] 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_integration" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'app_id' is set if self.api_client.client_side_validation and ('app_id' not in local_var_params or # noqa: E501 local_var_params['app_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `app_id` when calling `create_integration`") # noqa: E501 # verify the required parameter 'integration' is set if self.api_client.client_side_validation and ('integration' not in local_var_params or # noqa: E501 local_var_params['integration'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `integration` when calling `create_integration`") # noqa: E501 collection_formats = {} path_params = {} if 'app_id' in local_var_params: path_params['appId'] = local_var_params['app_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'integration' in local_var_params: body_params = local_var_params['integration'] # 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 = ['basicAuth', 'bearerAuth'] # noqa: E501 return self.api_client.call_api( '/v2/apps/{appId}/integrations', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='IntegrationResponse', # 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 authorize_with_http_info(self, client_id, response_type, **kwargs): # noqa: E501 """Authorize # noqa: E501 This endpoint begins the OAuth flow. It relies on a browser session for authentication. If the user is not logged in to Sunshine Conversations they will be redirected to the login page. If the user has many apps, they will first be prompted to select the one they wish to integrate with. They will then be presented with an Allow/Deny dialog, describing details of the access your integration is requesting. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.authorize_with_http_info(client_id, response_type, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str client_id: Your integration’s unique identifier (required) :param str response_type: For now the only acceptable value is code. (required) :param str state: You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect. :param str redirect_uri: You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used. :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: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['client_id', 'response_type', 'state', 'redirect_uri'] 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 authorize" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client_id' is set if self.api_client.client_side_validation and ( 'client_id' not in local_var_params or # noqa: E501 local_var_params['client_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `client_id` when calling `authorize`" ) # noqa: E501 # verify the required parameter 'response_type' is set if self.api_client.client_side_validation and ( 'response_type' not in local_var_params or # noqa: E501 local_var_params['response_type'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `response_type` when calling `authorize`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'client_id' in local_var_params and local_var_params[ 'client_id'] is not None: # noqa: E501 query_params.append( ('client_id', local_var_params['client_id'])) # noqa: E501 if 'response_type' in local_var_params and local_var_params[ 'response_type'] is not None: # noqa: E501 query_params.append( ('response_type', local_var_params['response_type'])) # noqa: E501 if 'state' in local_var_params and local_var_params[ 'state'] is not None: # noqa: E501 query_params.append( ('state', local_var_params['state'])) # noqa: E501 if 'redirect_uri' in local_var_params and local_var_params[ 'redirect_uri'] is not None: # noqa: E501 query_params.append( ('redirect_uri', local_var_params['redirect_uri'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/oauth/authorize', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # 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 get_token_with_http_info(self, inline_object, **kwargs): # noqa: E501 """Get Token # noqa: E501 This endpoint is used to exchange an authorization code for an access token. It should only be used in server-to-server calls. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_token_with_http_info(inline_object, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param InlineObject inline_object: (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(object, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['inline_object'] 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 get_token" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'inline_object' is set if self.api_client.client_side_validation and ( 'inline_object' not in local_var_params or # noqa: E501 local_var_params['inline_object'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `inline_object` when calling `get_token`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'inline_object' in local_var_params: body_params = local_var_params['inline_object'] # 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( '/oauth/token', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', # 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, 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