From ef79f4d157fc576eeb0f54e01d827f277de35708 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 11 Aug 2022 19:23:40 -0700 Subject: codegen python client using newer generator (v6.0.1) --- .../fatcat_openapi_client/api/auth_api.py | 446 +++++++++++++++++++++ 1 file changed, 446 insertions(+) create mode 100644 python_openapi_client/fatcat_openapi_client/api/auth_api.py (limited to 'python_openapi_client/fatcat_openapi_client/api/auth_api.py') diff --git a/python_openapi_client/fatcat_openapi_client/api/auth_api.py b/python_openapi_client/fatcat_openapi_client/api/auth_api.py new file mode 100644 index 00000000..442edb51 --- /dev/null +++ b/python_openapi_client/fatcat_openapi_client/api/auth_api.py @@ -0,0 +1,446 @@ +""" + fatcat + + Fatcat is a scalable, versioned, API-oriented catalog of bibliographic entities and file metadata. # noqa: E501 + + The version of the OpenAPI document: 0.5.0 + Contact: webservices@archive.org + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from fatcat_openapi_client.api_client import ApiClient, Endpoint as _Endpoint +from fatcat_openapi_client.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from fatcat_openapi_client.model.auth_oidc import AuthOidc +from fatcat_openapi_client.model.auth_oidc_result import AuthOidcResult +from fatcat_openapi_client.model.auth_token_result import AuthTokenResult +from fatcat_openapi_client.model.error_response import ErrorResponse +from fatcat_openapi_client.model.success import Success + + +class AuthApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + self.auth_check_endpoint = _Endpoint( + settings={ + 'response_type': (Success,), + 'auth': [ + 'Bearer' + ], + 'endpoint_path': '/auth/check', + 'operation_id': 'auth_check', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'role', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'role': + (str,), + }, + 'attribute_map': { + 'role': 'role', + }, + 'location_map': { + 'role': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) + self.auth_oidc_endpoint = _Endpoint( + settings={ + 'response_type': (AuthOidcResult,), + 'auth': [ + 'Bearer' + ], + 'endpoint_path': '/auth/oidc', + 'operation_id': 'auth_oidc', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'oidc_params', + ], + 'required': [ + 'oidc_params', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'oidc_params': + (AuthOidc,), + }, + 'attribute_map': { + }, + 'location_map': { + 'oidc_params': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client + ) + self.create_auth_token_endpoint = _Endpoint( + settings={ + 'response_type': (AuthTokenResult,), + 'auth': [ + 'Bearer' + ], + 'endpoint_path': '/auth/token/{editor_id}', + 'operation_id': 'create_auth_token', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'editor_id', + 'duration_seconds', + ], + 'required': [ + 'editor_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'editor_id': + (str,), + 'duration_seconds': + (int,), + }, + 'attribute_map': { + 'editor_id': 'editor_id', + 'duration_seconds': 'duration_seconds', + }, + 'location_map': { + 'editor_id': 'path', + 'duration_seconds': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) + + def auth_check( + self, + **kwargs + ): + """auth_check # noqa: E501 + + Verify that authentication (API token) is working as expected. The optional `role` parameter can be used to verify that the current account (editor) has permissions for the given role. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.auth_check(async_req=True) + >>> result = thread.get() + + + Keyword Args: + role (str): [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): 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. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None + async_req (bool): execute request asynchronously + + Returns: + Success + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) + return self.auth_check_endpoint.call_with_http_info(**kwargs) + + def auth_oidc( + self, + oidc_params, + **kwargs + ): + """auth_oidc # noqa: E501 + + Login or create editor account using OIDC metadata (internal method). This method is used by privileged front-end tools (like the web interface service) to process editor logins using OpenID Connect (OIDC) and/or OAuth. Most accounts (including tool and bot accounts) do not have sufficient privileges to call this method, which requires the `admin` role. The method returns an API token; the HTTP status code indicates whether an existing account was logged in, or a new account was created. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.auth_oidc(oidc_params, async_req=True) + >>> result = thread.get() + + Args: + oidc_params (AuthOidc): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): 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. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None + async_req (bool): execute request asynchronously + + Returns: + AuthOidcResult + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) + kwargs['oidc_params'] = \ + oidc_params + return self.auth_oidc_endpoint.call_with_http_info(**kwargs) + + def create_auth_token( + self, + editor_id, + **kwargs + ): + """create_auth_token # noqa: E501 + + Generate a new auth token for a given editor (internal method). This method is used by the web interface to generate API tokens for users. It can not be called by editors (human or bot) to generate new tokens for themselves, at least at this time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_auth_token(editor_id, async_req=True) + >>> result = thread.get() + + Args: + editor_id (str): + + Keyword Args: + duration_seconds (int): How long API token should be valid for (in seconds). [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): 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. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None + async_req (bool): execute request asynchronously + + Returns: + AuthTokenResult + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) + kwargs['editor_id'] = \ + editor_id + return self.create_auth_token_endpoint.call_with_http_info(**kwargs) + -- cgit v1.2.3