[python] fix typing for API responses (#16802)

* [python] remove _preload_content

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove _return_http_data_only

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove async_req

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix typing for API responses

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix AttributeError

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove _preload_content

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix response_type

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix typo

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update simplify RESTClientObject

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update split call_api into 4 functions

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update improve stream

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove kwargs

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update ApiResponse

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add method for each return value

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update test

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update docs

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add constantParams

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix ImportError

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix SyntaxError in RESTResponse

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add ApiResponse model_config

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix when isBinary is str

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update type

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add rest with pydantic v1

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update format

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update format and type

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add test

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update type to pydantic strict type

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove leftover files

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove descriptions per field

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add test

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix test

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] fix test

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove multiprocessing

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] add blank line to docstring

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update docstring

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] remove unwanted imports in rest

Signed-off-by: ふぁ <yuki@yuki0311.com>

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ
2023-10-30 13:37:23 +09:00
committed by GitHub
parent 3422ef1e64
commit 8827da8012
238 changed files with 33185 additions and 17862 deletions

View File

@@ -13,20 +13,21 @@
""" # noqa: E501
import re # noqa: F401
import io
import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any
try:
from typing import Annotated
except ImportError:
from typing_extensions import Annotated
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
from openapi_client.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
from openapi_client.rest import RESTResponseType
class AuthApi:
@@ -41,143 +42,249 @@ class AuthApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def test_auth_http_basic(
self,
**kwargs,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""To test HTTP basic authentication # noqa: E501
"""To test HTTP basic authentication
To test HTTP basic authentication # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
To test HTTP basic authentication
>>> thread = api.test_auth_http_basic(async_req=True)
>>> result = thread.get()
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_auth_http_basic_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_auth_http_basic_with_http_info.raw_function(
**kwargs,
)
@validate_call
def test_auth_http_basic_with_http_info(
self,
**kwargs,
) -> ApiResponse:
"""To test HTTP basic authentication # noqa: E501
To test HTTP basic authentication # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_auth_http_basic_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
"""
""" # noqa: E501
_params = locals()
_param = self._test_auth_http_basic_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_all_params = [
]
_all_params.extend(
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_auth_http_basic_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""To test HTTP basic authentication
To test HTTP basic authentication
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_auth_http_basic_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_auth_http_basic_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""To test HTTP basic authentication
To test HTTP basic authentication
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_auth_http_basic_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_auth_http_basic_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
'text/plain'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_auth_http_basic" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats: Dict[str, str] = {}
# process the path parameters
_path_params: Dict[str, str] = {}
# process the query parameters
_query_params: List[Tuple[str, str]] = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# authentication setting
_auth_settings: List[str] = ['http_auth'] # noqa: E501
_auth_settings: List[str] = [
'http_auth'
]
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
return self.api_client.call_api(
'/auth/http/basic', 'POST',
_path_params,
_query_params,
_header_params,
return self.api_client.param_serialize(
method='POST',
resource_path='/auth/http/basic',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
_host=_host,
_request_auth=_request_auth
)

File diff suppressed because it is too large Load Diff

View File

@@ -13,12 +13,16 @@
""" # noqa: E501
import re # noqa: F401
import io
import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any
try:
from typing import Annotated
except ImportError:
from typing_extensions import Annotated
from pydantic import StrictBool, StrictInt, StrictStr
@@ -27,10 +31,7 @@ from typing import Optional
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
from openapi_client.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
from openapi_client.rest import RESTResponseType
class FormApi:
@@ -45,22 +46,29 @@ class FormApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def test_form_integer_boolean_string(
self,
integer_form: Optional[StrictInt] = None,
boolean_form: Optional[StrictBool] = None,
string_form: Optional[StrictStr] = None,
**kwargs,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Test form parameter(s) # noqa: E501
"""Test form parameter(s)
Test form parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_form_integer_boolean_string(integer_form, boolean_form, string_form, async_req=True)
>>> result = thread.get()
Test form parameter(s)
:param integer_form:
:type integer_form: int
@@ -68,45 +76,75 @@ class FormApi:
:type boolean_form: bool
:param string_form:
:type string_form: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
""" # noqa: E501
return self.test_form_integer_boolean_string_with_http_info.raw_function(
integer_form,
boolean_form,
string_form,
**kwargs,
_param = self._test_form_integer_boolean_string_serialize(
integer_form=integer_form,
boolean_form=boolean_form,
string_form=string_form,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_form_integer_boolean_string_with_http_info(
self,
integer_form: Optional[StrictInt] = None,
boolean_form: Optional[StrictBool] = None,
string_form: Optional[StrictStr] = None,
**kwargs,
) -> ApiResponse:
"""Test form parameter(s) # noqa: E501
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Test form parameter(s)
Test form parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, async_req=True)
>>> result = thread.get()
Test form parameter(s)
:param integer_form:
:type integer_form: int
@@ -114,117 +152,204 @@ class FormApi:
:type boolean_form: bool
:param string_form:
:type string_form: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
"""
""" # noqa: E501
_params = locals()
_param = self._test_form_integer_boolean_string_serialize(
integer_form=integer_form,
boolean_form=boolean_form,
string_form=string_form,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_all_params = [
'integer_form',
'boolean_form',
'string_form'
]
_all_params.extend(
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_form_integer_boolean_string_without_preload_content(
self,
integer_form: Optional[StrictInt] = None,
boolean_form: Optional[StrictBool] = None,
string_form: Optional[StrictStr] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test form parameter(s)
Test form parameter(s)
:param integer_form:
:type integer_form: int
:param boolean_form:
:type boolean_form: bool
:param string_form:
:type string_form: str
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_form_integer_boolean_string_serialize(
integer_form=integer_form,
boolean_form=boolean_form,
string_form=string_form,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_form_integer_boolean_string_serialize(
self,
integer_form,
boolean_form,
string_form,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
if integer_form is not None:
_form_params.append(('integer_form', integer_form))
if boolean_form is not None:
_form_params.append(('boolean_form', boolean_form))
if string_form is not None:
_form_params.append(('string_form', string_form))
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
'text/plain'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_form_integer_boolean_string" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats: Dict[str, str] = {}
# process the path parameters
_path_params: Dict[str, str] = {}
# process the query parameters
_query_params: List[Tuple[str, str]] = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
if _params['integer_form'] is not None:
_form_params.append(('integer_form', _params['integer_form']))
if _params['boolean_form'] is not None:
_form_params.append(('boolean_form', _params['boolean_form']))
if _params['string_form'] is not None:
_form_params.append(('string_form', _params['string_form']))
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# set the HTTP header `Content-Type`
_content_types_list = _params.get('_content_type',
self.api_client.select_header_content_type(
['application/x-www-form-urlencoded']))
if _content_types_list:
_header_params['Content-Type'] = _content_types_list
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/x-www-form-urlencoded'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [] # noqa: E501
_auth_settings: List[str] = [
]
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
return self.api_client.call_api(
'/form/integer/boolean/string', 'POST',
_path_params,
_query_params,
_header_params,
return self.api_client.param_serialize(
method='POST',
resource_path='/form/integer/boolean/string',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
_host=_host,
_request_auth=_request_auth
)
@validate_call
def test_form_oneof(
@@ -235,16 +360,22 @@ class FormApi:
form4: Optional[StrictBool] = None,
id: Optional[StrictInt] = None,
name: Optional[StrictStr] = None,
**kwargs,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Test form parameter(s) for oneOf schema # noqa: E501
"""Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_form_oneof(form1, form2, form3, form4, id, name, async_req=True)
>>> result = thread.get()
Test form parameter(s) for oneOf schema
:param form1:
:type form1: str
@@ -258,32 +389,56 @@ class FormApi:
:type id: int
:param name:
:type name: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_form_oneof_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
""" # noqa: E501
return self.test_form_oneof_with_http_info.raw_function(
form1,
form2,
form3,
form4,
id,
name,
**kwargs,
_param = self._test_form_oneof_serialize(
form1=form1,
form2=form2,
form3=form3,
form4=form4,
id=id,
name=name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_form_oneof_with_http_info(
self,
@@ -293,16 +448,22 @@ class FormApi:
form4: Optional[StrictBool] = None,
id: Optional[StrictInt] = None,
name: Optional[StrictStr] = None,
**kwargs,
) -> ApiResponse:
"""Test form parameter(s) for oneOf schema # noqa: E501
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_form_oneof_with_http_info(form1, form2, form3, form4, id, name, async_req=True)
>>> result = thread.get()
Test form parameter(s) for oneOf schema
:param form1:
:type form1: str
@@ -316,126 +477,224 @@ class FormApi:
:type id: int
:param name:
:type name: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
"""
""" # noqa: E501
_params = locals()
_param = self._test_form_oneof_serialize(
form1=form1,
form2=form2,
form3=form3,
form4=form4,
id=id,
name=name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_all_params = [
'form1',
'form2',
'form3',
'form4',
'id',
'name'
]
_all_params.extend(
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_form_oneof_without_preload_content(
self,
form1: Optional[StrictStr] = None,
form2: Optional[StrictInt] = None,
form3: Optional[StrictStr] = None,
form4: Optional[StrictBool] = None,
id: Optional[StrictInt] = None,
name: Optional[StrictStr] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test form parameter(s) for oneOf schema
Test form parameter(s) for oneOf schema
:param form1:
:type form1: str
:param form2:
:type form2: int
:param form3:
:type form3: str
:param form4:
:type form4: bool
:param id:
:type id: int
:param name:
:type name: str
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_form_oneof_serialize(
form1=form1,
form2=form2,
form3=form3,
form4=form4,
id=id,
name=name,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_form_oneof_serialize(
self,
form1,
form2,
form3,
form4,
id,
name,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
if form1 is not None:
_form_params.append(('form1', form1))
if form2 is not None:
_form_params.append(('form2', form2))
if form3 is not None:
_form_params.append(('form3', form3))
if form4 is not None:
_form_params.append(('form4', form4))
if id is not None:
_form_params.append(('id', id))
if name is not None:
_form_params.append(('name', name))
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
'text/plain'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_form_oneof" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats: Dict[str, str] = {}
# process the path parameters
_path_params: Dict[str, str] = {}
# process the query parameters
_query_params: List[Tuple[str, str]] = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
if _params['form1'] is not None:
_form_params.append(('form1', _params['form1']))
if _params['form2'] is not None:
_form_params.append(('form2', _params['form2']))
if _params['form3'] is not None:
_form_params.append(('form3', _params['form3']))
if _params['form4'] is not None:
_form_params.append(('form4', _params['form4']))
if _params['id'] is not None:
_form_params.append(('id', _params['id']))
if _params['name'] is not None:
_form_params.append(('name', _params['name']))
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# set the HTTP header `Content-Type`
_content_types_list = _params.get('_content_type',
self.api_client.select_header_content_type(
['application/x-www-form-urlencoded']))
if _content_types_list:
_header_params['Content-Type'] = _content_types_list
if _content_type:
_header_params['Content-Type'] = _content_type
else:
_default_content_type = (
self.api_client.select_header_content_type(
[
'application/x-www-form-urlencoded'
]
)
)
if _default_content_type is not None:
_header_params['Content-Type'] = _default_content_type
# authentication setting
_auth_settings: List[str] = [] # noqa: E501
_auth_settings: List[str] = [
]
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
return self.api_client.call_api(
'/form/oneof', 'POST',
_path_params,
_query_params,
_header_params,
return self.api_client.param_serialize(
method='POST',
resource_path='/form/oneof',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
_host=_host,
_request_auth=_request_auth
)

View File

@@ -13,12 +13,16 @@
""" # noqa: E501
import re # noqa: F401
import io
import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any
try:
from typing import Annotated
except ImportError:
from typing_extensions import Annotated
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
@@ -28,10 +32,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
from openapi_client.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
from openapi_client.rest import RESTResponseType
class HeaderApi:
@@ -46,6 +47,7 @@ class HeaderApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def test_header_integer_boolean_string_enums(
self,
@@ -54,16 +56,22 @@ class HeaderApi:
string_header: Optional[StrictStr] = None,
enum_nonref_string_header: Optional[StrictStr] = None,
enum_ref_string_header: Optional[StringEnumRef] = None,
**kwargs,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Test header parameter(s) # noqa: E501
"""Test header parameter(s)
Test header parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_header_integer_boolean_string_enums(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, async_req=True)
>>> result = thread.get()
Test header parameter(s)
:param integer_header:
:type integer_header: int
@@ -75,31 +83,55 @@ class HeaderApi:
:type enum_nonref_string_header: str
:param enum_ref_string_header:
:type enum_ref_string_header: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_header_integer_boolean_string_enums_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
""" # noqa: E501
return self.test_header_integer_boolean_string_enums_with_http_info.raw_function(
integer_header,
boolean_header,
string_header,
enum_nonref_string_header,
enum_ref_string_header,
**kwargs,
_param = self._test_header_integer_boolean_string_enums_serialize(
integer_header=integer_header,
boolean_header=boolean_header,
string_header=string_header,
enum_nonref_string_header=enum_nonref_string_header,
enum_ref_string_header=enum_ref_string_header,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_header_integer_boolean_string_enums_with_http_info(
self,
@@ -108,16 +140,22 @@ class HeaderApi:
string_header: Optional[StrictStr] = None,
enum_nonref_string_header: Optional[StrictStr] = None,
enum_ref_string_header: Optional[StringEnumRef] = None,
**kwargs,
) -> ApiResponse:
"""Test header parameter(s) # noqa: E501
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Test header parameter(s)
Test header parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_header_integer_boolean_string_enums_with_http_info(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, async_req=True)
>>> result = thread.get()
Test header parameter(s)
:param integer_header:
:type integer_header: int
@@ -129,115 +167,203 @@ class HeaderApi:
:type enum_nonref_string_header: str
:param enum_ref_string_header:
:type enum_ref_string_header: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
"""
""" # noqa: E501
_params = locals()
_param = self._test_header_integer_boolean_string_enums_serialize(
integer_header=integer_header,
boolean_header=boolean_header,
string_header=string_header,
enum_nonref_string_header=enum_nonref_string_header,
enum_ref_string_header=enum_ref_string_header,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_all_params = [
'integer_header',
'boolean_header',
'string_header',
'enum_nonref_string_header',
'enum_ref_string_header'
]
_all_params.extend(
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_header_integer_boolean_string_enums_without_preload_content(
self,
integer_header: Optional[StrictInt] = None,
boolean_header: Optional[StrictBool] = None,
string_header: Optional[StrictStr] = None,
enum_nonref_string_header: Optional[StrictStr] = None,
enum_ref_string_header: Optional[StringEnumRef] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test header parameter(s)
Test header parameter(s)
:param integer_header:
:type integer_header: int
:param boolean_header:
:type boolean_header: bool
:param string_header:
:type string_header: str
:param enum_nonref_string_header:
:type enum_nonref_string_header: str
:param enum_ref_string_header:
:type enum_ref_string_header: StringEnumRef
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_header_integer_boolean_string_enums_serialize(
integer_header=integer_header,
boolean_header=boolean_header,
string_header=string_header,
enum_nonref_string_header=enum_nonref_string_header,
enum_ref_string_header=enum_ref_string_header,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_header_integer_boolean_string_enums_serialize(
self,
integer_header,
boolean_header,
string_header,
enum_nonref_string_header,
enum_ref_string_header,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
if integer_header is not None:
_header_params['integer_header'] = integer_header
if boolean_header is not None:
_header_params['boolean_header'] = boolean_header
if string_header is not None:
_header_params['string_header'] = string_header
if enum_nonref_string_header is not None:
_header_params['enum_nonref_string_header'] = enum_nonref_string_header
if enum_ref_string_header is not None:
_header_params['enum_ref_string_header'] = enum_ref_string_header
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
'text/plain'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_header_integer_boolean_string_enums" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats: Dict[str, str] = {}
# process the path parameters
_path_params: Dict[str, str] = {}
# process the query parameters
_query_params: List[Tuple[str, str]] = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
if _params['integer_header'] is not None:
_header_params['integer_header'] = _params['integer_header']
if _params['boolean_header'] is not None:
_header_params['boolean_header'] = _params['boolean_header']
if _params['string_header'] is not None:
_header_params['string_header'] = _params['string_header']
if _params['enum_nonref_string_header'] is not None:
_header_params['enum_nonref_string_header'] = _params['enum_nonref_string_header']
if _params['enum_ref_string_header'] is not None:
_header_params['enum_ref_string_header'] = _params['enum_ref_string_header']
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# authentication setting
_auth_settings: List[str] = [] # noqa: E501
_auth_settings: List[str] = [
]
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
return self.api_client.call_api(
'/header/integer/boolean/string/enums', 'GET',
_path_params,
_query_params,
_header_params,
return self.api_client.param_serialize(
method='GET',
resource_path='/header/integer/boolean/string/enums',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
_host=_host,
_request_auth=_request_auth
)

View File

@@ -13,12 +13,16 @@
""" # noqa: E501
import re # noqa: F401
import io
import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any
try:
from typing import Annotated
except ImportError:
from typing_extensions import Annotated
from pydantic import StrictInt, StrictStr, field_validator
@@ -26,10 +30,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
from openapi_client.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
from openapi_client.rest import RESTResponseType
class PathApi:
@@ -44,6 +45,7 @@ class PathApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_call
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(
self,
@@ -51,16 +53,22 @@ class PathApi:
path_integer: StrictInt,
enum_nonref_string_path: StrictStr,
enum_ref_string_path: StringEnumRef,
**kwargs,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Test path parameter(s) # noqa: E501
"""Test path parameter(s)
Test path parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, async_req=True)
>>> result = thread.get()
Test path parameter(s)
:param path_string: (required)
:type path_string: str
@@ -70,30 +78,54 @@ class PathApi:
:type enum_nonref_string_path: str
:param enum_ref_string_path: (required)
:type enum_ref_string_path: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: str
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
""" # noqa: E501
return self.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info.raw_function(
path_string,
path_integer,
enum_nonref_string_path,
enum_ref_string_path,
**kwargs,
_param = self._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
path_string=path_string,
path_integer=path_integer,
enum_nonref_string_path=enum_nonref_string_path,
enum_ref_string_path=enum_ref_string_path,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(
self,
@@ -101,16 +133,22 @@ class PathApi:
path_integer: StrictInt,
enum_nonref_string_path: StrictStr,
enum_ref_string_path: StringEnumRef,
**kwargs,
) -> ApiResponse:
"""Test path parameter(s) # noqa: E501
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Test path parameter(s)
Test path parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, async_req=True)
>>> result = thread.get()
Test path parameter(s)
:param path_string: (required)
:type path_string: str
@@ -120,111 +158,195 @@ class PathApi:
:type enum_nonref_string_path: str
:param enum_ref_string_path: (required)
:type enum_ref_string_path: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(str, status_code(int), headers(HTTPHeaderDict))
"""
""" # noqa: E501
_params = locals()
_param = self._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
path_string=path_string,
path_integer=path_integer,
enum_nonref_string_path=enum_nonref_string_path,
enum_ref_string_path=enum_ref_string_path,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_all_params = [
'path_string',
'path_integer',
'enum_nonref_string_path',
'enum_ref_string_path'
]
_all_params.extend(
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_without_preload_content(
self,
path_string: StrictStr,
path_integer: StrictInt,
enum_nonref_string_path: StrictStr,
enum_ref_string_path: StringEnumRef,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test path parameter(s)
Test path parameter(s)
:param path_string: (required)
:type path_string: str
:param path_integer: (required)
:type path_integer: int
:param enum_nonref_string_path: (required)
:type enum_nonref_string_path: str
:param enum_ref_string_path: (required)
:type enum_ref_string_path: StringEnumRef
: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.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
path_string=path_string,
path_integer=path_integer,
enum_nonref_string_path=enum_nonref_string_path,
enum_ref_string_path=enum_ref_string_path,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str"
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_serialize(
self,
path_string,
path_integer,
enum_nonref_string_path,
enum_ref_string_path,
_request_auth,
_content_type,
_headers,
_host_index,
) -> Tuple:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if path_string is not None:
_path_params['path_string'] = path_string
if path_integer is not None:
_path_params['path_integer'] = path_integer
if enum_nonref_string_path is not None:
_path_params['enum_nonref_string_path'] = enum_nonref_string_path
if enum_ref_string_path is not None:
_path_params['enum_ref_string_path'] = enum_ref_string_path.value
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
'text/plain'
]
)
# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path" % _key
)
_params[_key] = _val
del _params['kwargs']
_collection_formats: Dict[str, str] = {}
# process the path parameters
_path_params: Dict[str, str] = {}
if _params['path_string'] is not None:
_path_params['path_string'] = _params['path_string']
if _params['path_integer'] is not None:
_path_params['path_integer'] = _params['path_integer']
if _params['enum_nonref_string_path'] is not None:
_path_params['enum_nonref_string_path'] = _params['enum_nonref_string_path']
if _params['enum_ref_string_path'] is not None:
_path_params['enum_ref_string_path'] = _params['enum_ref_string_path'].value
# process the query parameters
_query_params: List[Tuple[str, str]] = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# authentication setting
_auth_settings: List[str] = [] # noqa: E501
_auth_settings: List[str] = [
]
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
return self.api_client.call_api(
'/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}', 'GET',
_path_params,
_query_params,
_header_params,
return self.api_client.param_serialize(
method='GET',
resource_path='/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
_host=_host,
_request_auth=_request_auth
)

File diff suppressed because it is too large Load Diff