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 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) # In the python 3, the response.data is bytes. # we need to decode it to string. if six.PY3: r.data = r.data.decode('utf8') # log response body logger.debug("response body: %s", r.data) if not 200 <= r.status <= 299: raise ApiException(http_resp=r) return r
def d_st_id_note_get_with_http_info(self, id, **kwargs): # noqa: E501 """Retrieve the DSTNotes associated to the DST # noqa: E501 This API allows to retrieve the DST Notes associated to the DST. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.d_st_id_note_get_with_http_info(id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str id: The value of _the unique id_ (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(list[DSTNote], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 d_st_id_note_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 `d_st_id_note_get`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in local_var_params: path_params['id'] = local_var_params['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 = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/DST/{id}/note', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[DSTNote]', # 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 perform_signature_with_session_with_http_info(self, organization_id, signature_id, inline_object4, **kwargs): # noqa: E501 """Perform a Signature with session # noqa: E501 This API allows to perform one or more signatures within the same session. This way is possible, in the scenario of a simple signature for example, to perform multiple signatures using the same _one time password_. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.perform_signature_with_session_with_http_info(organization_id, signature_id, inline_object4, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str organization_id: The **organization-id** represents an organization that is included in the SigninToday application, also know as **slug** and it is used as a path parameter to restrict the asked functionality to the specified organization (required) :param Id signature_id: The **signature-id** is the uuid code that identifies a signature that has to be performed into a digital signature transaction. It is usually used in the API endpoints to perform, decline or cancel a digital signature transaction (required) :param InlineObject4 inline_object4: (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(InlineResponse20010, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['organization_id', 'signature_id', 'inline_object4'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 perform_signature_with_session" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'organization_id' is set if ('organization_id' not in local_var_params or local_var_params['organization_id'] is None): raise ApiValueError( "Missing the required parameter `organization_id` when calling `perform_signature_with_session`" ) # noqa: E501 # verify the required parameter 'signature_id' is set if ('signature_id' not in local_var_params or local_var_params['signature_id'] is None): raise ApiValueError( "Missing the required parameter `signature_id` when calling `perform_signature_with_session`" ) # noqa: E501 # verify the required parameter 'inline_object4' is set if ('inline_object4' not in local_var_params or local_var_params['inline_object4'] is None): raise ApiValueError( "Missing the required parameter `inline_object4` when calling `perform_signature_with_session`" ) # noqa: E501 collection_formats = {} path_params = {} if 'organization_id' in local_var_params: path_params['organization-id'] = local_var_params[ 'organization_id'] # noqa: E501 if 'signature_id' in local_var_params: path_params['signature-id'] = local_var_params[ 'signature_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'inline_object4' in local_var_params: body_params = local_var_params['inline_object4'] # 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 = ['ApiKeyAuth'] # noqa: E501 return self.api_client.call_api( '/{organization-id}/signatures/{signature-id}/session-perform', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse20010', # 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_channel_with_http_info(self, organization_id, dst_id, **kwargs): # noqa: E501 """Create a channel # noqa: E501 This API allows to create a channel in order to dispose, by another API, the scheduling of a signature. These two APIs are used to integrate SigningToday into another application. # 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_channel_with_http_info(organization_id, dst_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str organization_id: The **organization-id** represents an organization that is included in the SigninToday application, also know as **slug** and it is used as a path parameter to restrict the asked functionality to the specified organization (required) :param Id dst_id: The **dst-id** is the uuid code that identifies a digital signature transaction. It is used as a path parameter to filter the requested operation to the specified **dst** (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(InlineResponse201, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['organization_id', 'dst_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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_channel" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'organization_id' is set if ('organization_id' not in local_var_params or local_var_params['organization_id'] is None): raise ApiValueError( "Missing the required parameter `organization_id` when calling `create_channel`" ) # noqa: E501 # verify the required parameter 'dst_id' is set if ('dst_id' not in local_var_params or local_var_params['dst_id'] is None): raise ApiValueError( "Missing the required parameter `dst_id` when calling `create_channel`" ) # noqa: E501 collection_formats = {} path_params = {} if 'organization_id' in local_var_params: path_params['organization-id'] = local_var_params[ 'organization_id'] # noqa: E501 if 'dst_id' in local_var_params: path_params['dst-id'] = local_var_params['dst_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 = ['ApiKeyAuth'] # noqa: E501 return self.api_client.call_api( '/{organization-id}/channels/{dst-id}', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse201', # 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 users_post_with_http_info(self, create_user_request, **kwargs): # noqa: E501 """Create a new User # noqa: E501 This API allows to create a new User. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.users_post_with_http_info(create_user_request, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param CreateUserRequest create_user_request: (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 = ['create_user_request'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 users_post" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'create_user_request' is set if self.api_client.client_side_validation and ('create_user_request' not in local_var_params or # noqa: E501 local_var_params['create_user_request'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `create_user_request` when calling `users_post`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'create_user_request' in local_var_params: body_params = local_var_params['create_user_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['*/*']) # 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 = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/users', 'POST', 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 user_id_delete_with_http_info(self, id, **kwargs): # noqa: E501 """Enable or disable a User # noqa: E501 This API allows to **enable** or **disable** a User account. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.user_id_delete_with_http_info(id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str id: The value of _the unique id_ (required) :param bool enabled: This is a _boolean_ parameter. If true the User is **enabled** :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 = ['id', 'enabled'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 user_id_delete" % 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 `user_id_delete`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in local_var_params: path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] if 'enabled' in local_var_params and local_var_params['enabled'] is not None: # noqa: E501 query_params.append(('enabled', local_var_params['enabled'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['*/*']) # noqa: E501 # Authentication setting auth_settings = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/user/{id}', 'DELETE', 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 device_authorization_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 """Clear a trusted device # noqa: E501 This APIs allows to deregister a _deviceId_ of a trusted device. It also deletes any notification push-token associated to the trusted device. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.device_authorization_delete_with_http_info(device_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str device_id: The _deviceId_ to deregister (required) :param str user_id: Select the objects relative to the user specified by the parameter. If not specified will be used the id of the current authenticated user :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 = ['device_id', 'user_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 device_authorization_delete" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'device_id' is set if self.api_client.client_side_validation and ( 'device_id' not in local_var_params or # noqa: E501 local_var_params['device_id'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `device_id` when calling `device_authorization_delete`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'device_id' in local_var_params and local_var_params[ 'device_id'] is not None: # noqa: E501 query_params.append( ('deviceId', local_var_params['device_id'])) # noqa: E501 if 'user_id' in local_var_params and local_var_params[ 'user_id'] is not None: # noqa: E501 query_params.append( ('userId', local_var_params['user_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['*/*']) # noqa: E501 # Authentication setting auth_settings = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/device/authorization', 'DELETE', 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 robot_configuration_put_with_http_info(self, robot_configuration, **kwargs): # noqa: E501 """Edit the Robot configuration # noqa: E501 This API allows to edit the Robot configuration. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.robot_configuration_put_with_http_info(robot_configuration, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param RobotConfiguration robot_configuration: RobotConfiguration. (required) :param str username: The _username_ associated to the account :param str domain: The _domain_ associated to the account :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 = ['robot_configuration', 'username', 'domain'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 robot_configuration_put" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'robot_configuration' is set if self.api_client.client_side_validation and ( 'robot_configuration' not in local_var_params or # noqa: E501 local_var_params['robot_configuration'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `robot_configuration` when calling `robot_configuration_put`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'username' in local_var_params and local_var_params[ 'username'] is not None: # noqa: E501 query_params.append( ('username', local_var_params['username'])) # noqa: E501 if 'domain' in local_var_params and local_var_params[ 'domain'] is not None: # noqa: E501 query_params.append( ('domain', local_var_params['domain'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None if 'robot_configuration' in local_var_params: body_params = local_var_params['robot_configuration'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['*/*']) # 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 = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/robot/configuration', 'PUT', 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 user_id_identity_identity_id_appearance_post_with_http_info(self, id, identity_id, file, filename, resource_type, **kwargs): # noqa: E501 """Add a graphical appearance to a user's identity # noqa: E501 This API allows to add a graphical appearance to the identity of a user. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.user_id_identity_identity_id_appearance_post_with_http_info(id, identity_id, file, filename, resource_type, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str id: The value of _the unique id_ (required) :param str identity_id: The unique id of the _Identity_ (required) :param file file: The path of the file to upload (required) :param str filename: The name of the file (required) :param str resource_type: The type of the resource (required) :param str title: User-defined title of the resource :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(LFResource, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['id', 'identity_id', 'file', 'filename', 'resource_type', 'title'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 user_id_identity_identity_id_appearance_post" % 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 `user_id_identity_identity_id_appearance_post`") # noqa: E501 # verify the required parameter 'identity_id' is set if self.api_client.client_side_validation and ('identity_id' not in local_var_params or # noqa: E501 local_var_params['identity_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `identity_id` when calling `user_id_identity_identity_id_appearance_post`") # noqa: E501 # verify the required parameter 'file' is set if self.api_client.client_side_validation and ('file' not in local_var_params or # noqa: E501 local_var_params['file'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `file` when calling `user_id_identity_identity_id_appearance_post`") # noqa: E501 # verify the required parameter 'filename' is set if self.api_client.client_side_validation and ('filename' not in local_var_params or # noqa: E501 local_var_params['filename'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `filename` when calling `user_id_identity_identity_id_appearance_post`") # noqa: E501 # verify the required parameter 'resource_type' is set if self.api_client.client_side_validation and ('resource_type' not in local_var_params or # noqa: E501 local_var_params['resource_type'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `resource_type` when calling `user_id_identity_identity_id_appearance_post`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in local_var_params: path_params['id'] = local_var_params['id'] # noqa: E501 if 'identity_id' in local_var_params: path_params['identity-id'] = local_var_params['identity_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} if 'file' in local_var_params: local_var_files['file'] = local_var_params['file'] # noqa: E501 if 'filename' in local_var_params: form_params.append(('filename', local_var_params['filename'])) # noqa: E501 if 'resource_type' in local_var_params: form_params.append(('resourceType', local_var_params['resource_type'])) # noqa: E501 if 'title' in local_var_params: form_params.append(('title', local_var_params['title'])) # noqa: E501 body_params = None # 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 ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/user/{id}/identity/{identity-id}/appearance', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='LFResource', # 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 resource_id_put_with_http_info(self, id, lf_resource, **kwargs): # noqa: E501 """Update a Resource # noqa: E501 This API allows to update a Resource. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.resource_id_put_with_http_info(id, lf_resource, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str id: The value of _the unique id_ (required) :param LFResource lf_resource: Resource replacing current 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: None If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['id', 'lf_resource'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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 resource_id_put" % 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 `resource_id_put`") # noqa: E501 # verify the required parameter 'lf_resource' is set if self.api_client.client_side_validation and ('lf_resource' not in local_var_params or # noqa: E501 local_var_params['lf_resource'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `lf_resource` when calling `resource_id_put`") # noqa: E501 collection_formats = {} path_params = {} if 'id' in local_var_params: path_params['id'] = local_var_params['id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'lf_resource' in local_var_params: body_params = local_var_params['lf_resource'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['*/*']) # 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 = ['OAuth2'] # noqa: E501 return self.api_client.call_api( '/resource/{id}', 'PUT', 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_organization_with_http_info(self, organization_id, **kwargs): # noqa: E501 """Get the settings of an oraganization # noqa: E501 This API allows to obtain the settings of an organization, such as: - _default_rao_ : the default rao user of the organization - _dst_default_months_ : default deadline of a dst before its expiration - _logo_ : the logo of the organization # 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_organization_with_http_info(organization_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously :param str organization_id: The **organization-id** represents an organization that is included in the SigninToday application, also know as **slug** and it is used as a path parameter to restrict the asked functionality to the specified organization (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(InlineResponse200, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['organization_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_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_organization" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'organization_id' is set if ('organization_id' not in local_var_params or local_var_params['organization_id'] is None): raise ApiValueError( "Missing the required parameter `organization_id` when calling `get_organization`" ) # noqa: E501 collection_formats = {} path_params = {} if 'organization_id' in local_var_params: path_params['organization-id'] = local_var_params[ 'organization_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 = ['ApiKeyAuth'] # noqa: E501 return self.api_client.call_api( '/organizations/{organization-id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse200', # 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`.")