Merge remote-tracking branch 'origin/master' into 6.0.x

This commit is contained in:
William Cheng
2021-09-22 12:13:44 +08:00
1475 changed files with 60168 additions and 24150 deletions

View File

@@ -38,14 +38,14 @@ git add .
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi

View File

@@ -35,74 +35,7 @@ class AnotherFakeApi(object):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def __call_123_test_special_tags(
self,
client,
**kwargs
):
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> result = thread.get()
Args:
client (Client): client model
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Client
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['_host_index'] = kwargs.get('_host_index')
kwargs['client'] = \
client
return self.call_with_http_info(**kwargs)
self.call_123_test_special_tags = _Endpoint(
self.call_123_test_special_tags_endpoint = _Endpoint(
settings={
'response_type': (Client,),
'auth': [],
@@ -150,6 +83,72 @@ class AnotherFakeApi(object):
'application/json'
]
},
api_client=api_client,
callable=__call_123_test_special_tags
api_client=api_client
)
def call_123_test_special_tags(
self,
client,
**kwargs
):
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> result = thread.get()
Args:
client (Client): client model
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Client
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['_host_index'] = kwargs.get('_host_index')
kwargs['client'] = \
client
return self.call_123_test_special_tags_endpoint.call_with_http_info(**kwargs)

View File

@@ -35,68 +35,7 @@ class DefaultApi(object):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def __foo_get(
self,
**kwargs
):
"""foo_get # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.foo_get(async_req=True)
>>> result = thread.get()
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
InlineResponseDefault
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['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.foo_get = _Endpoint(
self.foo_get_endpoint = _Endpoint(
settings={
'response_type': (InlineResponseDefault,),
'auth': [],
@@ -136,6 +75,66 @@ class DefaultApi(object):
],
'content_type': [],
},
api_client=api_client,
callable=__foo_get
api_client=api_client
)
def foo_get(
self,
**kwargs
):
"""foo_get # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.foo_get(async_req=True)
>>> result = thread.get()
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
InlineResponseDefault
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['_host_index'] = kwargs.get('_host_index')
return self.foo_get_endpoint.call_with_http_info(**kwargs)

View File

@@ -35,74 +35,7 @@ class FakeClassnameTags123Api(object):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def __test_classname(
self,
client,
**kwargs
):
"""To test class name in snake case # noqa: E501
To test class name in snake case # 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_classname(client, async_req=True)
>>> result = thread.get()
Args:
client (Client): client model
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Client
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['_host_index'] = kwargs.get('_host_index')
kwargs['client'] = \
client
return self.call_with_http_info(**kwargs)
self.test_classname = _Endpoint(
self.test_classname_endpoint = _Endpoint(
settings={
'response_type': (Client,),
'auth': [
@@ -152,6 +85,72 @@ class FakeClassnameTags123Api(object):
'application/json'
]
},
api_client=api_client,
callable=__test_classname
api_client=api_client
)
def test_classname(
self,
client,
**kwargs
):
"""To test class name in snake case # noqa: E501
To test class name in snake case # 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_classname(client, async_req=True)
>>> result = thread.get()
Args:
client (Client): client model
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Client
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['_host_index'] = kwargs.get('_host_index')
kwargs['client'] = \
client
return self.test_classname_endpoint.call_with_http_info(**kwargs)

View File

@@ -35,74 +35,7 @@ class StoreApi(object):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def __delete_order(
self,
order_id,
**kwargs
):
"""Delete purchase order by ID # noqa: E501
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_order(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (str): ID of the order that needs to be deleted
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
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['_host_index'] = kwargs.get('_host_index')
kwargs['order_id'] = \
order_id
return self.call_with_http_info(**kwargs)
self.delete_order = _Endpoint(
self.delete_order_endpoint = _Endpoint(
settings={
'response_type': None,
'auth': [],
@@ -147,72 +80,9 @@ class StoreApi(object):
'accept': [],
'content_type': [],
},
api_client=api_client,
callable=__delete_order
api_client=api_client
)
def __get_inventory(
self,
**kwargs
):
"""Returns pet inventories by status # noqa: E501
Returns a map of status codes to quantities # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_inventory(async_req=True)
>>> result = thread.get()
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
{str: (int,)}
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['_host_index'] = kwargs.get('_host_index')
return self.call_with_http_info(**kwargs)
self.get_inventory = _Endpoint(
self.get_inventory_endpoint = _Endpoint(
settings={
'response_type': ({str: (int,)},),
'auth': [
@@ -254,77 +124,9 @@ class StoreApi(object):
],
'content_type': [],
},
api_client=api_client,
callable=__get_inventory
api_client=api_client
)
def __get_order_by_id(
self,
order_id,
**kwargs
):
"""Find purchase order by ID # noqa: E501
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_order_by_id(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (int): ID of pet that needs to be fetched
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Order
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['_host_index'] = kwargs.get('_host_index')
kwargs['order_id'] = \
order_id
return self.call_with_http_info(**kwargs)
self.get_order_by_id = _Endpoint(
self.get_order_by_id_endpoint = _Endpoint(
settings={
'response_type': (Order,),
'auth': [],
@@ -378,76 +180,9 @@ class StoreApi(object):
],
'content_type': [],
},
api_client=api_client,
callable=__get_order_by_id
api_client=api_client
)
def __place_order(
self,
order,
**kwargs
):
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order(order, async_req=True)
>>> result = thread.get()
Args:
order (Order): order placed for purchasing the pet
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Order
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['_host_index'] = kwargs.get('_host_index')
kwargs['order'] = \
order
return self.call_with_http_info(**kwargs)
self.place_order = _Endpoint(
self.place_order_endpoint = _Endpoint(
settings={
'response_type': (Order,),
'auth': [],
@@ -496,6 +231,264 @@ class StoreApi(object):
'application/json'
]
},
api_client=api_client,
callable=__place_order
api_client=api_client
)
def delete_order(
self,
order_id,
**kwargs
):
"""Delete purchase order by ID # noqa: E501
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_order(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (str): ID of the order that needs to be deleted
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
None
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['_host_index'] = kwargs.get('_host_index')
kwargs['order_id'] = \
order_id
return self.delete_order_endpoint.call_with_http_info(**kwargs)
def get_inventory(
self,
**kwargs
):
"""Returns pet inventories by status # noqa: E501
Returns a map of status codes to quantities # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_inventory(async_req=True)
>>> result = thread.get()
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
{str: (int,)}
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['_host_index'] = kwargs.get('_host_index')
return self.get_inventory_endpoint.call_with_http_info(**kwargs)
def get_order_by_id(
self,
order_id,
**kwargs
):
"""Find purchase order by ID # noqa: E501
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_order_by_id(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (int): ID of pet that needs to be fetched
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Order
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['_host_index'] = kwargs.get('_host_index')
kwargs['order_id'] = \
order_id
return self.get_order_by_id_endpoint.call_with_http_info(**kwargs)
def place_order(
self,
order,
**kwargs
):
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order(order, async_req=True)
>>> result = thread.get()
Args:
order (Order): order placed for purchasing the pet
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.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Order
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['_host_index'] = kwargs.get('_host_index')
kwargs['order'] = \
order
return self.place_order_endpoint.call_with_http_info(**kwargs)

View File

@@ -9,6 +9,7 @@
from datetime import date, datetime # noqa: F401
from copy import deepcopy
import inspect
import io
import os
@@ -186,6 +187,26 @@ class OpenApiModel(object):
"""get the value of an attribute using dot notation: `instance.attr`"""
return self.__getitem__(attr)
def __copy__(self):
cls = self.__class__
if self.get("_spec_property_naming", False):
return cls._new_from_openapi_data(**self.__dict__)
else:
return new_cls.__new__(cls, **self.__dict__)
def __deepcopy__(self, memo):
cls = self.__class__
if self.get("_spec_property_naming", False):
new_inst = cls._new_from_openapi_data()
else:
new_inst = cls.__new__(cls)
for k, v in self.__dict__.items():
setattr(new_inst, k, deepcopy(v, memo))
return new_inst
def __new__(cls, *args, **kwargs):
# this function uses the discriminator to
# pick a new schema/class to instantiate because a discriminator
@@ -295,8 +316,13 @@ class OpenApiModel(object):
self_inst = super(OpenApiModel, cls).__new__(cls)
self_inst.__init__(*args, **kwargs)
new_inst = new_cls.__new__(new_cls, *args, **kwargs)
new_inst.__init__(*args, **kwargs)
if kwargs.get("_spec_property_naming", False):
# when true, implies new is from deserialization
new_inst = new_cls._new_from_openapi_data(*args, **kwargs)
else:
new_inst = new_cls.__new__(new_cls, *args, **kwargs)
new_inst.__init__(*args, **kwargs)
return new_inst

View File

@@ -0,0 +1,34 @@
from copy import deepcopy
import unittest
from petstore_api.model.mammal import Mammal
from petstore_api.model.triangle import Triangle
class TestCopy(unittest.TestCase):
"""TestCopy unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testDeepCopyOneOf(self):
"""test deepcopy"""
obj = deepcopy(Mammal(class_name="whale"))
assert id(deepcopy(obj)) != id(obj)
assert deepcopy(obj) == obj
def testDeepCopyAllOf(self):
"""test deepcopy"""
obj = Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle", foo="blah")
assert id(deepcopy(obj)) != id(obj)
assert deepcopy(obj) == obj
obj = Triangle._new_from_openapi_data(shape_type="Triangle", triangle_type="EquilateralTriangle", foo="blah")
assert id(deepcopy(obj)) != id(obj)
assert deepcopy(obj) == obj
if __name__ == '__main__':
unittest.main()

View File

@@ -91,7 +91,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model import animal_farm, animal
endpoint = self.api.array_model
endpoint = self.api.array_model_endpoint
assert endpoint.openapi_types['body'] == (animal_farm.AnimalFarm,)
assert endpoint.settings['response_type'] == (animal_farm.AnimalFarm,)
@@ -102,7 +102,7 @@ class TestFakeApi(unittest.TestCase):
json_data = [{"className": "Cat", "color": "black"}]
mock_method.return_value = self.mock_response(json_data)
response = endpoint(body=body)
response = self.api.array_model(body=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/arraymodel',
@@ -116,7 +116,7 @@ class TestFakeApi(unittest.TestCase):
"""Test case for boolean
"""
endpoint = self.api.boolean
endpoint = self.api.boolean_endpoint
assert endpoint.openapi_types['body'] == (bool,)
assert endpoint.settings['response_type'] == (bool,)
@@ -149,7 +149,7 @@ class TestFakeApi(unittest.TestCase):
from petstore_api.model.string_enum import StringEnum
from petstore_api.model.array_of_enums import ArrayOfEnums
endpoint = self.api.enum_test
endpoint = self.api.enum_test_endpoint
assert endpoint.openapi_types['enum_test'] == (EnumTest,)
assert endpoint.settings['response_type'] == (EnumTest,)
@@ -162,7 +162,7 @@ class TestFakeApi(unittest.TestCase):
json_value = {'enum_string_required': 'lower', 'InlineArrayOfStrEnum': ['approved']}
mock_method.return_value = self.mock_response(json_value)
response = endpoint(enum_test=body)
response = self.api.enum_test(enum_test=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/enum-test',
@@ -181,7 +181,7 @@ class TestFakeApi(unittest.TestCase):
json_value = {'enum_string_required': 'lower', 'ArrayOfStrEnum': ['approved']}
mock_method.return_value = self.mock_response(json_value)
response = endpoint(enum_test=body)
response = self.api.enum_test(enum_test=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/enum-test',
@@ -198,7 +198,7 @@ class TestFakeApi(unittest.TestCase):
Array of Enums # noqa: E501
"""
from petstore_api.model import array_of_enums, string_enum
endpoint = self.api.array_of_enums
endpoint = self.api.array_of_enums_endpoint
assert endpoint.openapi_types['array_of_enums'] == (array_of_enums.ArrayOfEnums,)
assert endpoint.settings['response_type'] == (array_of_enums.ArrayOfEnums,)
@@ -209,7 +209,7 @@ class TestFakeApi(unittest.TestCase):
value_simple = ["placed"]
mock_method.return_value = self.mock_response(value_simple)
response = endpoint(array_of_enums=body)
response = self.api.array_of_enums(array_of_enums=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/array-of-enums',
@@ -224,7 +224,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model import number_with_validations
endpoint = self.api.number_with_validations
endpoint = self.api.number_with_validations_endpoint
assert endpoint.openapi_types['body'] == (number_with_validations.NumberWithValidations,)
assert endpoint.settings['response_type'] == (number_with_validations.NumberWithValidations,)
@@ -234,7 +234,7 @@ class TestFakeApi(unittest.TestCase):
body = number_with_validations.NumberWithValidations(value)
mock_method.return_value = self.mock_response(value)
response = endpoint(body=body)
response = self.api.number_with_validations(body=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/number',
@@ -250,7 +250,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
from petstore_api.model.number_with_validations import NumberWithValidations
endpoint = self.api.object_model_with_ref_props
endpoint = self.api.object_model_with_ref_props_endpoint
assert endpoint.openapi_types['body'] == (ObjectModelWithRefProps,)
assert endpoint.settings['response_type'] == (ObjectModelWithRefProps,)
@@ -278,7 +278,7 @@ class TestFakeApi(unittest.TestCase):
with patch.object(RESTClientObject, 'request') as mock_method:
mock_method.return_value = self.mock_response(json_payload)
response = endpoint(body=expected_model)
response = self.api.object_model_with_ref_props(body=expected_model)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/object_model_with_ref_props',
@@ -293,7 +293,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model import animal, composed_one_of_number_with_validations, number_with_validations
endpoint = self.api.composed_one_of_number_with_validations
endpoint = self.api.composed_one_of_number_with_validations_endpoint
assert endpoint.openapi_types['composed_one_of_number_with_validations'] == (
composed_one_of_number_with_validations.ComposedOneOfNumberWithValidations,)
assert endpoint.settings['response_type'] == (
@@ -316,7 +316,7 @@ class TestFakeApi(unittest.TestCase):
with patch.object(RESTClientObject, 'request') as mock_method:
mock_method.return_value = self.mock_response(value_simple)
response = endpoint(composed_one_of_number_with_validations=body)
response = self.api.composed_one_of_number_with_validations(composed_one_of_number_with_validations=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/composed_one_of_number_with_validations',
@@ -330,7 +330,7 @@ class TestFakeApi(unittest.TestCase):
"""Test case for string
"""
endpoint = self.api.string
endpoint = self.api.string_endpoint
assert endpoint.openapi_types['body'] == (str,)
assert endpoint.settings['response_type'] == (str,)
@@ -340,7 +340,7 @@ class TestFakeApi(unittest.TestCase):
value_simple = body
mock_method.return_value = self.mock_response(value_simple)
response = endpoint(body=body)
response = self.api.string(body=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/string',
@@ -355,7 +355,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model import string_enum
endpoint = self.api.string_enum
endpoint = self.api.string_enum_endpoint
assert endpoint.openapi_types['body'] == (string_enum.StringEnum,)
assert endpoint.settings['response_type'] == (string_enum.StringEnum,)
@@ -366,7 +366,7 @@ class TestFakeApi(unittest.TestCase):
body = string_enum.StringEnum(value)
mock_method.return_value = self.mock_response(value)
response = endpoint(body=body)
response = self.api.string_enum(body=body)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/refs/enum',
@@ -641,7 +641,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload
from petstore_api.model.fake_post_inline_additional_properties_payload_array_data import FakePostInlineAdditionalPropertiesPayloadArrayData
endpoint = self.api.post_inline_additional_properties_ref_payload
endpoint = self.api.post_inline_additional_properties_ref_payload_endpoint
assert endpoint.openapi_types['inline_additional_properties_ref_payload'] == (InlineAdditionalPropertiesRefPayload,)
assert endpoint.settings['response_type'] == (InlineAdditionalPropertiesRefPayload,)
@@ -665,7 +665,7 @@ class TestFakeApi(unittest.TestCase):
)
mock_method.return_value = self.mock_response(expected_json_body)
response = endpoint(inline_additional_properties_ref_payload=inline_additional_properties_ref_payload)
response = self.api.post_inline_additional_properties_ref_payload(inline_additional_properties_ref_payload=inline_additional_properties_ref_payload)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/postInlineAdditionalPropertiesRefPayload',
@@ -680,7 +680,7 @@ class TestFakeApi(unittest.TestCase):
"""
from petstore_api.model.inline_object6 import InlineObject6
from petstore_api.model.fake_post_inline_additional_properties_payload_array_data import FakePostInlineAdditionalPropertiesPayloadArrayData
endpoint = self.api.post_inline_additional_properties_payload
endpoint = self.api.post_inline_additional_properties_payload_endpoint
assert endpoint.openapi_types['inline_object6'] == (InlineObject6,)
assert endpoint.settings['response_type'] == (InlineObject6,)
@@ -704,7 +704,7 @@ class TestFakeApi(unittest.TestCase):
)
mock_method.return_value = self.mock_response(expected_json_body)
response = endpoint(inline_object6=inline_object6)
response = self.api.post_inline_additional_properties_payload(inline_object6=inline_object6)
self.assert_request_called_with(
mock_method,
'http://petstore.swagger.io:80/v2/fake/postInlineAdditionalPropertiesPayload',