def __setattr__(self, name, value): object.__setattr__(self, name, value) if name == 'disabled_client_side_validations': s = set(filter(None, value.split(','))) for v in s: if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: raise ApiValueError("Invalid keyword: '{0}''".format(v)) self._disabled_client_side_validations = s
def _apply_auth_params(self, headers, querys, auth_setting): """Updates the request parameters based on a single auth_setting :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_setting: auth settings for the endpoint """ 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 check_username_with_http_info(self, username, **kwargs): # noqa: E501 """Check if a username is already taken # noqa: E501 Check if a username is already taken by a user or an org # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.check_username_with_http_info(username, async_req=True) >>> result = thread.get() :param username: (required) :type username: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _return_http_data_only: response data without head status code and headers :type _return_http_data_only: bool, optional :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :type _preload_content: bool, optional :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. :param _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request. :type _request_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) """ local_var_params = locals() all_params = ['username'] all_params.extend([ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth' ]) 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 check_username" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set if self.api_client.client_side_validation and ( 'username' not in local_var_params or # noqa: E501 local_var_params['username'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `username` when calling `check_username`" ) # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: path_params['username'] = local_var_params[ 'username'] # 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 = [] # noqa: E501 return self.api_client.call_api( '/users/check_username/{username}', 'GET', 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, _request_auth=local_var_params.get('_request_auth'))
def list_users_with_http_info(self, **kwargs): # noqa: E501 """List Users # 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_users_with_http_info(async_req=True) >>> result = thread.get() :param search: You know, for search :type search: list[str] :param page: Page number starting from 1 :type page: int :param per_page: Number of items per page :type per_page: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _return_http_data_only: response data without head status code and headers :type _return_http_data_only: bool, optional :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :type _preload_content: bool, optional :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. :param _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request. :type _request_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. :rtype: tuple(UserPublicList, status_code(int), headers(HTTPHeaderDict)) """ local_var_params = locals() all_params = ['search', 'page', 'per_page'] all_params.extend([ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth' ]) 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_users" % key) local_var_params[key] = val del local_var_params['kwargs'] if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params[ 'page'] < 1: # noqa: E501 raise ApiValueError( "Invalid value for parameter `page` when calling `list_users`, must be a value greater than or equal to `1`" ) # noqa: E501 if self.api_client.client_side_validation and 'per_page' in local_var_params and local_var_params[ 'per_page'] > 100: # noqa: E501 raise ApiValueError( "Invalid value for parameter `per_page` when calling `list_users`, must be a value less than or equal to `100`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'search' in local_var_params and local_var_params[ 'search'] is not None: # noqa: E501 query_params.append( ('search', local_var_params['search'])) # noqa: E501 collection_formats['search'] = 'multi' # noqa: E501 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 if 'per_page' in local_var_params and local_var_params[ 'per_page'] is not None: # noqa: E501 query_params.append( ('per-page', local_var_params['per_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 = [] # noqa: E501 return self.api_client.call_api( '/users', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UserPublicList', # 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, _request_auth=local_var_params.get('_request_auth'))
def create_artifact_with_http_info(self, owner, name, key_request, **kwargs): # noqa: E501 """Get an Artifact upload link. # noqa: E501 Create a new artifact. # 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_artifact_with_http_info(owner, name, key_request, async_req=True) >>> result = thread.get() :param owner: (required) :type owner: str :param name: (required) :type name: str :param key_request: (required) :type key_request: KeyRequest :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _return_http_data_only: response data without head status code and headers :type _return_http_data_only: bool, optional :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :type _preload_content: bool, optional :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. :param _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request. :type _request_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. :rtype: tuple(S3UploadRequest, status_code(int), headers(HTTPHeaderDict)) """ local_var_params = locals() all_params = ['owner', 'name', 'key_request'] all_params.extend([ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth' ]) 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_artifact" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'owner' is set if self.api_client.client_side_validation and ( 'owner' not in local_var_params or # noqa: E501 local_var_params['owner'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `owner` when calling `create_artifact`" ) # noqa: E501 # verify the required parameter 'name' is set if self.api_client.client_side_validation and ( 'name' not in local_var_params or # noqa: E501 local_var_params['name'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `name` when calling `create_artifact`" ) # noqa: E501 # verify the required parameter 'key_request' is set if self.api_client.client_side_validation and ( 'key_request' not in local_var_params or # noqa: E501 local_var_params['key_request'] is None): # noqa: E501 raise ApiValueError( "Missing the required parameter `key_request` when calling `create_artifact`" ) # noqa: E501 collection_formats = {} path_params = {} if 'owner' in local_var_params: path_params['owner'] = local_var_params['owner'] # noqa: E501 if 'name' in local_var_params: path_params['name'] = local_var_params['name'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'key_request' in local_var_params: body_params = local_var_params['key_request'] # 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', 'JWTAuth'] # noqa: E501 return self.api_client.call_api( '/projects/{owner}/{name}/artifacts', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='S3UploadRequest', # 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, _request_auth=local_var_params.get('_request_auth'))
def search_job_folder_with_http_info(self, owner, name, job_id, **kwargs): # noqa: E501 """List files/folders in a job folder # noqa: E501 Retrieve a list of artifacts in a job folder # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_job_folder_with_http_info(owner, name, job_id, async_req=True) >>> result = thread.get() :param owner: (required) :type owner: str :param name: (required) :type name: str :param job_id: (required) :type job_id: str :param page: Page number starting from 1 :type page: int :param per_page: Number of items per page :type per_page: int :param path: The path to an file within a project folder :type path: list[str] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _return_http_data_only: response data without head status code and headers :type _return_http_data_only: bool, optional :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :type _preload_content: bool, optional :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. :param _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request. :type _request_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. :rtype: tuple(list[FileMeta], status_code(int), headers(HTTPHeaderDict)) """ local_var_params = locals() all_params = [ 'owner', 'name', 'job_id', 'page', 'per_page', 'path' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout', '_request_auth' ] ) 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 search_job_folder" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'owner' is set if self.api_client.client_side_validation and ('owner' not in local_var_params or # noqa: E501 local_var_params['owner'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `owner` when calling `search_job_folder`") # noqa: E501 # verify the required parameter 'name' is set if self.api_client.client_side_validation and ('name' not in local_var_params or # noqa: E501 local_var_params['name'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `name` when calling `search_job_folder`") # noqa: E501 # verify the required parameter 'job_id' is set if self.api_client.client_side_validation and ('job_id' not in local_var_params or # noqa: E501 local_var_params['job_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `job_id` when calling `search_job_folder`") # noqa: E501 if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `search_job_folder`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'per_page' in local_var_params and local_var_params['per_page'] > 100: # noqa: E501 raise ApiValueError("Invalid value for parameter `per_page` when calling `search_job_folder`, must be a value less than or equal to `100`") # noqa: E501 collection_formats = {} path_params = {} if 'owner' in local_var_params: path_params['owner'] = local_var_params['owner'] # noqa: E501 if 'name' in local_var_params: path_params['name'] = local_var_params['name'] # noqa: E501 if 'job_id' in local_var_params: path_params['job_id'] = local_var_params['job_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 if 'per_page' in local_var_params and local_var_params['per_page'] is not None: # noqa: E501 query_params.append(('per-page', local_var_params['per_page'])) # noqa: E501 if 'path' in local_var_params and local_var_params['path'] is not None: # noqa: E501 query_params.append(('path', local_var_params['path'])) # noqa: E501 collection_formats['path'] = 'multi' # 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 = ['APIKeyAuth', 'JWTAuth'] # noqa: E501 return self.api_client.call_api( '/projects/{owner}/{name}/jobs/{job_id}/artifacts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FileMeta]', # 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, _request_auth=local_var_params.get('_request_auth'))
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`.")