From 7b7e271decb2fbd5858aaae03616aa0da57a9429 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 31 Dec 2018 18:43:22 -0800 Subject: add missing security/auth declarations --- python/fatcat_client/api/default_api.py | 74 ++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'python/fatcat_client/api') diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 9f7edf07..5cb5dc64 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -120,7 +120,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/editgroup/{editgroup_id}/accept', 'POST', @@ -221,7 +221,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container', 'POST', @@ -326,7 +326,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/batch', 'POST', @@ -427,7 +427,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator', 'POST', @@ -532,7 +532,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/batch', 'POST', @@ -629,7 +629,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/editgroup', 'POST', @@ -730,7 +730,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file', 'POST', @@ -835,7 +835,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/batch', 'POST', @@ -936,7 +936,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset', 'POST', @@ -1041,7 +1041,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/batch', 'POST', @@ -1142,7 +1142,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release', 'POST', @@ -1247,7 +1247,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/batch', 'POST', @@ -1348,7 +1348,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture', 'POST', @@ -1453,7 +1453,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/batch', 'POST', @@ -1554,7 +1554,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work', 'POST', @@ -1659,7 +1659,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/batch', 'POST', @@ -1760,7 +1760,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/{ident}', 'DELETE', @@ -1865,7 +1865,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/edit/{edit_id}', 'DELETE', @@ -1966,7 +1966,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/{ident}', 'DELETE', @@ -2071,7 +2071,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/edit/{edit_id}', 'DELETE', @@ -2172,7 +2172,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/{ident}', 'DELETE', @@ -2277,7 +2277,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/edit/{edit_id}', 'DELETE', @@ -2378,7 +2378,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/{ident}', 'DELETE', @@ -2483,7 +2483,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/edit/{edit_id}', 'DELETE', @@ -2584,7 +2584,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/{ident}', 'DELETE', @@ -2689,7 +2689,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/edit/{edit_id}', 'DELETE', @@ -2790,7 +2790,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/{ident}', 'DELETE', @@ -2895,7 +2895,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/edit/{edit_id}', 'DELETE', @@ -2996,7 +2996,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/{ident}', 'DELETE', @@ -3101,7 +3101,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/edit/{edit_id}', 'DELETE', @@ -8331,7 +8331,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/container/{ident}', 'PUT', @@ -8440,7 +8440,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/creator/{ident}', 'PUT', @@ -8549,7 +8549,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/file/{ident}', 'PUT', @@ -8658,7 +8658,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/fileset/{ident}', 'PUT', @@ -8767,7 +8767,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/release/{ident}', 'PUT', @@ -8876,7 +8876,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/webcapture/{ident}', 'PUT', @@ -8985,7 +8985,7 @@ class DefaultApi(object): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['Bearer'] # noqa: E501 return self.api_client.call_api( '/work/{ident}', 'PUT', -- cgit v1.2.3 From b66dd55b128758cc929a1633ab6e15f8385873a1 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 16:53:58 -0800 Subject: python codegen --- python/fatcat_client/README.md | 3 + python/fatcat_client/__init__.py | 2 + python/fatcat_client/api/default_api.py | 97 ++++++++++++ python/fatcat_client/models/__init__.py | 2 + python/fatcat_client/models/auth_oidc.py | 167 +++++++++++++++++++++ python/fatcat_client/models/auth_oidc_result.py | 142 ++++++++++++++++++ python/fatcat_client/models/editor.py | 84 ++++++++++- python/tests/codegen_tests/test_auth_oidc.py | 40 +++++ .../tests/codegen_tests/test_auth_oidc_result.py | 40 +++++ python/tests/codegen_tests/test_default_api.py | 6 + 10 files changed, 580 insertions(+), 3 deletions(-) create mode 100644 python/fatcat_client/models/auth_oidc.py create mode 100644 python/fatcat_client/models/auth_oidc_result.py create mode 100644 python/tests/codegen_tests/test_auth_oidc.py create mode 100644 python/tests/codegen_tests/test_auth_oidc_result.py (limited to 'python/fatcat_client/api') diff --git a/python/fatcat_client/README.md b/python/fatcat_client/README.md index 069eb1b4..d03a4092 100644 --- a/python/fatcat_client/README.md +++ b/python/fatcat_client/README.md @@ -74,6 +74,7 @@ All URIs are relative to *https://api.fatcat.wiki/v0* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *DefaultApi* | [**accept_editgroup**](docs/DefaultApi.md#accept_editgroup) | **POST** /editgroup/{editgroup_id}/accept | +*DefaultApi* | [**auth_oidc**](docs/DefaultApi.md#auth_oidc) | **POST** /auth/oidc | *DefaultApi* | [**create_container**](docs/DefaultApi.md#create_container) | **POST** /container | *DefaultApi* | [**create_container_batch**](docs/DefaultApi.md#create_container_batch) | **POST** /container/batch | *DefaultApi* | [**create_creator**](docs/DefaultApi.md#create_creator) | **POST** /creator | @@ -163,6 +164,8 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [AuthOidc](docs/AuthOidc.md) + - [AuthOidcResult](docs/AuthOidcResult.md) - [ChangelogEntry](docs/ChangelogEntry.md) - [ContainerEntity](docs/ContainerEntity.md) - [CreatorEntity](docs/CreatorEntity.md) diff --git a/python/fatcat_client/__init__.py b/python/fatcat_client/__init__.py index 6b08c0b1..e9a04942 100644 --- a/python/fatcat_client/__init__.py +++ b/python/fatcat_client/__init__.py @@ -22,6 +22,8 @@ from fatcat_client.api.default_api import DefaultApi from fatcat_client.api_client import ApiClient from fatcat_client.configuration import Configuration # import models into sdk package +from fatcat_client.models.auth_oidc import AuthOidc +from fatcat_client.models.auth_oidc_result import AuthOidcResult from fatcat_client.models.changelog_entry import ChangelogEntry from fatcat_client.models.container_entity import ContainerEntity from fatcat_client.models.creator_entity import CreatorEntity diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 5cb5dc64..a0a193f0 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -138,6 +138,103 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def auth_oidc(self, oidc_params, **kwargs): # noqa: E501 + """auth_oidc # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.auth_oidc(oidc_params, async=True) + >>> result = thread.get() + + :param async bool + :param AuthOidc oidc_params: (required) + :return: AuthOidcResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.auth_oidc_with_http_info(oidc_params, **kwargs) # noqa: E501 + else: + (data) = self.auth_oidc_with_http_info(oidc_params, **kwargs) # noqa: E501 + return data + + def auth_oidc_with_http_info(self, oidc_params, **kwargs): # noqa: E501 + """auth_oidc # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.auth_oidc_with_http_info(oidc_params, async=True) + >>> result = thread.get() + + :param async bool + :param AuthOidc oidc_params: (required) + :return: AuthOidcResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['oidc_params'] # 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 auth_oidc" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'oidc_params' is set + if ('oidc_params' not in params or + params['oidc_params'] is None): + raise ValueError("Missing the required parameter `oidc_params` when calling `auth_oidc`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'oidc_params' in params: + body_params = params['oidc_params'] + # 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 = ['Bearer'] # noqa: E501 + + return self.api_client.call_api( + '/auth/oidc', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AuthOidcResult', # 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 create_container(self, entity, **kwargs): # noqa: E501 """create_container # noqa: E501 diff --git a/python/fatcat_client/models/__init__.py b/python/fatcat_client/models/__init__.py index f4716d61..ef77b4fd 100644 --- a/python/fatcat_client/models/__init__.py +++ b/python/fatcat_client/models/__init__.py @@ -15,6 +15,8 @@ from __future__ import absolute_import # import models into model package +from fatcat_client.models.auth_oidc import AuthOidc +from fatcat_client.models.auth_oidc_result import AuthOidcResult from fatcat_client.models.changelog_entry import ChangelogEntry from fatcat_client.models.container_entity import ContainerEntity from fatcat_client.models.creator_entity import CreatorEntity diff --git a/python/fatcat_client/models/auth_oidc.py b/python/fatcat_client/models/auth_oidc.py new file mode 100644 index 00000000..871cc23d --- /dev/null +++ b/python/fatcat_client/models/auth_oidc.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 AuthOidc(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 = { + 'provider': 'str', + 'sub': 'str', + 'iss': 'str' + } + + attribute_map = { + 'provider': 'provider', + 'sub': 'sub', + 'iss': 'iss' + } + + def __init__(self, provider=None, sub=None, iss=None): # noqa: E501 + """AuthOidc - a model defined in Swagger""" # noqa: E501 + + self._provider = None + self._sub = None + self._iss = None + self.discriminator = None + + self.provider = provider + self.sub = sub + self.iss = iss + + @property + def provider(self): + """Gets the provider of this AuthOidc. # noqa: E501 + + + :return: The provider of this AuthOidc. # noqa: E501 + :rtype: str + """ + return self._provider + + @provider.setter + def provider(self, provider): + """Sets the provider of this AuthOidc. + + + :param provider: The provider of this AuthOidc. # noqa: E501 + :type: str + """ + if provider is None: + raise ValueError("Invalid value for `provider`, must not be `None`") # noqa: E501 + + self._provider = provider + + @property + def sub(self): + """Gets the sub of this AuthOidc. # noqa: E501 + + + :return: The sub of this AuthOidc. # noqa: E501 + :rtype: str + """ + return self._sub + + @sub.setter + def sub(self, sub): + """Sets the sub of this AuthOidc. + + + :param sub: The sub of this AuthOidc. # noqa: E501 + :type: str + """ + if sub is None: + raise ValueError("Invalid value for `sub`, must not be `None`") # noqa: E501 + + self._sub = sub + + @property + def iss(self): + """Gets the iss of this AuthOidc. # noqa: E501 + + + :return: The iss of this AuthOidc. # noqa: E501 + :rtype: str + """ + return self._iss + + @iss.setter + def iss(self, iss): + """Sets the iss of this AuthOidc. + + + :param iss: The iss of this AuthOidc. # noqa: E501 + :type: str + """ + if iss is None: + raise ValueError("Invalid value for `iss`, must not be `None`") # noqa: E501 + + self._iss = iss + + 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, AuthOidc): + 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/auth_oidc_result.py b/python/fatcat_client/models/auth_oidc_result.py new file mode 100644 index 00000000..5e31a574 --- /dev/null +++ b/python/fatcat_client/models/auth_oidc_result.py @@ -0,0 +1,142 @@ +# 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.editor import Editor # noqa: F401,E501 + + +class AuthOidcResult(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 = { + 'editor': 'Editor', + 'token': 'str' + } + + attribute_map = { + 'editor': 'editor', + 'token': 'token' + } + + def __init__(self, editor=None, token=None): # noqa: E501 + """AuthOidcResult - a model defined in Swagger""" # noqa: E501 + + self._editor = None + self._token = None + self.discriminator = None + + self.editor = editor + self.token = token + + @property + def editor(self): + """Gets the editor of this AuthOidcResult. # noqa: E501 + + + :return: The editor of this AuthOidcResult. # noqa: E501 + :rtype: Editor + """ + return self._editor + + @editor.setter + def editor(self, editor): + """Sets the editor of this AuthOidcResult. + + + :param editor: The editor of this AuthOidcResult. # noqa: E501 + :type: Editor + """ + if editor is None: + raise ValueError("Invalid value for `editor`, must not be `None`") # noqa: E501 + + self._editor = editor + + @property + def token(self): + """Gets the token of this AuthOidcResult. # noqa: E501 + + + :return: The token of this AuthOidcResult. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this AuthOidcResult. + + + :param token: The token of this AuthOidcResult. # noqa: E501 + :type: str + """ + if token is None: + raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 + + self._token = token + + 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, AuthOidcResult): + 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 index 2010d454..493f5d81 100644 --- a/python/fatcat_client/models/editor.py +++ b/python/fatcat_client/models/editor.py @@ -32,24 +32,39 @@ class Editor(object): """ swagger_types = { 'editor_id': 'str', - 'username': 'str' + 'username': 'str', + 'is_admin': 'bool', + 'is_bot': 'bool', + 'is_active': 'bool' } attribute_map = { 'editor_id': 'editor_id', - 'username': 'username' + 'username': 'username', + 'is_admin': 'is_admin', + 'is_bot': 'is_bot', + 'is_active': 'is_active' } - def __init__(self, editor_id=None, username=None): # noqa: E501 + def __init__(self, editor_id=None, username=None, is_admin=None, is_bot=None, is_active=None): # noqa: E501 """Editor - a model defined in Swagger""" # noqa: E501 self._editor_id = None self._username = None + self._is_admin = None + self._is_bot = None + self._is_active = None self.discriminator = None if editor_id is not None: self.editor_id = editor_id self.username = username + if is_admin is not None: + self.is_admin = is_admin + if is_bot is not None: + self.is_bot = is_bot + if is_active is not None: + self.is_active = is_active @property def editor_id(self): @@ -103,6 +118,69 @@ class Editor(object): self._username = username + @property + def is_admin(self): + """Gets the is_admin of this Editor. # noqa: E501 + + + :return: The is_admin of this Editor. # noqa: E501 + :rtype: bool + """ + return self._is_admin + + @is_admin.setter + def is_admin(self, is_admin): + """Sets the is_admin of this Editor. + + + :param is_admin: The is_admin of this Editor. # noqa: E501 + :type: bool + """ + + self._is_admin = is_admin + + @property + def is_bot(self): + """Gets the is_bot of this Editor. # noqa: E501 + + + :return: The is_bot of this Editor. # noqa: E501 + :rtype: bool + """ + return self._is_bot + + @is_bot.setter + def is_bot(self, is_bot): + """Sets the is_bot of this Editor. + + + :param is_bot: The is_bot of this Editor. # noqa: E501 + :type: bool + """ + + self._is_bot = is_bot + + @property + def is_active(self): + """Gets the is_active of this Editor. # noqa: E501 + + + :return: The is_active of this Editor. # noqa: E501 + :rtype: bool + """ + return self._is_active + + @is_active.setter + def is_active(self, is_active): + """Sets the is_active of this Editor. + + + :param is_active: The is_active of this Editor. # noqa: E501 + :type: bool + """ + + self._is_active = is_active + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/python/tests/codegen_tests/test_auth_oidc.py b/python/tests/codegen_tests/test_auth_oidc.py new file mode 100644 index 00000000..f799da55 --- /dev/null +++ b/python/tests/codegen_tests/test_auth_oidc.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.auth_oidc import AuthOidc # noqa: E501 +from fatcat_client.rest import ApiException + + +class TestAuthOidc(unittest.TestCase): + """AuthOidc unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAuthOidc(self): + """Test AuthOidc""" + # FIXME: construct object with mandatory attributes with example values + # model = fatcat_client.models.auth_oidc.AuthOidc() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/python/tests/codegen_tests/test_auth_oidc_result.py b/python/tests/codegen_tests/test_auth_oidc_result.py new file mode 100644 index 00000000..d99ef446 --- /dev/null +++ b/python/tests/codegen_tests/test_auth_oidc_result.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.auth_oidc_result import AuthOidcResult # noqa: E501 +from fatcat_client.rest import ApiException + + +class TestAuthOidcResult(unittest.TestCase): + """AuthOidcResult unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAuthOidcResult(self): + """Test AuthOidcResult""" + # FIXME: construct object with mandatory attributes with example values + # model = fatcat_client.models.auth_oidc_result.AuthOidcResult() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/python/tests/codegen_tests/test_default_api.py b/python/tests/codegen_tests/test_default_api.py index ebc66cda..2f37a582 100644 --- a/python/tests/codegen_tests/test_default_api.py +++ b/python/tests/codegen_tests/test_default_api.py @@ -35,6 +35,12 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_auth_oidc(self): + """Test case for auth_oidc + + """ + pass + def test_create_container(self): """Test case for create_container -- cgit v1.2.3 From 206c92823a5ebedef459292fe83cd4d39d78bf46 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 17:53:53 -0800 Subject: python codegen --- python/fatcat_client/README.md | 1 + python/fatcat_client/api/default_api.py | 105 +++++++++++++++++++++++++ python/tests/codegen_tests/test_default_api.py | 6 ++ 3 files changed, 112 insertions(+) (limited to 'python/fatcat_client/api') diff --git a/python/fatcat_client/README.md b/python/fatcat_client/README.md index d03a4092..9c358fce 100644 --- a/python/fatcat_client/README.md +++ b/python/fatcat_client/README.md @@ -155,6 +155,7 @@ Class | Method | HTTP request | Description *DefaultApi* | [**lookup_release**](docs/DefaultApi.md#lookup_release) | **GET** /release/lookup | *DefaultApi* | [**update_container**](docs/DefaultApi.md#update_container) | **PUT** /container/{ident} | *DefaultApi* | [**update_creator**](docs/DefaultApi.md#update_creator) | **PUT** /creator/{ident} | +*DefaultApi* | [**update_editor**](docs/DefaultApi.md#update_editor) | **PUT** /editor/{editor_id} | *DefaultApi* | [**update_file**](docs/DefaultApi.md#update_file) | **PUT** /file/{ident} | *DefaultApi* | [**update_fileset**](docs/DefaultApi.md#update_fileset) | **PUT** /fileset/{ident} | *DefaultApi* | [**update_release**](docs/DefaultApi.md#update_release) | **PUT** /release/{ident} | diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index a0a193f0..926cbaca 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -8555,6 +8555,111 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def update_editor(self, editor_id, editor, **kwargs): # noqa: E501 + """update_editor # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_editor(editor_id, editor, async=True) + >>> result = thread.get() + + :param async bool + :param str editor_id: (required) + :param Editor editor: (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.update_editor_with_http_info(editor_id, editor, **kwargs) # noqa: E501 + else: + (data) = self.update_editor_with_http_info(editor_id, editor, **kwargs) # noqa: E501 + return data + + def update_editor_with_http_info(self, editor_id, editor, **kwargs): # noqa: E501 + """update_editor # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_editor_with_http_info(editor_id, editor, async=True) + >>> result = thread.get() + + :param async bool + :param str editor_id: (required) + :param Editor editor: (required) + :return: Editor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['editor_id', 'editor'] # 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 update_editor" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'editor_id' is set + if ('editor_id' not in params or + params['editor_id'] is None): + raise ValueError("Missing the required parameter `editor_id` when calling `update_editor`") # noqa: E501 + # verify the required parameter 'editor' is set + if ('editor' not in params or + params['editor'] is None): + raise ValueError("Missing the required parameter `editor` when calling `update_editor`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'editor_id' in params: + path_params['editor_id'] = params['editor_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'editor' in params: + body_params = params['editor'] + # 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 = ['Bearer'] # noqa: E501 + + return self.api_client.call_api( + '/editor/{editor_id}', 'PUT', + 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 update_file(self, ident, entity, **kwargs): # noqa: E501 """update_file # noqa: E501 diff --git a/python/tests/codegen_tests/test_default_api.py b/python/tests/codegen_tests/test_default_api.py index 2f37a582..522eeb1b 100644 --- a/python/tests/codegen_tests/test_default_api.py +++ b/python/tests/codegen_tests/test_default_api.py @@ -521,6 +521,12 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_update_editor(self): + """Test case for update_editor + + """ + pass + def test_update_file(self): """Test case for update_file -- cgit v1.2.3 From 13ab15af83a355b89aa3fdc032ad9bfca71cf350 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 8 Jan 2019 14:33:59 -0800 Subject: python codegen --- python/fatcat_client/README.md | 1 + python/fatcat_client/api/default_api.py | 93 ++++++++++++++++++++++++++ python/tests/codegen_tests/test_default_api.py | 6 ++ 3 files changed, 100 insertions(+) (limited to 'python/fatcat_client/api') diff --git a/python/fatcat_client/README.md b/python/fatcat_client/README.md index 9c358fce..8704641e 100644 --- a/python/fatcat_client/README.md +++ b/python/fatcat_client/README.md @@ -74,6 +74,7 @@ All URIs are relative to *https://api.fatcat.wiki/v0* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *DefaultApi* | [**accept_editgroup**](docs/DefaultApi.md#accept_editgroup) | **POST** /editgroup/{editgroup_id}/accept | +*DefaultApi* | [**auth_check**](docs/DefaultApi.md#auth_check) | **GET** /auth/check | *DefaultApi* | [**auth_oidc**](docs/DefaultApi.md#auth_oidc) | **POST** /auth/oidc | *DefaultApi* | [**create_container**](docs/DefaultApi.md#create_container) | **POST** /container | *DefaultApi* | [**create_container_batch**](docs/DefaultApi.md#create_container_batch) | **POST** /container/batch | diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py index 926cbaca..8b652571 100644 --- a/python/fatcat_client/api/default_api.py +++ b/python/fatcat_client/api/default_api.py @@ -138,6 +138,99 @@ class DefaultApi(object): _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def auth_check(self, **kwargs): # noqa: E501 + """auth_check # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.auth_check(async=True) + >>> result = thread.get() + + :param async bool + :param str role: + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.auth_check_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.auth_check_with_http_info(**kwargs) # noqa: E501 + return data + + def auth_check_with_http_info(self, **kwargs): # noqa: E501 + """auth_check # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.auth_check_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param str role: + :return: Success + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role'] # 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 auth_check" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'role' in params: + query_params.append(('role', params['role'])) # 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 = ['Bearer'] # noqa: E501 + + return self.api_client.call_api( + '/auth/check', 'GET', + 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 auth_oidc(self, oidc_params, **kwargs): # noqa: E501 """auth_oidc # noqa: E501 diff --git a/python/tests/codegen_tests/test_default_api.py b/python/tests/codegen_tests/test_default_api.py index 522eeb1b..9a632824 100644 --- a/python/tests/codegen_tests/test_default_api.py +++ b/python/tests/codegen_tests/test_default_api.py @@ -35,6 +35,12 @@ class TestDefaultApi(unittest.TestCase): """ pass + def test_auth_check(self): + """Test case for auth_check + + """ + pass + def test_auth_oidc(self): """Test case for auth_oidc -- cgit v1.2.3