diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-28 13:04:46 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-28 13:04:46 -0700 |
commit | af542d66d884bd17daa6f40f3556aa4189b23b36 (patch) | |
tree | 8b9ab8b62da97f547dea7caf8be3d52917e884de /python/fatcat_client | |
parent | 6918fced32c7cb8c351692b0fd5e87dd3ed734a2 (diff) | |
download | fatcat-af542d66d884bd17daa6f40f3556aa4189b23b36.tar.gz fatcat-af542d66d884bd17daa6f40f3556aa4189b23b36.zip |
python client codegen
Diffstat (limited to 'python/fatcat_client')
44 files changed, 14348 insertions, 0 deletions
diff --git a/python/fatcat_client/__init__.py b/python/fatcat_client/__init__.py new file mode 100644 index 00000000..0497c101 --- /dev/null +++ b/python/fatcat_client/__init__.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +# flake8: noqa + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import apis into sdk package +from fatcat_client.api.default_api import DefaultApi + +# import ApiClient +from fatcat_client.api_client import ApiClient +from fatcat_client.configuration import Configuration +# import models into sdk package +from fatcat_client.models.changelogentries import Changelogentries +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner +from fatcat_client.models.container_entity import ContainerEntity +from fatcat_client.models.creator_entity import CreatorEntity +from fatcat_client.models.editgroup import Editgroup +from fatcat_client.models.editgroup_edits import EditgroupEdits +from fatcat_client.models.editor import Editor +from fatcat_client.models.entity_edit import EntityEdit +from fatcat_client.models.error_response import ErrorResponse +from fatcat_client.models.file_entity import FileEntity +from fatcat_client.models.release_contrib import ReleaseContrib +from fatcat_client.models.release_entity import ReleaseEntity +from fatcat_client.models.release_ref import ReleaseRef +from fatcat_client.models.success import Success +from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/api/__init__.py b/python/fatcat_client/api/__init__.py new file mode 100644 index 00000000..79b04b0c --- /dev/null +++ b/python/fatcat_client/api/__init__.py @@ -0,0 +1,6 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from fatcat_client.api.default_api import DefaultApi diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py new file mode 100644 index 00000000..07e257c0 --- /dev/null +++ b/python/fatcat_client/api/default_api.py @@ -0,0 +1,2362 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from fatcat_client.api_client import ApiClient + + +class DefaultApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def container_batch_post(self, entity_list, **kwargs): # noqa: E501 + """container_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ContainerEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.container_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def container_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """container_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ContainerEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `container_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/container/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_id_get(self, id, **kwargs): # noqa: E501 + """container_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.container_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def container_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """container_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `container_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/container/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ContainerEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_lookup_get(self, issnl, **kwargs): # noqa: E501 + """container_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_lookup_get(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_lookup_get_with_http_info(issnl, **kwargs) # noqa: E501 + else: + (data) = self.container_lookup_get_with_http_info(issnl, **kwargs) # noqa: E501 + return data + + def container_lookup_get_with_http_info(self, issnl, **kwargs): # noqa: E501 + """container_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_lookup_get_with_http_info(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['issnl'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'issnl' is set + if ('issnl' not in params or + params['issnl'] is None): + raise ValueError("Missing the required parameter `issnl` when calling `container_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'issnl' in params: + query_params.append(('issnl', params['issnl'])) # 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 + + # 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( + '/container/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ContainerEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_post(self, entity, **kwargs): # noqa: E501 + """container_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ContainerEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.container_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def container_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """container_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ContainerEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `container_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/container', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_batch_post(self, entity_list, **kwargs): # noqa: E501 + """creator_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[CreatorEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.creator_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def creator_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """creator_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[CreatorEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `creator_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/creator/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_id_get(self, id, **kwargs): # noqa: E501 + """creator_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.creator_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def creator_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """creator_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `creator_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/creator/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CreatorEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_lookup_get(self, orcid, **kwargs): # noqa: E501 + """creator_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_lookup_get(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_lookup_get_with_http_info(orcid, **kwargs) # noqa: E501 + else: + (data) = self.creator_lookup_get_with_http_info(orcid, **kwargs) # noqa: E501 + return data + + def creator_lookup_get_with_http_info(self, orcid, **kwargs): # noqa: E501 + """creator_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_lookup_get_with_http_info(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['orcid'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'orcid' is set + if ('orcid' not in params or + params['orcid'] is None): + raise ValueError("Missing the required parameter `orcid` when calling `creator_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'orcid' in params: + query_params.append(('orcid', params['orcid'])) # 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 + + # 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( + '/creator/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CreatorEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_post(self, entity, **kwargs): # noqa: E501 + """creator_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param CreatorEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.creator_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def creator_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """creator_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param CreatorEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `creator_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/creator', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_id_accept_post(self, id, **kwargs): # noqa: E501 + """editgroup_id_accept_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_accept_post(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_id_accept_post_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_id_accept_post_with_http_info(id, **kwargs) # noqa: E501 + return data + + def editgroup_id_accept_post_with_http_info(self, id, **kwargs): # noqa: E501 + """editgroup_id_accept_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_accept_post_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_id_accept_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `editgroup_id_accept_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/editgroup/{id}/accept', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Success', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_id_get(self, id, **kwargs): # noqa: E501 + """editgroup_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def editgroup_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """editgroup_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `editgroup_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/editgroup/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editgroup', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_post(self, entity, **kwargs): # noqa: E501 + """editgroup_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param Editgroup entity: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def editgroup_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """editgroup_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param Editgroup entity: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `editgroup_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/editgroup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editgroup', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editor_username_changelog_get(self, username, **kwargs): # noqa: E501 + """editor_username_changelog_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_changelog_get(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Changelogentries + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editor_username_changelog_get_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.editor_username_changelog_get_with_http_info(username, **kwargs) # noqa: E501 + return data + + def editor_username_changelog_get_with_http_info(self, username, **kwargs): # noqa: E501 + """editor_username_changelog_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_changelog_get_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Changelogentries + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editor_username_changelog_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'username' is set + if ('username' not in params or + params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `editor_username_changelog_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = 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 + + # 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( + '/editor/{username}/changelog', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Changelogentries', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editor_username_get(self, username, **kwargs): # noqa: E501 + """editor_username_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_get(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Editor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editor_username_get_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.editor_username_get_with_http_info(username, **kwargs) # noqa: E501 + return data + + def editor_username_get_with_http_info(self, username, **kwargs): # noqa: E501 + """editor_username_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_get_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Editor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editor_username_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'username' is set + if ('username' not in params or + params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `editor_username_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = 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 + + # 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( + '/editor/{username}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editor', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_batch_post(self, entity_list, **kwargs): # noqa: E501 + """file_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[FileEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.file_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def file_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """file_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[FileEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `file_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/file/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_id_get(self, id, **kwargs): # noqa: E501 + """file_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.file_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def file_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """file_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `file_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/file/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FileEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_lookup_get(self, sha1, **kwargs): # noqa: E501 + """file_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_lookup_get(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_lookup_get_with_http_info(sha1, **kwargs) # noqa: E501 + else: + (data) = self.file_lookup_get_with_http_info(sha1, **kwargs) # noqa: E501 + return data + + def file_lookup_get_with_http_info(self, sha1, **kwargs): # noqa: E501 + """file_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_lookup_get_with_http_info(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sha1'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sha1' is set + if ('sha1' not in params or + params['sha1'] is None): + raise ValueError("Missing the required parameter `sha1` when calling `file_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sha1' in params: + query_params.append(('sha1', params['sha1'])) # 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 + + # 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( + '/file/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FileEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_post(self, entity, **kwargs): # noqa: E501 + """file_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param FileEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.file_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def file_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """file_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param FileEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `file_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/file', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_batch_post(self, entity_list, **kwargs): # noqa: E501 + """release_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ReleaseEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.release_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def release_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """release_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ReleaseEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `release_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/release/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_id_get(self, id, **kwargs): # noqa: E501 + """release_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.release_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def release_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """release_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `release_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/release/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ReleaseEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_lookup_get(self, doi, **kwargs): # noqa: E501 + """release_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_lookup_get(doi, async=True) + >>> result = thread.get() + + :param async bool + :param str doi: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_lookup_get_with_http_info(doi, **kwargs) # noqa: E501 + else: + (data) = self.release_lookup_get_with_http_info(doi, **kwargs) # noqa: E501 + return data + + def release_lookup_get_with_http_info(self, doi, **kwargs): # noqa: E501 + """release_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_lookup_get_with_http_info(doi, async=True) + >>> result = thread.get() + + :param async bool + :param str doi: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['doi'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'doi' is set + if ('doi' not in params or + params['doi'] is None): + raise ValueError("Missing the required parameter `doi` when calling `release_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'doi' in params: + query_params.append(('doi', params['doi'])) # 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 + + # 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( + '/release/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ReleaseEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_post(self, entity, **kwargs): # noqa: E501 + """release_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ReleaseEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.release_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def release_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """release_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ReleaseEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `release_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/release', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_batch_post(self, entity_list, **kwargs): # noqa: E501 + """work_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[WorkEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.work_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def work_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """work_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[WorkEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `work_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/work/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_id_get(self, id, **kwargs): # noqa: E501 + """work_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.work_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def work_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """work_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `work_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/work/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WorkEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_post(self, entity, **kwargs): # noqa: E501 + """work_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param WorkEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.work_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def work_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """work_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param WorkEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `work_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/work', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/python/fatcat_client/api_client.py b/python/fatcat_client/api_client.py new file mode 100644 index 00000000..6e562014 --- /dev/null +++ b/python/fatcat_client/api_client.py @@ -0,0 +1,621 @@ +# coding: utf-8 +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from fatcat_client.configuration import Configuration +import fatcat_client.models +from fatcat_client import rest + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match('list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(fatcat_client.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async request, set the async parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :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: + If async parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async is False or missing, + then the method will return the response directly. + """ + if not async: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) + return thread + + 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, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + 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 ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + 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 not auth_setting['value']: + continue + 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 ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.u(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not hasattr(klass, + 'get_real_child_model'): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/python/fatcat_client/configuration.py b/python/fatcat_client/configuration.py new file mode 100644 index 00000000..d64bb932 --- /dev/null +++ b/python/fatcat_client/configuration.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class TypeWithDefault(type): + def __init__(cls, name, bases, dct): + super(TypeWithDefault, cls).__init__(name, bases, dct) + cls._default = None + + def __call__(cls): + if cls._default is None: + cls._default = type.__call__(cls) + return copy.copy(cls._default) + + def set_default(cls, default): + cls._default = copy.copy(default) + + +class Configuration(six.with_metaclass(TypeWithDefault, object)): + """NOTE: This class is auto generated by the swagger code generator program. + + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "http://localhost/v0" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("fatcat_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if (self.api_key.get(identifier) and + self.api_key_prefix.get(identifier)): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 + elif self.api_key.get(identifier): + return self.api_key[identifier] + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + + } + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/python/fatcat_client/fatcat_client/__init__.py b/python/fatcat_client/fatcat_client/__init__.py new file mode 100644 index 00000000..0497c101 --- /dev/null +++ b/python/fatcat_client/fatcat_client/__init__.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +# flake8: noqa + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import apis into sdk package +from fatcat_client.api.default_api import DefaultApi + +# import ApiClient +from fatcat_client.api_client import ApiClient +from fatcat_client.configuration import Configuration +# import models into sdk package +from fatcat_client.models.changelogentries import Changelogentries +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner +from fatcat_client.models.container_entity import ContainerEntity +from fatcat_client.models.creator_entity import CreatorEntity +from fatcat_client.models.editgroup import Editgroup +from fatcat_client.models.editgroup_edits import EditgroupEdits +from fatcat_client.models.editor import Editor +from fatcat_client.models.entity_edit import EntityEdit +from fatcat_client.models.error_response import ErrorResponse +from fatcat_client.models.file_entity import FileEntity +from fatcat_client.models.release_contrib import ReleaseContrib +from fatcat_client.models.release_entity import ReleaseEntity +from fatcat_client.models.release_ref import ReleaseRef +from fatcat_client.models.success import Success +from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/fatcat_client/api/__init__.py b/python/fatcat_client/fatcat_client/api/__init__.py new file mode 100644 index 00000000..79b04b0c --- /dev/null +++ b/python/fatcat_client/fatcat_client/api/__init__.py @@ -0,0 +1,6 @@ +from __future__ import absolute_import + +# flake8: noqa + +# import apis into api package +from fatcat_client.api.default_api import DefaultApi diff --git a/python/fatcat_client/fatcat_client/api/default_api.py b/python/fatcat_client/fatcat_client/api/default_api.py new file mode 100644 index 00000000..07e257c0 --- /dev/null +++ b/python/fatcat_client/fatcat_client/api/default_api.py @@ -0,0 +1,2362 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from fatcat_client.api_client import ApiClient + + +class DefaultApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def container_batch_post(self, entity_list, **kwargs): # noqa: E501 + """container_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ContainerEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.container_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def container_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """container_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ContainerEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `container_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/container/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_id_get(self, id, **kwargs): # noqa: E501 + """container_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.container_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def container_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """container_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `container_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/container/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ContainerEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_lookup_get(self, issnl, **kwargs): # noqa: E501 + """container_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_lookup_get(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_lookup_get_with_http_info(issnl, **kwargs) # noqa: E501 + else: + (data) = self.container_lookup_get_with_http_info(issnl, **kwargs) # noqa: E501 + return data + + def container_lookup_get_with_http_info(self, issnl, **kwargs): # noqa: E501 + """container_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_lookup_get_with_http_info(issnl, async=True) + >>> result = thread.get() + + :param async bool + :param str issnl: (required) + :return: ContainerEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['issnl'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'issnl' is set + if ('issnl' not in params or + params['issnl'] is None): + raise ValueError("Missing the required parameter `issnl` when calling `container_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'issnl' in params: + query_params.append(('issnl', params['issnl'])) # 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 + + # 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( + '/container/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ContainerEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def container_post(self, entity, **kwargs): # noqa: E501 + """container_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ContainerEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.container_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.container_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def container_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """container_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.container_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ContainerEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method container_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `container_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/container', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_batch_post(self, entity_list, **kwargs): # noqa: E501 + """creator_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[CreatorEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.creator_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def creator_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """creator_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[CreatorEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `creator_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/creator/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_id_get(self, id, **kwargs): # noqa: E501 + """creator_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.creator_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def creator_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """creator_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `creator_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/creator/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CreatorEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_lookup_get(self, orcid, **kwargs): # noqa: E501 + """creator_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_lookup_get(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_lookup_get_with_http_info(orcid, **kwargs) # noqa: E501 + else: + (data) = self.creator_lookup_get_with_http_info(orcid, **kwargs) # noqa: E501 + return data + + def creator_lookup_get_with_http_info(self, orcid, **kwargs): # noqa: E501 + """creator_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_lookup_get_with_http_info(orcid, async=True) + >>> result = thread.get() + + :param async bool + :param str orcid: (required) + :return: CreatorEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['orcid'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'orcid' is set + if ('orcid' not in params or + params['orcid'] is None): + raise ValueError("Missing the required parameter `orcid` when calling `creator_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'orcid' in params: + query_params.append(('orcid', params['orcid'])) # 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 + + # 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( + '/creator/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CreatorEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def creator_post(self, entity, **kwargs): # noqa: E501 + """creator_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param CreatorEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.creator_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.creator_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def creator_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """creator_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.creator_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param CreatorEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method creator_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `creator_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/creator', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_id_accept_post(self, id, **kwargs): # noqa: E501 + """editgroup_id_accept_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_accept_post(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_id_accept_post_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_id_accept_post_with_http_info(id, **kwargs) # noqa: E501 + return data + + def editgroup_id_accept_post_with_http_info(self, id, **kwargs): # noqa: E501 + """editgroup_id_accept_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_accept_post_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_id_accept_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `editgroup_id_accept_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/editgroup/{id}/accept', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Success', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_id_get(self, id, **kwargs): # noqa: E501 + """editgroup_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def editgroup_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """editgroup_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param int id: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `editgroup_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/editgroup/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editgroup', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editgroup_post(self, entity, **kwargs): # noqa: E501 + """editgroup_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param Editgroup entity: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editgroup_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.editgroup_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def editgroup_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """editgroup_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editgroup_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param Editgroup entity: (required) + :return: Editgroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editgroup_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `editgroup_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/editgroup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editgroup', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editor_username_changelog_get(self, username, **kwargs): # noqa: E501 + """editor_username_changelog_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_changelog_get(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Changelogentries + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editor_username_changelog_get_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.editor_username_changelog_get_with_http_info(username, **kwargs) # noqa: E501 + return data + + def editor_username_changelog_get_with_http_info(self, username, **kwargs): # noqa: E501 + """editor_username_changelog_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_changelog_get_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Changelogentries + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editor_username_changelog_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'username' is set + if ('username' not in params or + params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `editor_username_changelog_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = 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 + + # 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( + '/editor/{username}/changelog', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Changelogentries', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def editor_username_get(self, username, **kwargs): # noqa: E501 + """editor_username_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_get(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Editor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.editor_username_get_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.editor_username_get_with_http_info(username, **kwargs) # noqa: E501 + return data + + def editor_username_get_with_http_info(self, username, **kwargs): # noqa: E501 + """editor_username_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.editor_username_get_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: (required) + :return: Editor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method editor_username_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'username' is set + if ('username' not in params or + params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `editor_username_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = 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 + + # 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( + '/editor/{username}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Editor', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_batch_post(self, entity_list, **kwargs): # noqa: E501 + """file_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[FileEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.file_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def file_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """file_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[FileEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `file_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/file/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_id_get(self, id, **kwargs): # noqa: E501 + """file_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.file_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def file_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """file_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `file_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/file/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FileEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_lookup_get(self, sha1, **kwargs): # noqa: E501 + """file_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_lookup_get(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_lookup_get_with_http_info(sha1, **kwargs) # noqa: E501 + else: + (data) = self.file_lookup_get_with_http_info(sha1, **kwargs) # noqa: E501 + return data + + def file_lookup_get_with_http_info(self, sha1, **kwargs): # noqa: E501 + """file_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_lookup_get_with_http_info(sha1, async=True) + >>> result = thread.get() + + :param async bool + :param str sha1: (required) + :return: FileEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sha1'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sha1' is set + if ('sha1' not in params or + params['sha1'] is None): + raise ValueError("Missing the required parameter `sha1` when calling `file_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sha1' in params: + query_params.append(('sha1', params['sha1'])) # 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 + + # 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( + '/file/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FileEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def file_post(self, entity, **kwargs): # noqa: E501 + """file_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param FileEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.file_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.file_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def file_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """file_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.file_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param FileEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method file_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `file_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/file', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_batch_post(self, entity_list, **kwargs): # noqa: E501 + """release_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ReleaseEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.release_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def release_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """release_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[ReleaseEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `release_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/release/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_id_get(self, id, **kwargs): # noqa: E501 + """release_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.release_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def release_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """release_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `release_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/release/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ReleaseEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_lookup_get(self, doi, **kwargs): # noqa: E501 + """release_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_lookup_get(doi, async=True) + >>> result = thread.get() + + :param async bool + :param str doi: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_lookup_get_with_http_info(doi, **kwargs) # noqa: E501 + else: + (data) = self.release_lookup_get_with_http_info(doi, **kwargs) # noqa: E501 + return data + + def release_lookup_get_with_http_info(self, doi, **kwargs): # noqa: E501 + """release_lookup_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_lookup_get_with_http_info(doi, async=True) + >>> result = thread.get() + + :param async bool + :param str doi: (required) + :return: ReleaseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['doi'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_lookup_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'doi' is set + if ('doi' not in params or + params['doi'] is None): + raise ValueError("Missing the required parameter `doi` when calling `release_lookup_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'doi' in params: + query_params.append(('doi', params['doi'])) # 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 + + # 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( + '/release/lookup', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ReleaseEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def release_post(self, entity, **kwargs): # noqa: E501 + """release_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ReleaseEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.release_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.release_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def release_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """release_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.release_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param ReleaseEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method release_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `release_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/release', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_batch_post(self, entity_list, **kwargs): # noqa: E501 + """work_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_batch_post(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[WorkEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + else: + (data) = self.work_batch_post_with_http_info(entity_list, **kwargs) # noqa: E501 + return data + + def work_batch_post_with_http_info(self, entity_list, **kwargs): # noqa: E501 + """work_batch_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_batch_post_with_http_info(entity_list, async=True) + >>> result = thread.get() + + :param async bool + :param list[WorkEntity] entity_list: (required) + :return: list[EntityEdit] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_list'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_batch_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_list' is set + if ('entity_list' not in params or + params['entity_list'] is None): + raise ValueError("Missing the required parameter `entity_list` when calling `work_batch_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity_list' in params: + body_params = params['entity_list'] + # 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( + '/work/batch', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityEdit]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_id_get(self, id, **kwargs): # noqa: E501 + """work_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_id_get(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_id_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.work_id_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def work_id_get_with_http_info(self, id, **kwargs): # noqa: E501 + """work_id_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_id_get_with_http_info(id, async=True) + >>> result = thread.get() + + :param async bool + :param str id: (required) + :return: WorkEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_id_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `work_id_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = 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 + + # 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( + '/work/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WorkEntity', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def work_post(self, entity, **kwargs): # noqa: E501 + """work_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_post(entity, async=True) + >>> result = thread.get() + + :param async bool + :param WorkEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.work_post_with_http_info(entity, **kwargs) # noqa: E501 + else: + (data) = self.work_post_with_http_info(entity, **kwargs) # noqa: E501 + return data + + def work_post_with_http_info(self, entity, **kwargs): # noqa: E501 + """work_post # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.work_post_with_http_info(entity, async=True) + >>> result = thread.get() + + :param async bool + :param WorkEntity entity: (required) + :return: EntityEdit + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method work_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity' is set + if ('entity' not in params or + params['entity'] is None): + raise ValueError("Missing the required parameter `entity` when calling `work_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'entity' in params: + body_params = params['entity'] + # 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( + '/work', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityEdit', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/python/fatcat_client/fatcat_client/api_client.py b/python/fatcat_client/fatcat_client/api_client.py new file mode 100644 index 00000000..6e562014 --- /dev/null +++ b/python/fatcat_client/fatcat_client/api_client.py @@ -0,0 +1,621 @@ +# coding: utf-8 +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from fatcat_client.configuration import Configuration +import fatcat_client.models +from fatcat_client import rest + + +class ApiClient(object): + """Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match('list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(fatcat_client.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async request, set the async parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :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: + If async parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async is False or missing, + then the method will return the response directly. + """ + if not async: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) + return thread + + 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, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + 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 ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + 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 not auth_setting['value']: + continue + 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 ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.u(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not hasattr(klass, + 'get_real_child_model'): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/python/fatcat_client/fatcat_client/configuration.py b/python/fatcat_client/fatcat_client/configuration.py new file mode 100644 index 00000000..d64bb932 --- /dev/null +++ b/python/fatcat_client/fatcat_client/configuration.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class TypeWithDefault(type): + def __init__(cls, name, bases, dct): + super(TypeWithDefault, cls).__init__(name, bases, dct) + cls._default = None + + def __call__(cls): + if cls._default is None: + cls._default = type.__call__(cls) + return copy.copy(cls._default) + + def set_default(cls, default): + cls._default = copy.copy(default) + + +class Configuration(six.with_metaclass(TypeWithDefault, object)): + """NOTE: This class is auto generated by the swagger code generator program. + + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """Constructor""" + # Default Base url + self.host = "http://localhost/v0" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("fatcat_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if (self.api_key.get(identifier) and + self.api_key_prefix.get(identifier)): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 + elif self.api_key.get(identifier): + return self.api_key[identifier] + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + + } + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/python/fatcat_client/fatcat_client/models/__init__.py b/python/fatcat_client/fatcat_client/models/__init__.py new file mode 100644 index 00000000..ba62661b --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/__init__.py @@ -0,0 +1,32 @@ +# coding: utf-8 + +# flake8: noqa +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into model package +from fatcat_client.models.changelogentries import Changelogentries +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner +from fatcat_client.models.container_entity import ContainerEntity +from fatcat_client.models.creator_entity import CreatorEntity +from fatcat_client.models.editgroup import Editgroup +from fatcat_client.models.editgroup_edits import EditgroupEdits +from fatcat_client.models.editor import Editor +from fatcat_client.models.entity_edit import EntityEdit +from fatcat_client.models.error_response import ErrorResponse +from fatcat_client.models.file_entity import FileEntity +from fatcat_client.models.release_contrib import ReleaseContrib +from fatcat_client.models.release_entity import ReleaseEntity +from fatcat_client.models.release_ref import ReleaseRef +from fatcat_client.models.success import Success +from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/fatcat_client/models/changelogentries.py b/python/fatcat_client/fatcat_client/models/changelogentries.py new file mode 100644 index 00000000..acae2ad7 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/changelogentries.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner # noqa: F401,E501 + + +class Changelogentries(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """Changelogentries - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Changelogentries): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/changelogentries_inner.py b/python/fatcat_client/fatcat_client/models/changelogentries_inner.py new file mode 100644 index 00000000..08024f6f --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/changelogentries_inner.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ChangelogentriesInner(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'editgroup_id': 'int', + 'timestamp': 'datetime' + } + + attribute_map = { + 'index': 'index', + 'editgroup_id': 'editgroup_id', + 'timestamp': 'timestamp' + } + + def __init__(self, index=None, editgroup_id=None, timestamp=None): # noqa: E501 + """ChangelogentriesInner - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._editgroup_id = None + self._timestamp = None + self.discriminator = None + + self.index = index + self.editgroup_id = editgroup_id + self.timestamp = timestamp + + @property + def index(self): + """Gets the index of this ChangelogentriesInner. # noqa: E501 + + + :return: The index of this ChangelogentriesInner. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ChangelogentriesInner. + + + :param index: The index of this ChangelogentriesInner. # noqa: E501 + :type: int + """ + if index is None: + raise ValueError("Invalid value for `index`, must not be `None`") # noqa: E501 + + self._index = index + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ChangelogentriesInner. # noqa: E501 + + + :return: The editgroup_id of this ChangelogentriesInner. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ChangelogentriesInner. + + + :param editgroup_id: The editgroup_id of this ChangelogentriesInner. # noqa: E501 + :type: int + """ + if editgroup_id is None: + raise ValueError("Invalid value for `editgroup_id`, must not be `None`") # noqa: E501 + + self._editgroup_id = editgroup_id + + @property + def timestamp(self): + """Gets the timestamp of this ChangelogentriesInner. # noqa: E501 + + + :return: The timestamp of this ChangelogentriesInner. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ChangelogentriesInner. + + + :param timestamp: The timestamp of this ChangelogentriesInner. # noqa: E501 + :type: datetime + """ + if timestamp is None: + raise ValueError("Invalid value for `timestamp`, must not be `None`") # noqa: E501 + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangelogentriesInner): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/container_entity.py b/python/fatcat_client/fatcat_client/models/container_entity.py new file mode 100644 index 00000000..969c046d --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/container_entity.py @@ -0,0 +1,379 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ContainerEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'coden': 'str', + 'abbrev': 'str', + 'issnl': 'str', + 'publisher': 'str', + 'name': 'str', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'coden': 'coden', + 'abbrev': 'abbrev', + 'issnl': 'issnl', + 'publisher': 'publisher', + 'name': 'name', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, coden=None, abbrev=None, issnl=None, publisher=None, name=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """ContainerEntity - a model defined in Swagger""" # noqa: E501 + + self._coden = None + self._abbrev = None + self._issnl = None + self._publisher = None + self._name = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if coden is not None: + self.coden = coden + if abbrev is not None: + self.abbrev = abbrev + if issnl is not None: + self.issnl = issnl + if publisher is not None: + self.publisher = publisher + self.name = name + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def coden(self): + """Gets the coden of this ContainerEntity. # noqa: E501 + + + :return: The coden of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._coden + + @coden.setter + def coden(self, coden): + """Sets the coden of this ContainerEntity. + + + :param coden: The coden of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._coden = coden + + @property + def abbrev(self): + """Gets the abbrev of this ContainerEntity. # noqa: E501 + + + :return: The abbrev of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._abbrev + + @abbrev.setter + def abbrev(self, abbrev): + """Sets the abbrev of this ContainerEntity. + + + :param abbrev: The abbrev of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._abbrev = abbrev + + @property + def issnl(self): + """Gets the issnl of this ContainerEntity. # noqa: E501 + + + :return: The issnl of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._issnl + + @issnl.setter + def issnl(self, issnl): + """Sets the issnl of this ContainerEntity. + + + :param issnl: The issnl of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._issnl = issnl + + @property + def publisher(self): + """Gets the publisher of this ContainerEntity. # noqa: E501 + + + :return: The publisher of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._publisher + + @publisher.setter + def publisher(self, publisher): + """Sets the publisher of this ContainerEntity. + + + :param publisher: The publisher of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._publisher = publisher + + @property + def name(self): + """Gets the name of this ContainerEntity. # noqa: E501 + + + :return: The name of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ContainerEntity. + + + :param name: The name of this ContainerEntity. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def extra(self): + """Gets the extra of this ContainerEntity. # noqa: E501 + + + :return: The extra of this ContainerEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this ContainerEntity. + + + :param extra: The extra of this ContainerEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ContainerEntity. # noqa: E501 + + + :return: The editgroup_id of this ContainerEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ContainerEntity. + + + :param editgroup_id: The editgroup_id of this ContainerEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this ContainerEntity. # noqa: E501 + + + :return: The redirect of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this ContainerEntity. + + + :param redirect: The redirect of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this ContainerEntity. # noqa: E501 + + + :return: The revision of this ContainerEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this ContainerEntity. + + + :param revision: The revision of this ContainerEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this ContainerEntity. # noqa: E501 + + + :return: The ident of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this ContainerEntity. + + + :param ident: The ident of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this ContainerEntity. # noqa: E501 + + + :return: The state of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ContainerEntity. + + + :param state: The state of this ContainerEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ContainerEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/creator_entity.py b/python/fatcat_client/fatcat_client/models/creator_entity.py new file mode 100644 index 00000000..79be738b --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/creator_entity.py @@ -0,0 +1,301 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class CreatorEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'orcid': 'str', + 'full_name': 'str', + 'state': 'str', + 'ident': 'str', + 'revision': 'int', + 'redirect': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'orcid': 'orcid', + 'full_name': 'full_name', + 'state': 'state', + 'ident': 'ident', + 'revision': 'revision', + 'redirect': 'redirect', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, orcid=None, full_name=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 + """CreatorEntity - a model defined in Swagger""" # noqa: E501 + + self._orcid = None + self._full_name = None + self._state = None + self._ident = None + self._revision = None + self._redirect = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + if orcid is not None: + self.orcid = orcid + self.full_name = full_name + if state is not None: + self.state = state + if ident is not None: + self.ident = ident + if revision is not None: + self.revision = revision + if redirect is not None: + self.redirect = redirect + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def orcid(self): + """Gets the orcid of this CreatorEntity. # noqa: E501 + + + :return: The orcid of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._orcid + + @orcid.setter + def orcid(self, orcid): + """Sets the orcid of this CreatorEntity. + + + :param orcid: The orcid of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._orcid = orcid + + @property + def full_name(self): + """Gets the full_name of this CreatorEntity. # noqa: E501 + + + :return: The full_name of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._full_name + + @full_name.setter + def full_name(self, full_name): + """Sets the full_name of this CreatorEntity. + + + :param full_name: The full_name of this CreatorEntity. # noqa: E501 + :type: str + """ + if full_name is None: + raise ValueError("Invalid value for `full_name`, must not be `None`") # noqa: E501 + + self._full_name = full_name + + @property + def state(self): + """Gets the state of this CreatorEntity. # noqa: E501 + + + :return: The state of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CreatorEntity. + + + :param state: The state of this CreatorEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + @property + def ident(self): + """Gets the ident of this CreatorEntity. # noqa: E501 + + + :return: The ident of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this CreatorEntity. + + + :param ident: The ident of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this CreatorEntity. # noqa: E501 + + + :return: The revision of this CreatorEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this CreatorEntity. + + + :param revision: The revision of this CreatorEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect(self): + """Gets the redirect of this CreatorEntity. # noqa: E501 + + + :return: The redirect of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this CreatorEntity. + + + :param redirect: The redirect of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def editgroup_id(self): + """Gets the editgroup_id of this CreatorEntity. # noqa: E501 + + + :return: The editgroup_id of this CreatorEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this CreatorEntity. + + + :param editgroup_id: The editgroup_id of this CreatorEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this CreatorEntity. # noqa: E501 + + + :return: The extra of this CreatorEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this CreatorEntity. + + + :param extra: The extra of this CreatorEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CreatorEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/editgroup.py b/python/fatcat_client/fatcat_client/models/editgroup.py new file mode 100644 index 00000000..0855975d --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/editgroup.py @@ -0,0 +1,219 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.editgroup_edits import EditgroupEdits # noqa: F401,E501 + + +class Editgroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'editor_id': 'int', + 'description': 'str', + 'extra': 'object', + 'edits': 'EditgroupEdits' + } + + attribute_map = { + 'id': 'id', + 'editor_id': 'editor_id', + 'description': 'description', + 'extra': 'extra', + 'edits': 'edits' + } + + def __init__(self, id=None, editor_id=None, description=None, extra=None, edits=None): # noqa: E501 + """Editgroup - a model defined in Swagger""" # noqa: E501 + + self._id = None + self._editor_id = None + self._description = None + self._extra = None + self._edits = None + self.discriminator = None + + if id is not None: + self.id = id + self.editor_id = editor_id + if description is not None: + self.description = description + if extra is not None: + self.extra = extra + if edits is not None: + self.edits = edits + + @property + def id(self): + """Gets the id of this Editgroup. # noqa: E501 + + + :return: The id of this Editgroup. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Editgroup. + + + :param id: The id of this Editgroup. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def editor_id(self): + """Gets the editor_id of this Editgroup. # noqa: E501 + + + :return: The editor_id of this Editgroup. # noqa: E501 + :rtype: int + """ + return self._editor_id + + @editor_id.setter + def editor_id(self, editor_id): + """Sets the editor_id of this Editgroup. + + + :param editor_id: The editor_id of this Editgroup. # noqa: E501 + :type: int + """ + if editor_id is None: + raise ValueError("Invalid value for `editor_id`, must not be `None`") # noqa: E501 + + self._editor_id = editor_id + + @property + def description(self): + """Gets the description of this Editgroup. # noqa: E501 + + + :return: The description of this Editgroup. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Editgroup. + + + :param description: The description of this Editgroup. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def extra(self): + """Gets the extra of this Editgroup. # noqa: E501 + + + :return: The extra of this Editgroup. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this Editgroup. + + + :param extra: The extra of this Editgroup. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def edits(self): + """Gets the edits of this Editgroup. # noqa: E501 + + + :return: The edits of this Editgroup. # noqa: E501 + :rtype: EditgroupEdits + """ + return self._edits + + @edits.setter + def edits(self, edits): + """Sets the edits of this Editgroup. + + + :param edits: The edits of this Editgroup. # noqa: E501 + :type: EditgroupEdits + """ + + self._edits = edits + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Editgroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/editgroup_edits.py b/python/fatcat_client/fatcat_client/models/editgroup_edits.py new file mode 100644 index 00000000..7fae329d --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/editgroup_edits.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.entity_edit import EntityEdit # noqa: F401,E501 + + +class EditgroupEdits(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'containers': 'list[EntityEdit]', + 'creators': 'list[EntityEdit]', + 'files': 'list[EntityEdit]', + 'releases': 'list[EntityEdit]', + 'works': 'list[EntityEdit]' + } + + attribute_map = { + 'containers': 'containers', + 'creators': 'creators', + 'files': 'files', + 'releases': 'releases', + 'works': 'works' + } + + def __init__(self, containers=None, creators=None, files=None, releases=None, works=None): # noqa: E501 + """EditgroupEdits - a model defined in Swagger""" # noqa: E501 + + self._containers = None + self._creators = None + self._files = None + self._releases = None + self._works = None + self.discriminator = None + + if containers is not None: + self.containers = containers + if creators is not None: + self.creators = creators + if files is not None: + self.files = files + if releases is not None: + self.releases = releases + if works is not None: + self.works = works + + @property + def containers(self): + """Gets the containers of this EditgroupEdits. # noqa: E501 + + + :return: The containers of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._containers + + @containers.setter + def containers(self, containers): + """Sets the containers of this EditgroupEdits. + + + :param containers: The containers of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._containers = containers + + @property + def creators(self): + """Gets the creators of this EditgroupEdits. # noqa: E501 + + + :return: The creators of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._creators + + @creators.setter + def creators(self, creators): + """Sets the creators of this EditgroupEdits. + + + :param creators: The creators of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._creators = creators + + @property + def files(self): + """Gets the files of this EditgroupEdits. # noqa: E501 + + + :return: The files of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this EditgroupEdits. + + + :param files: The files of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._files = files + + @property + def releases(self): + """Gets the releases of this EditgroupEdits. # noqa: E501 + + + :return: The releases of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this EditgroupEdits. + + + :param releases: The releases of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._releases = releases + + @property + def works(self): + """Gets the works of this EditgroupEdits. # noqa: E501 + + + :return: The works of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._works + + @works.setter + def works(self, works): + """Sets the works of this EditgroupEdits. + + + :param works: The works of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._works = works + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EditgroupEdits): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/editor.py b/python/fatcat_client/fatcat_client/models/editor.py new file mode 100644 index 00000000..da2e0204 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/editor.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Editor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str' + } + + attribute_map = { + 'username': 'username' + } + + def __init__(self, username=None): # noqa: E501 + """Editor - a model defined in Swagger""" # noqa: E501 + + self._username = None + self.discriminator = None + + self.username = username + + @property + def username(self): + """Gets the username of this Editor. # noqa: E501 + + + :return: The username of this Editor. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this Editor. + + + :param username: The username of this Editor. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Editor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/entity_edit.py b/python/fatcat_client/fatcat_client/models/entity_edit.py new file mode 100644 index 00000000..47437af2 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/entity_edit.py @@ -0,0 +1,245 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class EntityEdit(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edit_id': 'int', + 'ident': 'str', + 'revision': 'int', + 'redirect_ident': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'edit_id': 'edit_id', + 'ident': 'ident', + 'revision': 'revision', + 'redirect_ident': 'redirect_ident', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, edit_id=None, ident=None, revision=None, redirect_ident=None, editgroup_id=None, extra=None): # noqa: E501 + """EntityEdit - a model defined in Swagger""" # noqa: E501 + + self._edit_id = None + self._ident = None + self._revision = None + self._redirect_ident = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + self.edit_id = edit_id + self.ident = ident + if revision is not None: + self.revision = revision + if redirect_ident is not None: + self.redirect_ident = redirect_ident + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def edit_id(self): + """Gets the edit_id of this EntityEdit. # noqa: E501 + + + :return: The edit_id of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._edit_id + + @edit_id.setter + def edit_id(self, edit_id): + """Sets the edit_id of this EntityEdit. + + + :param edit_id: The edit_id of this EntityEdit. # noqa: E501 + :type: int + """ + if edit_id is None: + raise ValueError("Invalid value for `edit_id`, must not be `None`") # noqa: E501 + + self._edit_id = edit_id + + @property + def ident(self): + """Gets the ident of this EntityEdit. # noqa: E501 + + + :return: The ident of this EntityEdit. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this EntityEdit. + + + :param ident: The ident of this EntityEdit. # noqa: E501 + :type: str + """ + if ident is None: + raise ValueError("Invalid value for `ident`, must not be `None`") # noqa: E501 + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this EntityEdit. # noqa: E501 + + + :return: The revision of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this EntityEdit. + + + :param revision: The revision of this EntityEdit. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect_ident(self): + """Gets the redirect_ident of this EntityEdit. # noqa: E501 + + + :return: The redirect_ident of this EntityEdit. # noqa: E501 + :rtype: str + """ + return self._redirect_ident + + @redirect_ident.setter + def redirect_ident(self, redirect_ident): + """Sets the redirect_ident of this EntityEdit. + + + :param redirect_ident: The redirect_ident of this EntityEdit. # noqa: E501 + :type: str + """ + + self._redirect_ident = redirect_ident + + @property + def editgroup_id(self): + """Gets the editgroup_id of this EntityEdit. # noqa: E501 + + + :return: The editgroup_id of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this EntityEdit. + + + :param editgroup_id: The editgroup_id of this EntityEdit. # noqa: E501 + :type: int + """ + if editgroup_id is None: + raise ValueError("Invalid value for `editgroup_id`, must not be `None`") # noqa: E501 + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this EntityEdit. # noqa: E501 + + + :return: The extra of this EntityEdit. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this EntityEdit. + + + :param extra: The extra of this EntityEdit. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityEdit): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/error_response.py b/python/fatcat_client/fatcat_client/models/error_response.py new file mode 100644 index 00000000..3e5d3488 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/error_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str' + } + + attribute_map = { + 'message': 'message' + } + + def __init__(self, message=None): # noqa: E501 + """ErrorResponse - a model defined in Swagger""" # noqa: E501 + + self._message = None + self.discriminator = None + + self.message = message + + @property + def message(self): + """Gets the message of this ErrorResponse. # noqa: E501 + + + :return: The message of this ErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ErrorResponse. + + + :param message: The message of this ErrorResponse. # noqa: E501 + :type: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/file_entity.py b/python/fatcat_client/fatcat_client/models/file_entity.py new file mode 100644 index 00000000..d8847ee2 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/file_entity.py @@ -0,0 +1,378 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FileEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'releases': 'list[str]', + 'url': 'str', + 'md5': 'str', + 'sha1': 'str', + 'size': 'int', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'releases': 'releases', + 'url': 'url', + 'md5': 'md5', + 'sha1': 'sha1', + 'size': 'size', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, releases=None, url=None, md5=None, sha1=None, size=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """FileEntity - a model defined in Swagger""" # noqa: E501 + + self._releases = None + self._url = None + self._md5 = None + self._sha1 = None + self._size = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if releases is not None: + self.releases = releases + if url is not None: + self.url = url + if md5 is not None: + self.md5 = md5 + if sha1 is not None: + self.sha1 = sha1 + if size is not None: + self.size = size + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def releases(self): + """Gets the releases of this FileEntity. # noqa: E501 + + + :return: The releases of this FileEntity. # noqa: E501 + :rtype: list[str] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this FileEntity. + + + :param releases: The releases of this FileEntity. # noqa: E501 + :type: list[str] + """ + + self._releases = releases + + @property + def url(self): + """Gets the url of this FileEntity. # noqa: E501 + + + :return: The url of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this FileEntity. + + + :param url: The url of this FileEntity. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def md5(self): + """Gets the md5 of this FileEntity. # noqa: E501 + + + :return: The md5 of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._md5 + + @md5.setter + def md5(self, md5): + """Sets the md5 of this FileEntity. + + + :param md5: The md5 of this FileEntity. # noqa: E501 + :type: str + """ + + self._md5 = md5 + + @property + def sha1(self): + """Gets the sha1 of this FileEntity. # noqa: E501 + + + :return: The sha1 of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._sha1 + + @sha1.setter + def sha1(self, sha1): + """Sets the sha1 of this FileEntity. + + + :param sha1: The sha1 of this FileEntity. # noqa: E501 + :type: str + """ + + self._sha1 = sha1 + + @property + def size(self): + """Gets the size of this FileEntity. # noqa: E501 + + + :return: The size of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._size + + @size.setter + def size(self, size): + """Sets the size of this FileEntity. + + + :param size: The size of this FileEntity. # noqa: E501 + :type: int + """ + + self._size = size + + @property + def extra(self): + """Gets the extra of this FileEntity. # noqa: E501 + + + :return: The extra of this FileEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this FileEntity. + + + :param extra: The extra of this FileEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this FileEntity. # noqa: E501 + + + :return: The editgroup_id of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this FileEntity. + + + :param editgroup_id: The editgroup_id of this FileEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this FileEntity. # noqa: E501 + + + :return: The redirect of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this FileEntity. + + + :param redirect: The redirect of this FileEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this FileEntity. # noqa: E501 + + + :return: The revision of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this FileEntity. + + + :param revision: The revision of this FileEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this FileEntity. # noqa: E501 + + + :return: The ident of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this FileEntity. + + + :param ident: The ident of this FileEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this FileEntity. # noqa: E501 + + + :return: The state of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this FileEntity. + + + :param state: The state of this FileEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FileEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/release_contrib.py b/python/fatcat_client/fatcat_client/models/release_contrib.py new file mode 100644 index 00000000..de458e67 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/release_contrib.py @@ -0,0 +1,190 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ReleaseContrib(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'creator_id': 'str', + 'creator_stub': 'str', + 'role': 'str' + } + + attribute_map = { + 'index': 'index', + 'creator_id': 'creator_id', + 'creator_stub': 'creator_stub', + 'role': 'role' + } + + def __init__(self, index=None, creator_id=None, creator_stub=None, role=None): # noqa: E501 + """ReleaseContrib - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._creator_id = None + self._creator_stub = None + self._role = None + self.discriminator = None + + if index is not None: + self.index = index + if creator_id is not None: + self.creator_id = creator_id + if creator_stub is not None: + self.creator_stub = creator_stub + if role is not None: + self.role = role + + @property + def index(self): + """Gets the index of this ReleaseContrib. # noqa: E501 + + + :return: The index of this ReleaseContrib. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ReleaseContrib. + + + :param index: The index of this ReleaseContrib. # noqa: E501 + :type: int + """ + + self._index = index + + @property + def creator_id(self): + """Gets the creator_id of this ReleaseContrib. # noqa: E501 + + + :return: The creator_id of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._creator_id + + @creator_id.setter + def creator_id(self, creator_id): + """Sets the creator_id of this ReleaseContrib. + + + :param creator_id: The creator_id of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._creator_id = creator_id + + @property + def creator_stub(self): + """Gets the creator_stub of this ReleaseContrib. # noqa: E501 + + + :return: The creator_stub of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._creator_stub + + @creator_stub.setter + def creator_stub(self, creator_stub): + """Sets the creator_stub of this ReleaseContrib. + + + :param creator_stub: The creator_stub of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._creator_stub = creator_stub + + @property + def role(self): + """Gets the role of this ReleaseContrib. # noqa: E501 + + + :return: The role of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this ReleaseContrib. + + + :param role: The role of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._role = role + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseContrib): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/release_entity.py b/python/fatcat_client/fatcat_client/models/release_entity.py new file mode 100644 index 00000000..408d527b --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/release_entity.py @@ -0,0 +1,591 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.release_contrib import ReleaseContrib # noqa: F401,E501 +from fatcat_client.models.release_ref import ReleaseRef # noqa: F401,E501 + + +class ReleaseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'refs': 'list[ReleaseRef]', + 'contribs': 'list[ReleaseContrib]', + 'publisher': 'str', + 'issue': 'str', + 'pages': 'str', + 'volume': 'str', + 'isbn13': 'str', + 'doi': 'str', + 'date': 'date', + 'release_type': 'str', + 'container_id': 'str', + 'work_id': 'str', + 'title': 'str', + 'state': 'str', + 'ident': 'str', + 'revision': 'int', + 'redirect': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'refs': 'refs', + 'contribs': 'contribs', + 'publisher': 'publisher', + 'issue': 'issue', + 'pages': 'pages', + 'volume': 'volume', + 'isbn13': 'isbn13', + 'doi': 'doi', + 'date': 'date', + 'release_type': 'release_type', + 'container_id': 'container_id', + 'work_id': 'work_id', + 'title': 'title', + 'state': 'state', + 'ident': 'ident', + 'revision': 'revision', + 'redirect': 'redirect', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, refs=None, contribs=None, publisher=None, issue=None, pages=None, volume=None, isbn13=None, doi=None, date=None, release_type=None, container_id=None, work_id=None, title=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 + """ReleaseEntity - a model defined in Swagger""" # noqa: E501 + + self._refs = None + self._contribs = None + self._publisher = None + self._issue = None + self._pages = None + self._volume = None + self._isbn13 = None + self._doi = None + self._date = None + self._release_type = None + self._container_id = None + self._work_id = None + self._title = None + self._state = None + self._ident = None + self._revision = None + self._redirect = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + if refs is not None: + self.refs = refs + if contribs is not None: + self.contribs = contribs + if publisher is not None: + self.publisher = publisher + if issue is not None: + self.issue = issue + if pages is not None: + self.pages = pages + if volume is not None: + self.volume = volume + if isbn13 is not None: + self.isbn13 = isbn13 + if doi is not None: + self.doi = doi + if date is not None: + self.date = date + if release_type is not None: + self.release_type = release_type + if container_id is not None: + self.container_id = container_id + self.work_id = work_id + self.title = title + if state is not None: + self.state = state + if ident is not None: + self.ident = ident + if revision is not None: + self.revision = revision + if redirect is not None: + self.redirect = redirect + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def refs(self): + """Gets the refs of this ReleaseEntity. # noqa: E501 + + + :return: The refs of this ReleaseEntity. # noqa: E501 + :rtype: list[ReleaseRef] + """ + return self._refs + + @refs.setter + def refs(self, refs): + """Sets the refs of this ReleaseEntity. + + + :param refs: The refs of this ReleaseEntity. # noqa: E501 + :type: list[ReleaseRef] + """ + + self._refs = refs + + @property + def contribs(self): + """Gets the contribs of this ReleaseEntity. # noqa: E501 + + + :return: The contribs of this ReleaseEntity. # noqa: E501 + :rtype: list[ReleaseContrib] + """ + return self._contribs + + @contribs.setter + def contribs(self, contribs): + """Sets the contribs of this ReleaseEntity. + + + :param contribs: The contribs of this ReleaseEntity. # noqa: E501 + :type: list[ReleaseContrib] + """ + + self._contribs = contribs + + @property + def publisher(self): + """Gets the publisher of this ReleaseEntity. # noqa: E501 + + + :return: The publisher of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._publisher + + @publisher.setter + def publisher(self, publisher): + """Sets the publisher of this ReleaseEntity. + + + :param publisher: The publisher of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._publisher = publisher + + @property + def issue(self): + """Gets the issue of this ReleaseEntity. # noqa: E501 + + + :return: The issue of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._issue + + @issue.setter + def issue(self, issue): + """Sets the issue of this ReleaseEntity. + + + :param issue: The issue of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._issue = issue + + @property + def pages(self): + """Gets the pages of this ReleaseEntity. # noqa: E501 + + + :return: The pages of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._pages + + @pages.setter + def pages(self, pages): + """Sets the pages of this ReleaseEntity. + + + :param pages: The pages of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._pages = pages + + @property + def volume(self): + """Gets the volume of this ReleaseEntity. # noqa: E501 + + + :return: The volume of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._volume + + @volume.setter + def volume(self, volume): + """Sets the volume of this ReleaseEntity. + + + :param volume: The volume of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._volume = volume + + @property + def isbn13(self): + """Gets the isbn13 of this ReleaseEntity. # noqa: E501 + + + :return: The isbn13 of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._isbn13 + + @isbn13.setter + def isbn13(self, isbn13): + """Sets the isbn13 of this ReleaseEntity. + + + :param isbn13: The isbn13 of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._isbn13 = isbn13 + + @property + def doi(self): + """Gets the doi of this ReleaseEntity. # noqa: E501 + + + :return: The doi of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._doi + + @doi.setter + def doi(self, doi): + """Sets the doi of this ReleaseEntity. + + + :param doi: The doi of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._doi = doi + + @property + def date(self): + """Gets the date of this ReleaseEntity. # noqa: E501 + + + :return: The date of this ReleaseEntity. # noqa: E501 + :rtype: date + """ + return self._date + + @date.setter + def date(self, date): + """Sets the date of this ReleaseEntity. + + + :param date: The date of this ReleaseEntity. # noqa: E501 + :type: date + """ + + self._date = date + + @property + def release_type(self): + """Gets the release_type of this ReleaseEntity. # noqa: E501 + + + :return: The release_type of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._release_type + + @release_type.setter + def release_type(self, release_type): + """Sets the release_type of this ReleaseEntity. + + + :param release_type: The release_type of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._release_type = release_type + + @property + def container_id(self): + """Gets the container_id of this ReleaseEntity. # noqa: E501 + + + :return: The container_id of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._container_id + + @container_id.setter + def container_id(self, container_id): + """Sets the container_id of this ReleaseEntity. + + + :param container_id: The container_id of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._container_id = container_id + + @property + def work_id(self): + """Gets the work_id of this ReleaseEntity. # noqa: E501 + + + :return: The work_id of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._work_id + + @work_id.setter + def work_id(self, work_id): + """Sets the work_id of this ReleaseEntity. + + + :param work_id: The work_id of this ReleaseEntity. # noqa: E501 + :type: str + """ + if work_id is None: + raise ValueError("Invalid value for `work_id`, must not be `None`") # noqa: E501 + + self._work_id = work_id + + @property + def title(self): + """Gets the title of this ReleaseEntity. # noqa: E501 + + + :return: The title of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ReleaseEntity. + + + :param title: The title of this ReleaseEntity. # noqa: E501 + :type: str + """ + if title is None: + raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 + + self._title = title + + @property + def state(self): + """Gets the state of this ReleaseEntity. # noqa: E501 + + + :return: The state of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ReleaseEntity. + + + :param state: The state of this ReleaseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + @property + def ident(self): + """Gets the ident of this ReleaseEntity. # noqa: E501 + + + :return: The ident of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this ReleaseEntity. + + + :param ident: The ident of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this ReleaseEntity. # noqa: E501 + + + :return: The revision of this ReleaseEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this ReleaseEntity. + + + :param revision: The revision of this ReleaseEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect(self): + """Gets the redirect of this ReleaseEntity. # noqa: E501 + + + :return: The redirect of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this ReleaseEntity. + + + :param redirect: The redirect of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ReleaseEntity. # noqa: E501 + + + :return: The editgroup_id of this ReleaseEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ReleaseEntity. + + + :param editgroup_id: The editgroup_id of this ReleaseEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this ReleaseEntity. # noqa: E501 + + + :return: The extra of this ReleaseEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this ReleaseEntity. + + + :param extra: The extra of this ReleaseEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/release_ref.py b/python/fatcat_client/fatcat_client/models/release_ref.py new file mode 100644 index 00000000..351c7a21 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/release_ref.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ReleaseRef(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'target_release_id': 'str', + 'stub': 'str' + } + + attribute_map = { + 'index': 'index', + 'target_release_id': 'target_release_id', + 'stub': 'stub' + } + + def __init__(self, index=None, target_release_id=None, stub=None): # noqa: E501 + """ReleaseRef - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._target_release_id = None + self._stub = None + self.discriminator = None + + if index is not None: + self.index = index + if target_release_id is not None: + self.target_release_id = target_release_id + if stub is not None: + self.stub = stub + + @property + def index(self): + """Gets the index of this ReleaseRef. # noqa: E501 + + + :return: The index of this ReleaseRef. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ReleaseRef. + + + :param index: The index of this ReleaseRef. # noqa: E501 + :type: int + """ + + self._index = index + + @property + def target_release_id(self): + """Gets the target_release_id of this ReleaseRef. # noqa: E501 + + + :return: The target_release_id of this ReleaseRef. # noqa: E501 + :rtype: str + """ + return self._target_release_id + + @target_release_id.setter + def target_release_id(self, target_release_id): + """Sets the target_release_id of this ReleaseRef. + + + :param target_release_id: The target_release_id of this ReleaseRef. # noqa: E501 + :type: str + """ + + self._target_release_id = target_release_id + + @property + def stub(self): + """Gets the stub of this ReleaseRef. # noqa: E501 + + + :return: The stub of this ReleaseRef. # noqa: E501 + :rtype: str + """ + return self._stub + + @stub.setter + def stub(self, stub): + """Sets the stub of this ReleaseRef. + + + :param stub: The stub of this ReleaseRef. # noqa: E501 + :type: str + """ + + self._stub = stub + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseRef): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/success.py b/python/fatcat_client/fatcat_client/models/success.py new file mode 100644 index 00000000..56cbd63a --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/success.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Success(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str' + } + + attribute_map = { + 'message': 'message' + } + + def __init__(self, message=None): # noqa: E501 + """Success - a model defined in Swagger""" # noqa: E501 + + self._message = None + self.discriminator = None + + self.message = message + + @property + def message(self): + """Gets the message of this Success. # noqa: E501 + + + :return: The message of this Success. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this Success. + + + :param message: The message of this Success. # noqa: E501 + :type: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Success): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/models/work_entity.py b/python/fatcat_client/fatcat_client/models/work_entity.py new file mode 100644 index 00000000..ffdc2c43 --- /dev/null +++ b/python/fatcat_client/fatcat_client/models/work_entity.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class WorkEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'work_type': 'str', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'work_type': 'work_type', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, work_type=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """WorkEntity - a model defined in Swagger""" # noqa: E501 + + self._work_type = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if work_type is not None: + self.work_type = work_type + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def work_type(self): + """Gets the work_type of this WorkEntity. # noqa: E501 + + + :return: The work_type of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._work_type + + @work_type.setter + def work_type(self, work_type): + """Sets the work_type of this WorkEntity. + + + :param work_type: The work_type of this WorkEntity. # noqa: E501 + :type: str + """ + + self._work_type = work_type + + @property + def extra(self): + """Gets the extra of this WorkEntity. # noqa: E501 + + + :return: The extra of this WorkEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this WorkEntity. + + + :param extra: The extra of this WorkEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this WorkEntity. # noqa: E501 + + + :return: The editgroup_id of this WorkEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this WorkEntity. + + + :param editgroup_id: The editgroup_id of this WorkEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this WorkEntity. # noqa: E501 + + + :return: The redirect of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this WorkEntity. + + + :param redirect: The redirect of this WorkEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this WorkEntity. # noqa: E501 + + + :return: The revision of this WorkEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this WorkEntity. + + + :param revision: The revision of this WorkEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this WorkEntity. # noqa: E501 + + + :return: The ident of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this WorkEntity. + + + :param ident: The ident of this WorkEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this WorkEntity. # noqa: E501 + + + :return: The state of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this WorkEntity. + + + :param state: The state of this WorkEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WorkEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/fatcat_client/rest.py b/python/fatcat_client/fatcat_client/rest.py new file mode 100644 index 00000000..5c322c6b --- /dev/null +++ b/python/fatcat_client/fatcat_client/rest.py @@ -0,0 +1,323 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + 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 ValueError( + "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): + 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 GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/python/fatcat_client/models/__init__.py b/python/fatcat_client/models/__init__.py new file mode 100644 index 00000000..ba62661b --- /dev/null +++ b/python/fatcat_client/models/__init__.py @@ -0,0 +1,32 @@ +# coding: utf-8 + +# flake8: noqa +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into model package +from fatcat_client.models.changelogentries import Changelogentries +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner +from fatcat_client.models.container_entity import ContainerEntity +from fatcat_client.models.creator_entity import CreatorEntity +from fatcat_client.models.editgroup import Editgroup +from fatcat_client.models.editgroup_edits import EditgroupEdits +from fatcat_client.models.editor import Editor +from fatcat_client.models.entity_edit import EntityEdit +from fatcat_client.models.error_response import ErrorResponse +from fatcat_client.models.file_entity import FileEntity +from fatcat_client.models.release_contrib import ReleaseContrib +from fatcat_client.models.release_entity import ReleaseEntity +from fatcat_client.models.release_ref import ReleaseRef +from fatcat_client.models.success import Success +from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/models/changelogentries.py b/python/fatcat_client/models/changelogentries.py new file mode 100644 index 00000000..acae2ad7 --- /dev/null +++ b/python/fatcat_client/models/changelogentries.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.changelogentries_inner import ChangelogentriesInner # noqa: F401,E501 + + +class Changelogentries(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """Changelogentries - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Changelogentries): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/changelogentries_inner.py b/python/fatcat_client/models/changelogentries_inner.py new file mode 100644 index 00000000..08024f6f --- /dev/null +++ b/python/fatcat_client/models/changelogentries_inner.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ChangelogentriesInner(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'editgroup_id': 'int', + 'timestamp': 'datetime' + } + + attribute_map = { + 'index': 'index', + 'editgroup_id': 'editgroup_id', + 'timestamp': 'timestamp' + } + + def __init__(self, index=None, editgroup_id=None, timestamp=None): # noqa: E501 + """ChangelogentriesInner - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._editgroup_id = None + self._timestamp = None + self.discriminator = None + + self.index = index + self.editgroup_id = editgroup_id + self.timestamp = timestamp + + @property + def index(self): + """Gets the index of this ChangelogentriesInner. # noqa: E501 + + + :return: The index of this ChangelogentriesInner. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ChangelogentriesInner. + + + :param index: The index of this ChangelogentriesInner. # noqa: E501 + :type: int + """ + if index is None: + raise ValueError("Invalid value for `index`, must not be `None`") # noqa: E501 + + self._index = index + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ChangelogentriesInner. # noqa: E501 + + + :return: The editgroup_id of this ChangelogentriesInner. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ChangelogentriesInner. + + + :param editgroup_id: The editgroup_id of this ChangelogentriesInner. # noqa: E501 + :type: int + """ + if editgroup_id is None: + raise ValueError("Invalid value for `editgroup_id`, must not be `None`") # noqa: E501 + + self._editgroup_id = editgroup_id + + @property + def timestamp(self): + """Gets the timestamp of this ChangelogentriesInner. # noqa: E501 + + + :return: The timestamp of this ChangelogentriesInner. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ChangelogentriesInner. + + + :param timestamp: The timestamp of this ChangelogentriesInner. # noqa: E501 + :type: datetime + """ + if timestamp is None: + raise ValueError("Invalid value for `timestamp`, must not be `None`") # noqa: E501 + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangelogentriesInner): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/container_entity.py b/python/fatcat_client/models/container_entity.py new file mode 100644 index 00000000..969c046d --- /dev/null +++ b/python/fatcat_client/models/container_entity.py @@ -0,0 +1,379 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ContainerEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'coden': 'str', + 'abbrev': 'str', + 'issnl': 'str', + 'publisher': 'str', + 'name': 'str', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'coden': 'coden', + 'abbrev': 'abbrev', + 'issnl': 'issnl', + 'publisher': 'publisher', + 'name': 'name', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, coden=None, abbrev=None, issnl=None, publisher=None, name=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """ContainerEntity - a model defined in Swagger""" # noqa: E501 + + self._coden = None + self._abbrev = None + self._issnl = None + self._publisher = None + self._name = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if coden is not None: + self.coden = coden + if abbrev is not None: + self.abbrev = abbrev + if issnl is not None: + self.issnl = issnl + if publisher is not None: + self.publisher = publisher + self.name = name + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def coden(self): + """Gets the coden of this ContainerEntity. # noqa: E501 + + + :return: The coden of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._coden + + @coden.setter + def coden(self, coden): + """Sets the coden of this ContainerEntity. + + + :param coden: The coden of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._coden = coden + + @property + def abbrev(self): + """Gets the abbrev of this ContainerEntity. # noqa: E501 + + + :return: The abbrev of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._abbrev + + @abbrev.setter + def abbrev(self, abbrev): + """Sets the abbrev of this ContainerEntity. + + + :param abbrev: The abbrev of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._abbrev = abbrev + + @property + def issnl(self): + """Gets the issnl of this ContainerEntity. # noqa: E501 + + + :return: The issnl of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._issnl + + @issnl.setter + def issnl(self, issnl): + """Sets the issnl of this ContainerEntity. + + + :param issnl: The issnl of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._issnl = issnl + + @property + def publisher(self): + """Gets the publisher of this ContainerEntity. # noqa: E501 + + + :return: The publisher of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._publisher + + @publisher.setter + def publisher(self, publisher): + """Sets the publisher of this ContainerEntity. + + + :param publisher: The publisher of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._publisher = publisher + + @property + def name(self): + """Gets the name of this ContainerEntity. # noqa: E501 + + + :return: The name of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ContainerEntity. + + + :param name: The name of this ContainerEntity. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def extra(self): + """Gets the extra of this ContainerEntity. # noqa: E501 + + + :return: The extra of this ContainerEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this ContainerEntity. + + + :param extra: The extra of this ContainerEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ContainerEntity. # noqa: E501 + + + :return: The editgroup_id of this ContainerEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ContainerEntity. + + + :param editgroup_id: The editgroup_id of this ContainerEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this ContainerEntity. # noqa: E501 + + + :return: The redirect of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this ContainerEntity. + + + :param redirect: The redirect of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this ContainerEntity. # noqa: E501 + + + :return: The revision of this ContainerEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this ContainerEntity. + + + :param revision: The revision of this ContainerEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this ContainerEntity. # noqa: E501 + + + :return: The ident of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this ContainerEntity. + + + :param ident: The ident of this ContainerEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this ContainerEntity. # noqa: E501 + + + :return: The state of this ContainerEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ContainerEntity. + + + :param state: The state of this ContainerEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ContainerEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/creator_entity.py b/python/fatcat_client/models/creator_entity.py new file mode 100644 index 00000000..79be738b --- /dev/null +++ b/python/fatcat_client/models/creator_entity.py @@ -0,0 +1,301 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class CreatorEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'orcid': 'str', + 'full_name': 'str', + 'state': 'str', + 'ident': 'str', + 'revision': 'int', + 'redirect': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'orcid': 'orcid', + 'full_name': 'full_name', + 'state': 'state', + 'ident': 'ident', + 'revision': 'revision', + 'redirect': 'redirect', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, orcid=None, full_name=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 + """CreatorEntity - a model defined in Swagger""" # noqa: E501 + + self._orcid = None + self._full_name = None + self._state = None + self._ident = None + self._revision = None + self._redirect = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + if orcid is not None: + self.orcid = orcid + self.full_name = full_name + if state is not None: + self.state = state + if ident is not None: + self.ident = ident + if revision is not None: + self.revision = revision + if redirect is not None: + self.redirect = redirect + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def orcid(self): + """Gets the orcid of this CreatorEntity. # noqa: E501 + + + :return: The orcid of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._orcid + + @orcid.setter + def orcid(self, orcid): + """Sets the orcid of this CreatorEntity. + + + :param orcid: The orcid of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._orcid = orcid + + @property + def full_name(self): + """Gets the full_name of this CreatorEntity. # noqa: E501 + + + :return: The full_name of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._full_name + + @full_name.setter + def full_name(self, full_name): + """Sets the full_name of this CreatorEntity. + + + :param full_name: The full_name of this CreatorEntity. # noqa: E501 + :type: str + """ + if full_name is None: + raise ValueError("Invalid value for `full_name`, must not be `None`") # noqa: E501 + + self._full_name = full_name + + @property + def state(self): + """Gets the state of this CreatorEntity. # noqa: E501 + + + :return: The state of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CreatorEntity. + + + :param state: The state of this CreatorEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + @property + def ident(self): + """Gets the ident of this CreatorEntity. # noqa: E501 + + + :return: The ident of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this CreatorEntity. + + + :param ident: The ident of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this CreatorEntity. # noqa: E501 + + + :return: The revision of this CreatorEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this CreatorEntity. + + + :param revision: The revision of this CreatorEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect(self): + """Gets the redirect of this CreatorEntity. # noqa: E501 + + + :return: The redirect of this CreatorEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this CreatorEntity. + + + :param redirect: The redirect of this CreatorEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def editgroup_id(self): + """Gets the editgroup_id of this CreatorEntity. # noqa: E501 + + + :return: The editgroup_id of this CreatorEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this CreatorEntity. + + + :param editgroup_id: The editgroup_id of this CreatorEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this CreatorEntity. # noqa: E501 + + + :return: The extra of this CreatorEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this CreatorEntity. + + + :param extra: The extra of this CreatorEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CreatorEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/editgroup.py b/python/fatcat_client/models/editgroup.py new file mode 100644 index 00000000..0855975d --- /dev/null +++ b/python/fatcat_client/models/editgroup.py @@ -0,0 +1,219 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.editgroup_edits import EditgroupEdits # noqa: F401,E501 + + +class Editgroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'editor_id': 'int', + 'description': 'str', + 'extra': 'object', + 'edits': 'EditgroupEdits' + } + + attribute_map = { + 'id': 'id', + 'editor_id': 'editor_id', + 'description': 'description', + 'extra': 'extra', + 'edits': 'edits' + } + + def __init__(self, id=None, editor_id=None, description=None, extra=None, edits=None): # noqa: E501 + """Editgroup - a model defined in Swagger""" # noqa: E501 + + self._id = None + self._editor_id = None + self._description = None + self._extra = None + self._edits = None + self.discriminator = None + + if id is not None: + self.id = id + self.editor_id = editor_id + if description is not None: + self.description = description + if extra is not None: + self.extra = extra + if edits is not None: + self.edits = edits + + @property + def id(self): + """Gets the id of this Editgroup. # noqa: E501 + + + :return: The id of this Editgroup. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Editgroup. + + + :param id: The id of this Editgroup. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def editor_id(self): + """Gets the editor_id of this Editgroup. # noqa: E501 + + + :return: The editor_id of this Editgroup. # noqa: E501 + :rtype: int + """ + return self._editor_id + + @editor_id.setter + def editor_id(self, editor_id): + """Sets the editor_id of this Editgroup. + + + :param editor_id: The editor_id of this Editgroup. # noqa: E501 + :type: int + """ + if editor_id is None: + raise ValueError("Invalid value for `editor_id`, must not be `None`") # noqa: E501 + + self._editor_id = editor_id + + @property + def description(self): + """Gets the description of this Editgroup. # noqa: E501 + + + :return: The description of this Editgroup. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Editgroup. + + + :param description: The description of this Editgroup. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def extra(self): + """Gets the extra of this Editgroup. # noqa: E501 + + + :return: The extra of this Editgroup. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this Editgroup. + + + :param extra: The extra of this Editgroup. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def edits(self): + """Gets the edits of this Editgroup. # noqa: E501 + + + :return: The edits of this Editgroup. # noqa: E501 + :rtype: EditgroupEdits + """ + return self._edits + + @edits.setter + def edits(self, edits): + """Sets the edits of this Editgroup. + + + :param edits: The edits of this Editgroup. # noqa: E501 + :type: EditgroupEdits + """ + + self._edits = edits + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Editgroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/editgroup_edits.py b/python/fatcat_client/models/editgroup_edits.py new file mode 100644 index 00000000..7fae329d --- /dev/null +++ b/python/fatcat_client/models/editgroup_edits.py @@ -0,0 +1,218 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.entity_edit import EntityEdit # noqa: F401,E501 + + +class EditgroupEdits(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'containers': 'list[EntityEdit]', + 'creators': 'list[EntityEdit]', + 'files': 'list[EntityEdit]', + 'releases': 'list[EntityEdit]', + 'works': 'list[EntityEdit]' + } + + attribute_map = { + 'containers': 'containers', + 'creators': 'creators', + 'files': 'files', + 'releases': 'releases', + 'works': 'works' + } + + def __init__(self, containers=None, creators=None, files=None, releases=None, works=None): # noqa: E501 + """EditgroupEdits - a model defined in Swagger""" # noqa: E501 + + self._containers = None + self._creators = None + self._files = None + self._releases = None + self._works = None + self.discriminator = None + + if containers is not None: + self.containers = containers + if creators is not None: + self.creators = creators + if files is not None: + self.files = files + if releases is not None: + self.releases = releases + if works is not None: + self.works = works + + @property + def containers(self): + """Gets the containers of this EditgroupEdits. # noqa: E501 + + + :return: The containers of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._containers + + @containers.setter + def containers(self, containers): + """Sets the containers of this EditgroupEdits. + + + :param containers: The containers of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._containers = containers + + @property + def creators(self): + """Gets the creators of this EditgroupEdits. # noqa: E501 + + + :return: The creators of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._creators + + @creators.setter + def creators(self, creators): + """Sets the creators of this EditgroupEdits. + + + :param creators: The creators of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._creators = creators + + @property + def files(self): + """Gets the files of this EditgroupEdits. # noqa: E501 + + + :return: The files of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this EditgroupEdits. + + + :param files: The files of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._files = files + + @property + def releases(self): + """Gets the releases of this EditgroupEdits. # noqa: E501 + + + :return: The releases of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this EditgroupEdits. + + + :param releases: The releases of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._releases = releases + + @property + def works(self): + """Gets the works of this EditgroupEdits. # noqa: E501 + + + :return: The works of this EditgroupEdits. # noqa: E501 + :rtype: list[EntityEdit] + """ + return self._works + + @works.setter + def works(self, works): + """Sets the works of this EditgroupEdits. + + + :param works: The works of this EditgroupEdits. # noqa: E501 + :type: list[EntityEdit] + """ + + self._works = works + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EditgroupEdits): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/editor.py b/python/fatcat_client/models/editor.py new file mode 100644 index 00000000..da2e0204 --- /dev/null +++ b/python/fatcat_client/models/editor.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Editor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str' + } + + attribute_map = { + 'username': 'username' + } + + def __init__(self, username=None): # noqa: E501 + """Editor - a model defined in Swagger""" # noqa: E501 + + self._username = None + self.discriminator = None + + self.username = username + + @property + def username(self): + """Gets the username of this Editor. # noqa: E501 + + + :return: The username of this Editor. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this Editor. + + + :param username: The username of this Editor. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Editor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/entity_edit.py b/python/fatcat_client/models/entity_edit.py new file mode 100644 index 00000000..47437af2 --- /dev/null +++ b/python/fatcat_client/models/entity_edit.py @@ -0,0 +1,245 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class EntityEdit(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edit_id': 'int', + 'ident': 'str', + 'revision': 'int', + 'redirect_ident': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'edit_id': 'edit_id', + 'ident': 'ident', + 'revision': 'revision', + 'redirect_ident': 'redirect_ident', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, edit_id=None, ident=None, revision=None, redirect_ident=None, editgroup_id=None, extra=None): # noqa: E501 + """EntityEdit - a model defined in Swagger""" # noqa: E501 + + self._edit_id = None + self._ident = None + self._revision = None + self._redirect_ident = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + self.edit_id = edit_id + self.ident = ident + if revision is not None: + self.revision = revision + if redirect_ident is not None: + self.redirect_ident = redirect_ident + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def edit_id(self): + """Gets the edit_id of this EntityEdit. # noqa: E501 + + + :return: The edit_id of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._edit_id + + @edit_id.setter + def edit_id(self, edit_id): + """Sets the edit_id of this EntityEdit. + + + :param edit_id: The edit_id of this EntityEdit. # noqa: E501 + :type: int + """ + if edit_id is None: + raise ValueError("Invalid value for `edit_id`, must not be `None`") # noqa: E501 + + self._edit_id = edit_id + + @property + def ident(self): + """Gets the ident of this EntityEdit. # noqa: E501 + + + :return: The ident of this EntityEdit. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this EntityEdit. + + + :param ident: The ident of this EntityEdit. # noqa: E501 + :type: str + """ + if ident is None: + raise ValueError("Invalid value for `ident`, must not be `None`") # noqa: E501 + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this EntityEdit. # noqa: E501 + + + :return: The revision of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this EntityEdit. + + + :param revision: The revision of this EntityEdit. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect_ident(self): + """Gets the redirect_ident of this EntityEdit. # noqa: E501 + + + :return: The redirect_ident of this EntityEdit. # noqa: E501 + :rtype: str + """ + return self._redirect_ident + + @redirect_ident.setter + def redirect_ident(self, redirect_ident): + """Sets the redirect_ident of this EntityEdit. + + + :param redirect_ident: The redirect_ident of this EntityEdit. # noqa: E501 + :type: str + """ + + self._redirect_ident = redirect_ident + + @property + def editgroup_id(self): + """Gets the editgroup_id of this EntityEdit. # noqa: E501 + + + :return: The editgroup_id of this EntityEdit. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this EntityEdit. + + + :param editgroup_id: The editgroup_id of this EntityEdit. # noqa: E501 + :type: int + """ + if editgroup_id is None: + raise ValueError("Invalid value for `editgroup_id`, must not be `None`") # noqa: E501 + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this EntityEdit. # noqa: E501 + + + :return: The extra of this EntityEdit. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this EntityEdit. + + + :param extra: The extra of this EntityEdit. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityEdit): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/error_response.py b/python/fatcat_client/models/error_response.py new file mode 100644 index 00000000..3e5d3488 --- /dev/null +++ b/python/fatcat_client/models/error_response.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str' + } + + attribute_map = { + 'message': 'message' + } + + def __init__(self, message=None): # noqa: E501 + """ErrorResponse - a model defined in Swagger""" # noqa: E501 + + self._message = None + self.discriminator = None + + self.message = message + + @property + def message(self): + """Gets the message of this ErrorResponse. # noqa: E501 + + + :return: The message of this ErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ErrorResponse. + + + :param message: The message of this ErrorResponse. # noqa: E501 + :type: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/file_entity.py b/python/fatcat_client/models/file_entity.py new file mode 100644 index 00000000..d8847ee2 --- /dev/null +++ b/python/fatcat_client/models/file_entity.py @@ -0,0 +1,378 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FileEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'releases': 'list[str]', + 'url': 'str', + 'md5': 'str', + 'sha1': 'str', + 'size': 'int', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'releases': 'releases', + 'url': 'url', + 'md5': 'md5', + 'sha1': 'sha1', + 'size': 'size', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, releases=None, url=None, md5=None, sha1=None, size=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """FileEntity - a model defined in Swagger""" # noqa: E501 + + self._releases = None + self._url = None + self._md5 = None + self._sha1 = None + self._size = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if releases is not None: + self.releases = releases + if url is not None: + self.url = url + if md5 is not None: + self.md5 = md5 + if sha1 is not None: + self.sha1 = sha1 + if size is not None: + self.size = size + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def releases(self): + """Gets the releases of this FileEntity. # noqa: E501 + + + :return: The releases of this FileEntity. # noqa: E501 + :rtype: list[str] + """ + return self._releases + + @releases.setter + def releases(self, releases): + """Sets the releases of this FileEntity. + + + :param releases: The releases of this FileEntity. # noqa: E501 + :type: list[str] + """ + + self._releases = releases + + @property + def url(self): + """Gets the url of this FileEntity. # noqa: E501 + + + :return: The url of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this FileEntity. + + + :param url: The url of this FileEntity. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def md5(self): + """Gets the md5 of this FileEntity. # noqa: E501 + + + :return: The md5 of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._md5 + + @md5.setter + def md5(self, md5): + """Sets the md5 of this FileEntity. + + + :param md5: The md5 of this FileEntity. # noqa: E501 + :type: str + """ + + self._md5 = md5 + + @property + def sha1(self): + """Gets the sha1 of this FileEntity. # noqa: E501 + + + :return: The sha1 of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._sha1 + + @sha1.setter + def sha1(self, sha1): + """Sets the sha1 of this FileEntity. + + + :param sha1: The sha1 of this FileEntity. # noqa: E501 + :type: str + """ + + self._sha1 = sha1 + + @property + def size(self): + """Gets the size of this FileEntity. # noqa: E501 + + + :return: The size of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._size + + @size.setter + def size(self, size): + """Sets the size of this FileEntity. + + + :param size: The size of this FileEntity. # noqa: E501 + :type: int + """ + + self._size = size + + @property + def extra(self): + """Gets the extra of this FileEntity. # noqa: E501 + + + :return: The extra of this FileEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this FileEntity. + + + :param extra: The extra of this FileEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this FileEntity. # noqa: E501 + + + :return: The editgroup_id of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this FileEntity. + + + :param editgroup_id: The editgroup_id of this FileEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this FileEntity. # noqa: E501 + + + :return: The redirect of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this FileEntity. + + + :param redirect: The redirect of this FileEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this FileEntity. # noqa: E501 + + + :return: The revision of this FileEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this FileEntity. + + + :param revision: The revision of this FileEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this FileEntity. # noqa: E501 + + + :return: The ident of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this FileEntity. + + + :param ident: The ident of this FileEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this FileEntity. # noqa: E501 + + + :return: The state of this FileEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this FileEntity. + + + :param state: The state of this FileEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FileEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/release_contrib.py b/python/fatcat_client/models/release_contrib.py new file mode 100644 index 00000000..de458e67 --- /dev/null +++ b/python/fatcat_client/models/release_contrib.py @@ -0,0 +1,190 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ReleaseContrib(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'creator_id': 'str', + 'creator_stub': 'str', + 'role': 'str' + } + + attribute_map = { + 'index': 'index', + 'creator_id': 'creator_id', + 'creator_stub': 'creator_stub', + 'role': 'role' + } + + def __init__(self, index=None, creator_id=None, creator_stub=None, role=None): # noqa: E501 + """ReleaseContrib - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._creator_id = None + self._creator_stub = None + self._role = None + self.discriminator = None + + if index is not None: + self.index = index + if creator_id is not None: + self.creator_id = creator_id + if creator_stub is not None: + self.creator_stub = creator_stub + if role is not None: + self.role = role + + @property + def index(self): + """Gets the index of this ReleaseContrib. # noqa: E501 + + + :return: The index of this ReleaseContrib. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ReleaseContrib. + + + :param index: The index of this ReleaseContrib. # noqa: E501 + :type: int + """ + + self._index = index + + @property + def creator_id(self): + """Gets the creator_id of this ReleaseContrib. # noqa: E501 + + + :return: The creator_id of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._creator_id + + @creator_id.setter + def creator_id(self, creator_id): + """Sets the creator_id of this ReleaseContrib. + + + :param creator_id: The creator_id of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._creator_id = creator_id + + @property + def creator_stub(self): + """Gets the creator_stub of this ReleaseContrib. # noqa: E501 + + + :return: The creator_stub of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._creator_stub + + @creator_stub.setter + def creator_stub(self, creator_stub): + """Sets the creator_stub of this ReleaseContrib. + + + :param creator_stub: The creator_stub of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._creator_stub = creator_stub + + @property + def role(self): + """Gets the role of this ReleaseContrib. # noqa: E501 + + + :return: The role of this ReleaseContrib. # noqa: E501 + :rtype: str + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this ReleaseContrib. + + + :param role: The role of this ReleaseContrib. # noqa: E501 + :type: str + """ + + self._role = role + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseContrib): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/release_entity.py b/python/fatcat_client/models/release_entity.py new file mode 100644 index 00000000..408d527b --- /dev/null +++ b/python/fatcat_client/models/release_entity.py @@ -0,0 +1,591 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + +from fatcat_client.models.release_contrib import ReleaseContrib # noqa: F401,E501 +from fatcat_client.models.release_ref import ReleaseRef # noqa: F401,E501 + + +class ReleaseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'refs': 'list[ReleaseRef]', + 'contribs': 'list[ReleaseContrib]', + 'publisher': 'str', + 'issue': 'str', + 'pages': 'str', + 'volume': 'str', + 'isbn13': 'str', + 'doi': 'str', + 'date': 'date', + 'release_type': 'str', + 'container_id': 'str', + 'work_id': 'str', + 'title': 'str', + 'state': 'str', + 'ident': 'str', + 'revision': 'int', + 'redirect': 'str', + 'editgroup_id': 'int', + 'extra': 'object' + } + + attribute_map = { + 'refs': 'refs', + 'contribs': 'contribs', + 'publisher': 'publisher', + 'issue': 'issue', + 'pages': 'pages', + 'volume': 'volume', + 'isbn13': 'isbn13', + 'doi': 'doi', + 'date': 'date', + 'release_type': 'release_type', + 'container_id': 'container_id', + 'work_id': 'work_id', + 'title': 'title', + 'state': 'state', + 'ident': 'ident', + 'revision': 'revision', + 'redirect': 'redirect', + 'editgroup_id': 'editgroup_id', + 'extra': 'extra' + } + + def __init__(self, refs=None, contribs=None, publisher=None, issue=None, pages=None, volume=None, isbn13=None, doi=None, date=None, release_type=None, container_id=None, work_id=None, title=None, state=None, ident=None, revision=None, redirect=None, editgroup_id=None, extra=None): # noqa: E501 + """ReleaseEntity - a model defined in Swagger""" # noqa: E501 + + self._refs = None + self._contribs = None + self._publisher = None + self._issue = None + self._pages = None + self._volume = None + self._isbn13 = None + self._doi = None + self._date = None + self._release_type = None + self._container_id = None + self._work_id = None + self._title = None + self._state = None + self._ident = None + self._revision = None + self._redirect = None + self._editgroup_id = None + self._extra = None + self.discriminator = None + + if refs is not None: + self.refs = refs + if contribs is not None: + self.contribs = contribs + if publisher is not None: + self.publisher = publisher + if issue is not None: + self.issue = issue + if pages is not None: + self.pages = pages + if volume is not None: + self.volume = volume + if isbn13 is not None: + self.isbn13 = isbn13 + if doi is not None: + self.doi = doi + if date is not None: + self.date = date + if release_type is not None: + self.release_type = release_type + if container_id is not None: + self.container_id = container_id + self.work_id = work_id + self.title = title + if state is not None: + self.state = state + if ident is not None: + self.ident = ident + if revision is not None: + self.revision = revision + if redirect is not None: + self.redirect = redirect + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if extra is not None: + self.extra = extra + + @property + def refs(self): + """Gets the refs of this ReleaseEntity. # noqa: E501 + + + :return: The refs of this ReleaseEntity. # noqa: E501 + :rtype: list[ReleaseRef] + """ + return self._refs + + @refs.setter + def refs(self, refs): + """Sets the refs of this ReleaseEntity. + + + :param refs: The refs of this ReleaseEntity. # noqa: E501 + :type: list[ReleaseRef] + """ + + self._refs = refs + + @property + def contribs(self): + """Gets the contribs of this ReleaseEntity. # noqa: E501 + + + :return: The contribs of this ReleaseEntity. # noqa: E501 + :rtype: list[ReleaseContrib] + """ + return self._contribs + + @contribs.setter + def contribs(self, contribs): + """Sets the contribs of this ReleaseEntity. + + + :param contribs: The contribs of this ReleaseEntity. # noqa: E501 + :type: list[ReleaseContrib] + """ + + self._contribs = contribs + + @property + def publisher(self): + """Gets the publisher of this ReleaseEntity. # noqa: E501 + + + :return: The publisher of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._publisher + + @publisher.setter + def publisher(self, publisher): + """Sets the publisher of this ReleaseEntity. + + + :param publisher: The publisher of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._publisher = publisher + + @property + def issue(self): + """Gets the issue of this ReleaseEntity. # noqa: E501 + + + :return: The issue of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._issue + + @issue.setter + def issue(self, issue): + """Sets the issue of this ReleaseEntity. + + + :param issue: The issue of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._issue = issue + + @property + def pages(self): + """Gets the pages of this ReleaseEntity. # noqa: E501 + + + :return: The pages of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._pages + + @pages.setter + def pages(self, pages): + """Sets the pages of this ReleaseEntity. + + + :param pages: The pages of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._pages = pages + + @property + def volume(self): + """Gets the volume of this ReleaseEntity. # noqa: E501 + + + :return: The volume of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._volume + + @volume.setter + def volume(self, volume): + """Sets the volume of this ReleaseEntity. + + + :param volume: The volume of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._volume = volume + + @property + def isbn13(self): + """Gets the isbn13 of this ReleaseEntity. # noqa: E501 + + + :return: The isbn13 of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._isbn13 + + @isbn13.setter + def isbn13(self, isbn13): + """Sets the isbn13 of this ReleaseEntity. + + + :param isbn13: The isbn13 of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._isbn13 = isbn13 + + @property + def doi(self): + """Gets the doi of this ReleaseEntity. # noqa: E501 + + + :return: The doi of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._doi + + @doi.setter + def doi(self, doi): + """Sets the doi of this ReleaseEntity. + + + :param doi: The doi of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._doi = doi + + @property + def date(self): + """Gets the date of this ReleaseEntity. # noqa: E501 + + + :return: The date of this ReleaseEntity. # noqa: E501 + :rtype: date + """ + return self._date + + @date.setter + def date(self, date): + """Sets the date of this ReleaseEntity. + + + :param date: The date of this ReleaseEntity. # noqa: E501 + :type: date + """ + + self._date = date + + @property + def release_type(self): + """Gets the release_type of this ReleaseEntity. # noqa: E501 + + + :return: The release_type of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._release_type + + @release_type.setter + def release_type(self, release_type): + """Sets the release_type of this ReleaseEntity. + + + :param release_type: The release_type of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._release_type = release_type + + @property + def container_id(self): + """Gets the container_id of this ReleaseEntity. # noqa: E501 + + + :return: The container_id of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._container_id + + @container_id.setter + def container_id(self, container_id): + """Sets the container_id of this ReleaseEntity. + + + :param container_id: The container_id of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._container_id = container_id + + @property + def work_id(self): + """Gets the work_id of this ReleaseEntity. # noqa: E501 + + + :return: The work_id of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._work_id + + @work_id.setter + def work_id(self, work_id): + """Sets the work_id of this ReleaseEntity. + + + :param work_id: The work_id of this ReleaseEntity. # noqa: E501 + :type: str + """ + if work_id is None: + raise ValueError("Invalid value for `work_id`, must not be `None`") # noqa: E501 + + self._work_id = work_id + + @property + def title(self): + """Gets the title of this ReleaseEntity. # noqa: E501 + + + :return: The title of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ReleaseEntity. + + + :param title: The title of this ReleaseEntity. # noqa: E501 + :type: str + """ + if title is None: + raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501 + + self._title = title + + @property + def state(self): + """Gets the state of this ReleaseEntity. # noqa: E501 + + + :return: The state of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ReleaseEntity. + + + :param state: The state of this ReleaseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + @property + def ident(self): + """Gets the ident of this ReleaseEntity. # noqa: E501 + + + :return: The ident of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this ReleaseEntity. + + + :param ident: The ident of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def revision(self): + """Gets the revision of this ReleaseEntity. # noqa: E501 + + + :return: The revision of this ReleaseEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this ReleaseEntity. + + + :param revision: The revision of this ReleaseEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def redirect(self): + """Gets the redirect of this ReleaseEntity. # noqa: E501 + + + :return: The redirect of this ReleaseEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this ReleaseEntity. + + + :param redirect: The redirect of this ReleaseEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def editgroup_id(self): + """Gets the editgroup_id of this ReleaseEntity. # noqa: E501 + + + :return: The editgroup_id of this ReleaseEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this ReleaseEntity. + + + :param editgroup_id: The editgroup_id of this ReleaseEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def extra(self): + """Gets the extra of this ReleaseEntity. # noqa: E501 + + + :return: The extra of this ReleaseEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this ReleaseEntity. + + + :param extra: The extra of this ReleaseEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/release_ref.py b/python/fatcat_client/models/release_ref.py new file mode 100644 index 00000000..351c7a21 --- /dev/null +++ b/python/fatcat_client/models/release_ref.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class ReleaseRef(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'index': 'int', + 'target_release_id': 'str', + 'stub': 'str' + } + + attribute_map = { + 'index': 'index', + 'target_release_id': 'target_release_id', + 'stub': 'stub' + } + + def __init__(self, index=None, target_release_id=None, stub=None): # noqa: E501 + """ReleaseRef - a model defined in Swagger""" # noqa: E501 + + self._index = None + self._target_release_id = None + self._stub = None + self.discriminator = None + + if index is not None: + self.index = index + if target_release_id is not None: + self.target_release_id = target_release_id + if stub is not None: + self.stub = stub + + @property + def index(self): + """Gets the index of this ReleaseRef. # noqa: E501 + + + :return: The index of this ReleaseRef. # noqa: E501 + :rtype: int + """ + return self._index + + @index.setter + def index(self, index): + """Sets the index of this ReleaseRef. + + + :param index: The index of this ReleaseRef. # noqa: E501 + :type: int + """ + + self._index = index + + @property + def target_release_id(self): + """Gets the target_release_id of this ReleaseRef. # noqa: E501 + + + :return: The target_release_id of this ReleaseRef. # noqa: E501 + :rtype: str + """ + return self._target_release_id + + @target_release_id.setter + def target_release_id(self, target_release_id): + """Sets the target_release_id of this ReleaseRef. + + + :param target_release_id: The target_release_id of this ReleaseRef. # noqa: E501 + :type: str + """ + + self._target_release_id = target_release_id + + @property + def stub(self): + """Gets the stub of this ReleaseRef. # noqa: E501 + + + :return: The stub of this ReleaseRef. # noqa: E501 + :rtype: str + """ + return self._stub + + @stub.setter + def stub(self, stub): + """Sets the stub of this ReleaseRef. + + + :param stub: The stub of this ReleaseRef. # noqa: E501 + :type: str + """ + + self._stub = stub + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReleaseRef): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/success.py b/python/fatcat_client/models/success.py new file mode 100644 index 00000000..56cbd63a --- /dev/null +++ b/python/fatcat_client/models/success.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Success(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str' + } + + attribute_map = { + 'message': 'message' + } + + def __init__(self, message=None): # noqa: E501 + """Success - a model defined in Swagger""" # noqa: E501 + + self._message = None + self.discriminator = None + + self.message = message + + @property + def message(self): + """Gets the message of this Success. # noqa: E501 + + + :return: The message of this Success. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this Success. + + + :param message: The message of this Success. # noqa: E501 + :type: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Success): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/models/work_entity.py b/python/fatcat_client/models/work_entity.py new file mode 100644 index 00000000..ffdc2c43 --- /dev/null +++ b/python/fatcat_client/models/work_entity.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class WorkEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'work_type': 'str', + 'extra': 'object', + 'editgroup_id': 'int', + 'redirect': 'str', + 'revision': 'int', + 'ident': 'str', + 'state': 'str' + } + + attribute_map = { + 'work_type': 'work_type', + 'extra': 'extra', + 'editgroup_id': 'editgroup_id', + 'redirect': 'redirect', + 'revision': 'revision', + 'ident': 'ident', + 'state': 'state' + } + + def __init__(self, work_type=None, extra=None, editgroup_id=None, redirect=None, revision=None, ident=None, state=None): # noqa: E501 + """WorkEntity - a model defined in Swagger""" # noqa: E501 + + self._work_type = None + self._extra = None + self._editgroup_id = None + self._redirect = None + self._revision = None + self._ident = None + self._state = None + self.discriminator = None + + if work_type is not None: + self.work_type = work_type + if extra is not None: + self.extra = extra + if editgroup_id is not None: + self.editgroup_id = editgroup_id + if redirect is not None: + self.redirect = redirect + if revision is not None: + self.revision = revision + if ident is not None: + self.ident = ident + if state is not None: + self.state = state + + @property + def work_type(self): + """Gets the work_type of this WorkEntity. # noqa: E501 + + + :return: The work_type of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._work_type + + @work_type.setter + def work_type(self, work_type): + """Sets the work_type of this WorkEntity. + + + :param work_type: The work_type of this WorkEntity. # noqa: E501 + :type: str + """ + + self._work_type = work_type + + @property + def extra(self): + """Gets the extra of this WorkEntity. # noqa: E501 + + + :return: The extra of this WorkEntity. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this WorkEntity. + + + :param extra: The extra of this WorkEntity. # noqa: E501 + :type: object + """ + + self._extra = extra + + @property + def editgroup_id(self): + """Gets the editgroup_id of this WorkEntity. # noqa: E501 + + + :return: The editgroup_id of this WorkEntity. # noqa: E501 + :rtype: int + """ + return self._editgroup_id + + @editgroup_id.setter + def editgroup_id(self, editgroup_id): + """Sets the editgroup_id of this WorkEntity. + + + :param editgroup_id: The editgroup_id of this WorkEntity. # noqa: E501 + :type: int + """ + + self._editgroup_id = editgroup_id + + @property + def redirect(self): + """Gets the redirect of this WorkEntity. # noqa: E501 + + + :return: The redirect of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._redirect + + @redirect.setter + def redirect(self, redirect): + """Sets the redirect of this WorkEntity. + + + :param redirect: The redirect of this WorkEntity. # noqa: E501 + :type: str + """ + + self._redirect = redirect + + @property + def revision(self): + """Gets the revision of this WorkEntity. # noqa: E501 + + + :return: The revision of this WorkEntity. # noqa: E501 + :rtype: int + """ + return self._revision + + @revision.setter + def revision(self, revision): + """Sets the revision of this WorkEntity. + + + :param revision: The revision of this WorkEntity. # noqa: E501 + :type: int + """ + + self._revision = revision + + @property + def ident(self): + """Gets the ident of this WorkEntity. # noqa: E501 + + + :return: The ident of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._ident + + @ident.setter + def ident(self, ident): + """Sets the ident of this WorkEntity. + + + :param ident: The ident of this WorkEntity. # noqa: E501 + :type: str + """ + + self._ident = ident + + @property + def state(self): + """Gets the state of this WorkEntity. # noqa: E501 + + + :return: The state of this WorkEntity. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this WorkEntity. + + + :param state: The state of this WorkEntity. # noqa: E501 + :type: str + """ + allowed_values = ["wip", "active", "redirect", "deleted"] # noqa: E501 + if state not in allowed_values: + raise ValueError( + "Invalid value for `state` ({0}), must be one of {1}" # noqa: E501 + .format(state, allowed_values) + ) + + self._state = state + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WorkEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/python/fatcat_client/rest.py b/python/fatcat_client/rest.py new file mode 100644 index 00000000..5c322c6b --- /dev/null +++ b/python/fatcat_client/rest.py @@ -0,0 +1,323 @@ +# coding: utf-8 + +""" + fatcat + + A scalable, versioned, API-oriented catalog of bibliographic entities and file metadata # noqa: E501 + + OpenAPI spec version: 0.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + 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 ValueError( + "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): + 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 GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message |