diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-25 10:45:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-25 10:45:44 -0700 |
commit | 3d53a6f8d3e42de68f0c142b2d1329a66a0b7924 (patch) | |
tree | 9896e61fa81d1d3d909efe1649f6095934137458 | |
parent | c2146fe7b5d299dab2692d2346d0037a944ac799 (diff) | |
download | fatcat-3d53a6f8d3e42de68f0c142b2d1329a66a0b7924.tar.gz fatcat-3d53a6f8d3e42de68f0c142b2d1329a66a0b7924.zip |
update fatcat codegen
-rw-r--r-- | python/README_codegen.md | 2 | ||||
-rw-r--r-- | python/fatcat_client/__init__.py | 1 | ||||
-rw-r--r-- | python/fatcat_client/api/default_api.py | 93 | ||||
-rw-r--r-- | python/fatcat_client/models/__init__.py | 1 | ||||
-rw-r--r-- | python/fatcat_client/models/release_entity.py | 50 | ||||
-rw-r--r-- | python/fatcat_client/models/stats_response.py | 112 | ||||
-rw-r--r-- | python/tests/codegen_tests/test_default_api.py | 6 | ||||
-rw-r--r-- | python/tests/codegen_tests/test_stats_response.py | 40 |
8 files changed, 281 insertions, 24 deletions
diff --git a/python/README_codegen.md b/python/README_codegen.md index e259c16f..6d436160 100644 --- a/python/README_codegen.md +++ b/python/README_codegen.md @@ -89,6 +89,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**get_file**](docs/DefaultApi.md#get_file) | **GET** /file/{id} | *DefaultApi* | [**get_release**](docs/DefaultApi.md#get_release) | **GET** /release/{id} | *DefaultApi* | [**get_release_files**](docs/DefaultApi.md#get_release_files) | **GET** /release/{id}/files | +*DefaultApi* | [**get_stats**](docs/DefaultApi.md#get_stats) | **GET** /stats | *DefaultApi* | [**get_work**](docs/DefaultApi.md#get_work) | **GET** /work/{id} | *DefaultApi* | [**get_work_releases**](docs/DefaultApi.md#get_work_releases) | **GET** /work/{id}/releases | *DefaultApi* | [**lookup_container**](docs/DefaultApi.md#lookup_container) | **GET** /container/lookup | @@ -112,6 +113,7 @@ Class | Method | HTTP request | Description - [ReleaseContrib](docs/ReleaseContrib.md) - [ReleaseEntity](docs/ReleaseEntity.md) - [ReleaseRef](docs/ReleaseRef.md) + - [StatsResponse](docs/StatsResponse.md) - [Success](docs/Success.md) - [WorkEntity](docs/WorkEntity.md) diff --git a/python/fatcat_client/__init__.py b/python/fatcat_client/__init__.py index 0497c101..8aa96f04 100644 --- a/python/fatcat_client/__init__.py +++ b/python/fatcat_client/__init__.py @@ -35,5 +35,6 @@ 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.stats_response import StatsResponse from fatcat_client.models.success import Success from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 7420c2ee..09e8d505 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -2070,6 +2070,99 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def get_stats(self, **kwargs): # noqa: E501 + """get_stats # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_stats(async=True) + >>> result = thread.get() + + :param async bool + :param str more: + :return: StatsResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_stats_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_stats_with_http_info(**kwargs) # noqa: E501 + return data + + def get_stats_with_http_info(self, **kwargs): # noqa: E501 + """get_stats # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_stats_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param str more: + :return: StatsResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['more'] # 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 get_stats" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'more' in params: + query_params.append(('more', params['more'])) # 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( + '/stats', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='StatsResponse', # 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 get_work(self, id, **kwargs): # noqa: E501 """get_work # noqa: E501 diff --git a/python/fatcat_client/models/__init__.py b/python/fatcat_client/models/__init__.py index ba62661b..f003f51c 100644 --- a/python/fatcat_client/models/__init__.py +++ b/python/fatcat_client/models/__init__.py @@ -28,5 +28,6 @@ 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.stats_response import StatsResponse from fatcat_client.models.success import Success from fatcat_client.models.work_entity import WorkEntity diff --git a/python/fatcat_client/models/release_entity.py b/python/fatcat_client/models/release_entity.py index 3c6f1acb..d74b9823 100644 --- a/python/fatcat_client/models/release_entity.py +++ b/python/fatcat_client/models/release_entity.py @@ -38,8 +38,8 @@ class ReleaseEntity(object): 'contribs': 'list[ReleaseContrib]', 'language': 'str', 'publisher': 'str', - 'issue': 'str', 'pages': 'str', + 'issue': 'str', 'volume': 'str', 'isbn13': 'str', 'doi': 'str', @@ -62,8 +62,8 @@ class ReleaseEntity(object): 'contribs': 'contribs', 'language': 'language', 'publisher': 'publisher', - 'issue': 'issue', 'pages': 'pages', + 'issue': 'issue', 'volume': 'volume', 'isbn13': 'isbn13', 'doi': 'doi', @@ -81,15 +81,15 @@ class ReleaseEntity(object): 'extra': 'extra' } - def __init__(self, refs=None, contribs=None, language=None, publisher=None, issue=None, pages=None, volume=None, isbn13=None, doi=None, release_date=None, release_status=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 + def __init__(self, refs=None, contribs=None, language=None, publisher=None, pages=None, issue=None, volume=None, isbn13=None, doi=None, release_date=None, release_status=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._language = None self._publisher = None - self._issue = None self._pages = None + self._issue = None self._volume = None self._isbn13 = None self._doi = None @@ -115,10 +115,10 @@ class ReleaseEntity(object): self.language = language 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 issue is not None: + self.issue = issue if volume is not None: self.volume = volume if isbn13 is not None: @@ -194,6 +194,7 @@ class ReleaseEntity(object): def language(self): """Gets the language of this ReleaseEntity. # noqa: E501 + Two-letter RFC1766/ISO639-1 language code, with extensions # noqa: E501 :return: The language of this ReleaseEntity. # noqa: E501 :rtype: str @@ -204,6 +205,7 @@ class ReleaseEntity(object): def language(self, language): """Sets the language of this ReleaseEntity. + Two-letter RFC1766/ISO639-1 language code, with extensions # noqa: E501 :param language: The language of this ReleaseEntity. # noqa: E501 :type: str @@ -233,46 +235,46 @@ class ReleaseEntity(object): self._publisher = publisher @property - def issue(self): - """Gets the issue of this ReleaseEntity. # noqa: E501 + def pages(self): + """Gets the pages of this ReleaseEntity. # noqa: E501 - :return: The issue of this ReleaseEntity. # noqa: E501 + :return: The pages of this ReleaseEntity. # noqa: E501 :rtype: str """ - return self._issue + return self._pages - @issue.setter - def issue(self, issue): - """Sets the issue of this ReleaseEntity. + @pages.setter + def pages(self, pages): + """Sets the pages of this ReleaseEntity. - :param issue: The issue of this ReleaseEntity. # noqa: E501 + :param pages: The pages of this ReleaseEntity. # noqa: E501 :type: str """ - self._issue = issue + self._pages = pages @property - def pages(self): - """Gets the pages of this ReleaseEntity. # noqa: E501 + def issue(self): + """Gets the issue of this ReleaseEntity. # noqa: E501 - :return: The pages of this ReleaseEntity. # noqa: E501 + :return: The issue of this ReleaseEntity. # noqa: E501 :rtype: str """ - return self._pages + return self._issue - @pages.setter - def pages(self, pages): - """Sets the pages of this ReleaseEntity. + @issue.setter + def issue(self, issue): + """Sets the issue of this ReleaseEntity. - :param pages: The pages of this ReleaseEntity. # noqa: E501 + :param issue: The issue of this ReleaseEntity. # noqa: E501 :type: str """ - self._pages = pages + self._issue = issue @property def volume(self): diff --git a/python/fatcat_client/models/stats_response.py b/python/fatcat_client/models/stats_response.py new file mode 100644 index 00000000..0a1a6513 --- /dev/null +++ b/python/fatcat_client/models/stats_response.py @@ -0,0 +1,112 @@ +# 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 StatsResponse(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 = { + 'extra': 'object' + } + + attribute_map = { + 'extra': 'extra' + } + + def __init__(self, extra=None): # noqa: E501 + """StatsResponse - a model defined in Swagger""" # noqa: E501 + + self._extra = None + self.discriminator = None + + if extra is not None: + self.extra = extra + + @property + def extra(self): + """Gets the extra of this StatsResponse. # noqa: E501 + + + :return: The extra of this StatsResponse. # noqa: E501 + :rtype: object + """ + return self._extra + + @extra.setter + def extra(self, extra): + """Sets the extra of this StatsResponse. + + + :param extra: The extra of this StatsResponse. # 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, StatsResponse): + 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/tests/codegen_tests/test_default_api.py b/python/tests/codegen_tests/test_default_api.py index 3fe852ad..a1f22d8c 100644 --- a/python/tests/codegen_tests/test_default_api.py +++ b/python/tests/codegen_tests/test_default_api.py @@ -155,6 +155,12 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_get_stats(self): + """Test case for get_stats + + """ + pass + def test_get_work(self): """Test case for get_work diff --git a/python/tests/codegen_tests/test_stats_response.py b/python/tests/codegen_tests/test_stats_response.py new file mode 100644 index 00000000..e787cd98 --- /dev/null +++ b/python/tests/codegen_tests/test_stats_response.py @@ -0,0 +1,40 @@ +# 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 unittest + +import fatcat_client +from fatcat_client.models.stats_response import StatsResponse # noqa: E501 +from fatcat_client.rest import ApiException + + +class TestStatsResponse(unittest.TestCase): + """StatsResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testStatsResponse(self): + """Test StatsResponse""" + # FIXME: construct object with mandatory attributes with example values + # model = fatcat_client.models.stats_response.StatsResponse() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() |