Merge branch 'new_python_with_http_info' of https://github.com/zhenjun115/swagger-codegen into zhenjun115-new_python_with_http_info

Conflicts:
	modules/swagger-codegen/src/main/resources/python/api.mustache
	samples/client/petstore/python/swagger_client/__init__.py
	samples/client/petstore/python/swagger_client/api_client.py
	samples/client/petstore/python/swagger_client/apis/pet_api.py
	samples/client/petstore/python/swagger_client/apis/store_api.py
	samples/client/petstore/python/swagger_client/apis/user_api.py
	samples/client/petstore/python/swagger_client/models/__init__.py
	samples/client/petstore/python/swagger_client/models/name.py
This commit is contained in:
wing328 2016-06-20 11:58:35 +08:00
commit 88ce868bd5
12 changed files with 1175 additions and 79 deletions

View File

@ -51,6 +51,40 @@ class {{classname}}(object):
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function) >>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function)
{{/sortParamsByRequiredFlag}} {{/sortParamsByRequiredFlag}}
:param callback function: The callback function
for asynchronous request. (optional)
{{#allParams}}
:param {{dataType}} {{paramName}}: {{{description}}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
{{/allParams}}
:return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs)
else:
(data) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs)
return data
def {{operationId}}_with_http_info(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs):
"""
{{{summary}}}
{{{notes}}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function)
{{/sortParamsByRequiredFlag}}
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
{{#allParams}} {{#allParams}}
@ -63,6 +97,7 @@ class {{classname}}(object):
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}]
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -150,7 +185,7 @@ class {{classname}}(object):
# Authentication setting # Authentication setting
auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
response = self.api_client.call_api(resource_path, '{{httpMethod}}', return self.api_client.call_api(resource_path, '{{httpMethod}}',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -159,7 +194,7 @@ class {{classname}}(object):
files=local_var_files, files=local_var_files,
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}},
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
{{/operation}} {{/operation}}
{{/operations}} {{/operations}}

View File

@ -103,7 +103,7 @@ class ApiClient(object):
def __call_api(self, resource_path, method, def __call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None, path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None, body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None): response_type=None, auth_settings=None, callback=None, _return_http_data_only=None):
# headers parameters # headers parameters
header_params = header_params or {} header_params = header_params or {}
@ -157,9 +157,12 @@ class ApiClient(object):
deserialized_data = None deserialized_data = None
if callback: if callback:
callback(deserialized_data) callback(deserialized_data) if _return_http_data_only else callback((deserialized_data, response_data.status, response_data.getheaders()))
elif _return_http_data_only:
return ( deserialized_data );
else: else:
return deserialized_data return (deserialized_data, response_data.status, response_data.getheaders())
def to_path_value(self, obj): def to_path_value(self, obj):
""" """
@ -287,7 +290,7 @@ class ApiClient(object):
def call_api(self, resource_path, method, def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None, path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None, body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None): response_type=None, auth_settings=None, callback=None, _return_http_data_only=None):
""" """
Makes the HTTP request (synchronous) and return the deserialized data. Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, define a function for callback. To make an async request, define a function for callback.
@ -308,6 +311,7 @@ class ApiClient(object):
:param callback function: Callback function for asynchronous request. :param callback function: Callback function for asynchronous request.
If provide this parameter, If provide this parameter,
the request will be called asynchronously. the request will be called asynchronously.
:param _return_http_data_only: response data without head status code and headers
:return: :return:
If provide parameter callback, If provide parameter callback,
the request will be called asynchronously. the request will be called asynchronously.
@ -319,7 +323,7 @@ class ApiClient(object):
return self.__call_api(resource_path, method, return self.__call_api(resource_path, method,
path_params, query_params, header_params, path_params, query_params, header_params,
body, post_params, files, body, post_params, files,
response_type, auth_settings, callback) response_type, auth_settings, callback, _return_http_data_only)
else: else:
thread = threading.Thread(target=self.__call_api, thread = threading.Thread(target=self.__call_api,
args=(resource_path, method, args=(resource_path, method,
@ -327,7 +331,7 @@ class ApiClient(object):
header_params, body, header_params, body,
post_params, files, post_params, files,
response_type, auth_settings, response_type, auth_settings,
callback)) callback,_return_http_data_only))
thread.start() thread.start()
return thread return thread

View File

@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://
- API version: 1.0.0 - API version: 1.0.0
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-06-17T00:41:00.422+08:00 - Build date: 2016-06-20T11:55:16.948+08:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen - Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.

View File

@ -103,7 +103,7 @@ class ApiClient(object):
def __call_api(self, resource_path, method, def __call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None, path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None, body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None): response_type=None, auth_settings=None, callback=None, _return_http_data_only=None):
# headers parameters # headers parameters
header_params = header_params or {} header_params = header_params or {}
@ -157,9 +157,12 @@ class ApiClient(object):
deserialized_data = None deserialized_data = None
if callback: if callback:
callback(deserialized_data) callback(deserialized_data) if _return_http_data_only else callback((deserialized_data, response_data.status, response_data.getheaders()))
elif _return_http_data_only:
return ( deserialized_data );
else: else:
return deserialized_data return (deserialized_data, response_data.status, response_data.getheaders())
def to_path_value(self, obj): def to_path_value(self, obj):
""" """
@ -287,7 +290,7 @@ class ApiClient(object):
def call_api(self, resource_path, method, def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None, path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None, body=None, post_params=None, files=None,
response_type=None, auth_settings=None, callback=None): response_type=None, auth_settings=None, callback=None, _return_http_data_only=None):
""" """
Makes the HTTP request (synchronous) and return the deserialized data. Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, define a function for callback. To make an async request, define a function for callback.
@ -308,6 +311,7 @@ class ApiClient(object):
:param callback function: Callback function for asynchronous request. :param callback function: Callback function for asynchronous request.
If provide this parameter, If provide this parameter,
the request will be called asynchronously. the request will be called asynchronously.
:param _return_http_data_only: response data without head status code and headers
:return: :return:
If provide parameter callback, If provide parameter callback,
the request will be called asynchronously. the request will be called asynchronously.
@ -319,7 +323,7 @@ class ApiClient(object):
return self.__call_api(resource_path, method, return self.__call_api(resource_path, method,
path_params, query_params, header_params, path_params, query_params, header_params,
body, post_params, files, body, post_params, files,
response_type, auth_settings, callback) response_type, auth_settings, callback, _return_http_data_only)
else: else:
thread = threading.Thread(target=self.__call_api, thread = threading.Thread(target=self.__call_api,
args=(resource_path, method, args=(resource_path, method,
@ -327,7 +331,7 @@ class ApiClient(object):
header_params, body, header_params, body,
post_params, files, post_params, files,
response_type, auth_settings, response_type, auth_settings,
callback)) callback,_return_http_data_only))
thread.start() thread.start()
return thread return thread

View File

@ -64,6 +64,44 @@ class FakeApi(object):
>>> >>>
>>> thread = api.test_endpoint_parameters(number, double, string, byte, callback=callback_function) >>> thread = api.test_endpoint_parameters(number, double, string, byte, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param float number: None (required)
:param float double: None (required)
:param str string: None (required)
:param str byte: None (required)
:param int integer: None
:param int int32: None
:param int int64: None
:param float float: None
:param str binary: None
:param date date: None
:param datetime date_time: None
:param str password: None
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.test_endpoint_parameters_with_http_info(number, double, string, byte, **kwargs)
else:
(data) = self.test_endpoint_parameters_with_http_info(number, double, string, byte, **kwargs)
return data
def test_endpoint_parameters_with_http_info(self, number, double, string, byte, **kwargs):
"""
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.test_endpoint_parameters_with_http_info(number, double, string, byte, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param float number: None (required) :param float number: None (required)
@ -85,6 +123,7 @@ class FakeApi(object):
all_params = ['number', 'double', 'string', 'byte', 'integer', 'int32', 'int64', 'float', 'binary', 'date', 'date_time', 'password'] all_params = ['number', 'double', 'string', 'byte', 'integer', 'int32', 'int64', 'float', 'binary', 'date', 'date_time', 'password']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -181,7 +220,7 @@ class FakeApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -190,5 +229,5 @@ class FakeApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))

View File

@ -64,6 +64,33 @@ class PetApi(object):
>>> >>>
>>> thread = api.add_pet(body, callback=callback_function) >>> thread = api.add_pet(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.add_pet_with_http_info(body, **kwargs)
else:
(data) = self.add_pet_with_http_info(body, **kwargs)
return data
def add_pet_with_http_info(self, body, **kwargs):
"""
Add a new pet to the store
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.add_pet_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param Pet body: Pet object that needs to be added to the store (required) :param Pet body: Pet object that needs to be added to the store (required)
@ -74,6 +101,7 @@ class PetApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -115,7 +143,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -124,8 +152,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def delete_pet(self, pet_id, **kwargs): def delete_pet(self, pet_id, **kwargs):
""" """
@ -140,6 +168,34 @@ class PetApi(object):
>>> >>>
>>> thread = api.delete_pet(pet_id, callback=callback_function) >>> thread = api.delete_pet(pet_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int pet_id: Pet id to delete (required)
:param str api_key:
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.delete_pet_with_http_info(pet_id, **kwargs)
else:
(data) = self.delete_pet_with_http_info(pet_id, **kwargs)
return data
def delete_pet_with_http_info(self, pet_id, **kwargs):
"""
Deletes a pet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_pet_with_http_info(pet_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param int pet_id: Pet id to delete (required) :param int pet_id: Pet id to delete (required)
@ -151,6 +207,7 @@ class PetApi(object):
all_params = ['pet_id', 'api_key'] all_params = ['pet_id', 'api_key']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -194,7 +251,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'DELETE', return self.api_client.call_api(resource_path, 'DELETE',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -203,8 +260,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def find_pets_by_status(self, status, **kwargs): def find_pets_by_status(self, status, **kwargs):
""" """
@ -219,6 +276,33 @@ class PetApi(object):
>>> >>>
>>> thread = api.find_pets_by_status(status, callback=callback_function) >>> thread = api.find_pets_by_status(status, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param list[str] status: Status values that need to be considered for filter (required)
:return: list[Pet]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.find_pets_by_status_with_http_info(status, **kwargs)
else:
(data) = self.find_pets_by_status_with_http_info(status, **kwargs)
return data
def find_pets_by_status_with_http_info(self, status, **kwargs):
"""
Finds Pets by status
Multiple status values can be provided with comma separated strings
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.find_pets_by_status_with_http_info(status, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param list[str] status: Status values that need to be considered for filter (required) :param list[str] status: Status values that need to be considered for filter (required)
@ -229,6 +313,7 @@ class PetApi(object):
all_params = ['status'] all_params = ['status']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -270,7 +355,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -279,8 +364,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type='list[Pet]', response_type='list[Pet]',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def find_pets_by_tags(self, tags, **kwargs): def find_pets_by_tags(self, tags, **kwargs):
""" """
@ -295,6 +380,33 @@ class PetApi(object):
>>> >>>
>>> thread = api.find_pets_by_tags(tags, callback=callback_function) >>> thread = api.find_pets_by_tags(tags, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param list[str] tags: Tags to filter by (required)
:return: list[Pet]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.find_pets_by_tags_with_http_info(tags, **kwargs)
else:
(data) = self.find_pets_by_tags_with_http_info(tags, **kwargs)
return data
def find_pets_by_tags_with_http_info(self, tags, **kwargs):
"""
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.find_pets_by_tags_with_http_info(tags, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param list[str] tags: Tags to filter by (required) :param list[str] tags: Tags to filter by (required)
@ -305,6 +417,7 @@ class PetApi(object):
all_params = ['tags'] all_params = ['tags']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -346,7 +459,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -355,8 +468,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type='list[Pet]', response_type='list[Pet]',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def get_pet_by_id(self, pet_id, **kwargs): def get_pet_by_id(self, pet_id, **kwargs):
""" """
@ -371,6 +484,33 @@ class PetApi(object):
>>> >>>
>>> thread = api.get_pet_by_id(pet_id, callback=callback_function) >>> thread = api.get_pet_by_id(pet_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int pet_id: ID of pet to return (required)
:return: Pet
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_pet_by_id_with_http_info(pet_id, **kwargs)
else:
(data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs)
return data
def get_pet_by_id_with_http_info(self, pet_id, **kwargs):
"""
Find pet by ID
Returns a single pet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_pet_by_id_with_http_info(pet_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param int pet_id: ID of pet to return (required) :param int pet_id: ID of pet to return (required)
@ -381,6 +521,7 @@ class PetApi(object):
all_params = ['pet_id'] all_params = ['pet_id']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -422,7 +563,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['api_key'] auth_settings = ['api_key']
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -431,8 +572,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type='Pet', response_type='Pet',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def update_pet(self, body, **kwargs): def update_pet(self, body, **kwargs):
""" """
@ -447,6 +588,33 @@ class PetApi(object):
>>> >>>
>>> thread = api.update_pet(body, callback=callback_function) >>> thread = api.update_pet(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.update_pet_with_http_info(body, **kwargs)
else:
(data) = self.update_pet_with_http_info(body, **kwargs)
return data
def update_pet_with_http_info(self, body, **kwargs):
"""
Update an existing pet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_pet_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param Pet body: Pet object that needs to be added to the store (required) :param Pet body: Pet object that needs to be added to the store (required)
@ -457,6 +625,7 @@ class PetApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -498,7 +667,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'PUT', return self.api_client.call_api(resource_path, 'PUT',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -507,8 +676,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def update_pet_with_form(self, pet_id, **kwargs): def update_pet_with_form(self, pet_id, **kwargs):
""" """
@ -523,6 +692,35 @@ class PetApi(object):
>>> >>>
>>> thread = api.update_pet_with_form(pet_id, callback=callback_function) >>> thread = api.update_pet_with_form(pet_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int pet_id: ID of pet that needs to be updated (required)
:param str name: Updated name of the pet
:param str status: Updated status of the pet
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.update_pet_with_form_with_http_info(pet_id, **kwargs)
else:
(data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs)
return data
def update_pet_with_form_with_http_info(self, pet_id, **kwargs):
"""
Updates a pet in the store with form data
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_pet_with_form_with_http_info(pet_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param int pet_id: ID of pet that needs to be updated (required) :param int pet_id: ID of pet that needs to be updated (required)
@ -535,6 +733,7 @@ class PetApi(object):
all_params = ['pet_id', 'name', 'status'] all_params = ['pet_id', 'name', 'status']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -580,7 +779,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -589,8 +788,8 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def upload_file(self, pet_id, **kwargs): def upload_file(self, pet_id, **kwargs):
""" """
@ -605,6 +804,35 @@ class PetApi(object):
>>> >>>
>>> thread = api.upload_file(pet_id, callback=callback_function) >>> thread = api.upload_file(pet_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int pet_id: ID of pet to update (required)
:param str additional_metadata: Additional data to pass to server
:param file file: file to upload
:return: ApiResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.upload_file_with_http_info(pet_id, **kwargs)
else:
(data) = self.upload_file_with_http_info(pet_id, **kwargs)
return data
def upload_file_with_http_info(self, pet_id, **kwargs):
"""
uploads an image
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.upload_file_with_http_info(pet_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param int pet_id: ID of pet to update (required) :param int pet_id: ID of pet to update (required)
@ -617,6 +845,7 @@ class PetApi(object):
all_params = ['pet_id', 'additional_metadata', 'file'] all_params = ['pet_id', 'additional_metadata', 'file']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -662,7 +891,7 @@ class PetApi(object):
# Authentication setting # Authentication setting
auth_settings = ['petstore_auth'] auth_settings = ['petstore_auth']
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -671,5 +900,5 @@ class PetApi(object):
files=local_var_files, files=local_var_files,
response_type='ApiResponse', response_type='ApiResponse',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))

View File

@ -64,6 +64,33 @@ class StoreApi(object):
>>> >>>
>>> thread = api.delete_order(order_id, callback=callback_function) >>> thread = api.delete_order(order_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str order_id: ID of the order that needs to be deleted (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.delete_order_with_http_info(order_id, **kwargs)
else:
(data) = self.delete_order_with_http_info(order_id, **kwargs)
return data
def delete_order_with_http_info(self, order_id, **kwargs):
"""
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_order_with_http_info(order_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param str order_id: ID of the order that needs to be deleted (required) :param str order_id: ID of the order that needs to be deleted (required)
@ -74,6 +101,7 @@ class StoreApi(object):
all_params = ['order_id'] all_params = ['order_id']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -117,7 +145,7 @@ class StoreApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'DELETE', return self.api_client.call_api(resource_path, 'DELETE',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -126,8 +154,8 @@ class StoreApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def get_inventory(self, **kwargs): def get_inventory(self, **kwargs):
""" """
@ -142,6 +170,32 @@ class StoreApi(object):
>>> >>>
>>> thread = api.get_inventory(callback=callback_function) >>> thread = api.get_inventory(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:return: dict(str, int)
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_inventory_with_http_info(**kwargs)
else:
(data) = self.get_inventory_with_http_info(**kwargs)
return data
def get_inventory_with_http_info(self, **kwargs):
"""
Returns pet inventories by status
Returns a map of status codes to quantities
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_inventory_with_http_info(callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:return: dict(str, int) :return: dict(str, int)
@ -151,6 +205,7 @@ class StoreApi(object):
all_params = [] all_params = []
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -187,7 +242,7 @@ class StoreApi(object):
# Authentication setting # Authentication setting
auth_settings = ['api_key'] auth_settings = ['api_key']
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -196,8 +251,8 @@ class StoreApi(object):
files=local_var_files, files=local_var_files,
response_type='dict(str, int)', response_type='dict(str, int)',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def get_order_by_id(self, order_id, **kwargs): def get_order_by_id(self, order_id, **kwargs):
""" """
@ -212,6 +267,33 @@ class StoreApi(object):
>>> >>>
>>> thread = api.get_order_by_id(order_id, callback=callback_function) >>> thread = api.get_order_by_id(order_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int order_id: ID of pet that needs to be fetched (required)
:return: Order
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_order_by_id_with_http_info(order_id, **kwargs)
else:
(data) = self.get_order_by_id_with_http_info(order_id, **kwargs)
return data
def get_order_by_id_with_http_info(self, order_id, **kwargs):
"""
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_order_by_id_with_http_info(order_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param int order_id: ID of pet that needs to be fetched (required) :param int order_id: ID of pet that needs to be fetched (required)
@ -222,6 +304,7 @@ class StoreApi(object):
all_params = ['order_id'] all_params = ['order_id']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -267,7 +350,7 @@ class StoreApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -276,8 +359,8 @@ class StoreApi(object):
files=local_var_files, files=local_var_files,
response_type='Order', response_type='Order',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def place_order(self, body, **kwargs): def place_order(self, body, **kwargs):
""" """
@ -292,6 +375,33 @@ class StoreApi(object):
>>> >>>
>>> thread = api.place_order(body, callback=callback_function) >>> thread = api.place_order(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param Order body: order placed for purchasing the pet (required)
:return: Order
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.place_order_with_http_info(body, **kwargs)
else:
(data) = self.place_order_with_http_info(body, **kwargs)
return data
def place_order_with_http_info(self, body, **kwargs):
"""
Place an order for a pet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.place_order_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param Order body: order placed for purchasing the pet (required) :param Order body: order placed for purchasing the pet (required)
@ -302,6 +412,7 @@ class StoreApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -343,7 +454,7 @@ class StoreApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -352,5 +463,5 @@ class StoreApi(object):
files=local_var_files, files=local_var_files,
response_type='Order', response_type='Order',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))

View File

@ -64,6 +64,33 @@ class UserApi(object):
>>> >>>
>>> thread = api.create_user(body, callback=callback_function) >>> thread = api.create_user(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param User body: Created user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.create_user_with_http_info(body, **kwargs)
else:
(data) = self.create_user_with_http_info(body, **kwargs)
return data
def create_user_with_http_info(self, body, **kwargs):
"""
Create user
This can only be done by the logged in user.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_user_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param User body: Created user object (required) :param User body: Created user object (required)
@ -74,6 +101,7 @@ class UserApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -115,7 +143,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -124,8 +152,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def create_users_with_array_input(self, body, **kwargs): def create_users_with_array_input(self, body, **kwargs):
""" """
@ -140,6 +168,33 @@ class UserApi(object):
>>> >>>
>>> thread = api.create_users_with_array_input(body, callback=callback_function) >>> thread = api.create_users_with_array_input(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.create_users_with_array_input_with_http_info(body, **kwargs)
else:
(data) = self.create_users_with_array_input_with_http_info(body, **kwargs)
return data
def create_users_with_array_input_with_http_info(self, body, **kwargs):
"""
Creates list of users with given input array
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_users_with_array_input_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param list[User] body: List of user object (required) :param list[User] body: List of user object (required)
@ -150,6 +205,7 @@ class UserApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -191,7 +247,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -200,8 +256,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def create_users_with_list_input(self, body, **kwargs): def create_users_with_list_input(self, body, **kwargs):
""" """
@ -216,6 +272,33 @@ class UserApi(object):
>>> >>>
>>> thread = api.create_users_with_list_input(body, callback=callback_function) >>> thread = api.create_users_with_list_input(body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.create_users_with_list_input_with_http_info(body, **kwargs)
else:
(data) = self.create_users_with_list_input_with_http_info(body, **kwargs)
return data
def create_users_with_list_input_with_http_info(self, body, **kwargs):
"""
Creates list of users with given input array
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_users_with_list_input_with_http_info(body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param list[User] body: List of user object (required) :param list[User] body: List of user object (required)
@ -226,6 +309,7 @@ class UserApi(object):
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -267,7 +351,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'POST', return self.api_client.call_api(resource_path, 'POST',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -276,8 +360,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def delete_user(self, username, **kwargs): def delete_user(self, username, **kwargs):
""" """
@ -292,6 +376,33 @@ class UserApi(object):
>>> >>>
>>> thread = api.delete_user(username, callback=callback_function) >>> thread = api.delete_user(username, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The name that needs to be deleted (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.delete_user_with_http_info(username, **kwargs)
else:
(data) = self.delete_user_with_http_info(username, **kwargs)
return data
def delete_user_with_http_info(self, username, **kwargs):
"""
Delete user
This can only be done by the logged in user.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_user_with_http_info(username, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param str username: The name that needs to be deleted (required) :param str username: The name that needs to be deleted (required)
@ -302,6 +413,7 @@ class UserApi(object):
all_params = ['username'] all_params = ['username']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -343,7 +455,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'DELETE', return self.api_client.call_api(resource_path, 'DELETE',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -352,8 +464,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def get_user_by_name(self, username, **kwargs): def get_user_by_name(self, username, **kwargs):
""" """
@ -368,6 +480,33 @@ class UserApi(object):
>>> >>>
>>> thread = api.get_user_by_name(username, callback=callback_function) >>> thread = api.get_user_by_name(username, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
:return: User
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.get_user_by_name_with_http_info(username, **kwargs)
else:
(data) = self.get_user_by_name_with_http_info(username, **kwargs)
return data
def get_user_by_name_with_http_info(self, username, **kwargs):
"""
Get user by user name
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_user_by_name_with_http_info(username, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param str username: The name that needs to be fetched. Use user1 for testing. (required) :param str username: The name that needs to be fetched. Use user1 for testing. (required)
@ -378,6 +517,7 @@ class UserApi(object):
all_params = ['username'] all_params = ['username']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -419,7 +559,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -428,8 +568,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type='User', response_type='User',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def login_user(self, username, password, **kwargs): def login_user(self, username, password, **kwargs):
""" """
@ -444,6 +584,34 @@ class UserApi(object):
>>> >>>
>>> thread = api.login_user(username, password, callback=callback_function) >>> thread = api.login_user(username, password, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The user name for login (required)
:param str password: The password for login in clear text (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.login_user_with_http_info(username, password, **kwargs)
else:
(data) = self.login_user_with_http_info(username, password, **kwargs)
return data
def login_user_with_http_info(self, username, password, **kwargs):
"""
Logs user into the system
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.login_user_with_http_info(username, password, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param str username: The user name for login (required) :param str username: The user name for login (required)
@ -455,6 +623,7 @@ class UserApi(object):
all_params = ['username', 'password'] all_params = ['username', 'password']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -501,7 +670,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -510,8 +679,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type='str', response_type='str',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def logout_user(self, **kwargs): def logout_user(self, **kwargs):
""" """
@ -526,6 +695,32 @@ class UserApi(object):
>>> >>>
>>> thread = api.logout_user(callback=callback_function) >>> thread = api.logout_user(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.logout_user_with_http_info(**kwargs)
else:
(data) = self.logout_user_with_http_info(**kwargs)
return data
def logout_user_with_http_info(self, **kwargs):
"""
Logs out current logged in user session
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.logout_user_with_http_info(callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:return: None :return: None
@ -535,6 +730,7 @@ class UserApi(object):
all_params = [] all_params = []
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -571,7 +767,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'GET', return self.api_client.call_api(resource_path, 'GET',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -580,8 +776,8 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))
def update_user(self, username, body, **kwargs): def update_user(self, username, body, **kwargs):
""" """
@ -596,6 +792,34 @@ class UserApi(object):
>>> >>>
>>> thread = api.update_user(username, body, callback=callback_function) >>> thread = api.update_user(username, body, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: name that need to be deleted (required)
:param User body: Updated user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.update_user_with_http_info(username, body, **kwargs)
else:
(data) = self.update_user_with_http_info(username, body, **kwargs)
return data
def update_user_with_http_info(self, username, body, **kwargs):
"""
Updated user
This can only be done by the logged in user.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_user_with_http_info(username, body, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
:param str username: name that need to be deleted (required) :param str username: name that need to be deleted (required)
@ -607,6 +831,7 @@ class UserApi(object):
all_params = ['username', 'body'] all_params = ['username', 'body']
all_params.append('callback') all_params.append('callback')
all_params.append('_return_http_data_only')
params = locals() params = locals()
for key, val in iteritems(params['kwargs']): for key, val in iteritems(params['kwargs']):
@ -653,7 +878,7 @@ class UserApi(object):
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = []
response = self.api_client.call_api(resource_path, 'PUT', return self.api_client.call_api(resource_path, 'PUT',
path_params, path_params,
query_params, query_params,
header_params, header_params,
@ -662,5 +887,5 @@ class UserApi(object):
files=local_var_files, files=local_var_files,
response_type=None, response_type=None,
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback')) callback=params.get('callback'),
return response _return_http_data_only=params.get('_return_http_data_only'))

View File

@ -0,0 +1,120 @@
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Ref: https://github.com/swagger-api/swagger-codegen
"""
from pprint import pformat
from six import iteritems
class Animal(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Animal - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'class_name': 'str'
}
self.attribute_map = {
'class_name': 'className'
}
self._class_name = None
@property
def class_name(self):
"""
Gets the class_name of this Animal.
:return: The class_name of this Animal.
:rtype: str
"""
return self._class_name
@class_name.setter
def class_name(self, class_name):
"""
Sets the class_name of this Animal.
:param class_name: The class_name of this Animal.
:type: str
"""
self._class_name = class_name
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other

View File

@ -0,0 +1,145 @@
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Ref: https://github.com/swagger-api/swagger-codegen
"""
from pprint import pformat
from six import iteritems
class Cat(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Cat - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'class_name': 'str',
'declawed': 'bool'
}
self.attribute_map = {
'class_name': 'className',
'declawed': 'declawed'
}
self._class_name = None
self._declawed = None
@property
def class_name(self):
"""
Gets the class_name of this Cat.
:return: The class_name of this Cat.
:rtype: str
"""
return self._class_name
@class_name.setter
def class_name(self, class_name):
"""
Sets the class_name of this Cat.
:param class_name: The class_name of this Cat.
:type: str
"""
self._class_name = class_name
@property
def declawed(self):
"""
Gets the declawed of this Cat.
:return: The declawed of this Cat.
:rtype: bool
"""
return self._declawed
@declawed.setter
def declawed(self, declawed):
"""
Sets the declawed of this Cat.
:param declawed: The declawed of this Cat.
:type: bool
"""
self._declawed = declawed
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other

View File

@ -0,0 +1,145 @@
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Ref: https://github.com/swagger-api/swagger-codegen
"""
from pprint import pformat
from six import iteritems
class Dog(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Dog - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'class_name': 'str',
'breed': 'str'
}
self.attribute_map = {
'class_name': 'className',
'breed': 'breed'
}
self._class_name = None
self._breed = None
@property
def class_name(self):
"""
Gets the class_name of this Dog.
:return: The class_name of this Dog.
:rtype: str
"""
return self._class_name
@class_name.setter
def class_name(self, class_name):
"""
Sets the class_name of this Dog.
:param class_name: The class_name of this Dog.
:type: str
"""
self._class_name = class_name
@property
def breed(self):
"""
Gets the breed of this Dog.
:return: The breed of this Dog.
:rtype: str
"""
return self._breed
@breed.setter
def breed(self, breed):
"""
Sets the breed of this Dog.
:param breed: The breed of this Dog.
:type: str
"""
self._breed = breed
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other

View File

@ -97,6 +97,45 @@ class PetApiTests(unittest.TestCase):
self.assertIsNotNone(fetched.category) self.assertIsNotNone(fetched.category)
self.assertEqual(self.pet.category.name, fetched.category.name) self.assertEqual(self.pet.category.name, fetched.category.name)
def test_async_add_pet_and_get_pet_by_id(self):
self.pet_api.add_pet(body=self.pet)
def callback_function(data):
#fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id)
self.assertIsNotNone(data)
self.assertEqual(self.pet.id, data.id)
self.assertIsNotNone(data.category)
self.assertEqual(self.pet.category.name, data.category.name)
thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function)
thread.join(10)
if thread.isAlive():
self.fail("Request timeout")
def test_add_pet_and_get_pet_by_id_with_http_info(self):
self.pet_api.add_pet(body=self.pet)
fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id)
self.assertIsNotNone(fetched)
self.assertEqual(self.pet.id, fetched[0].id)
self.assertIsNotNone(fetched[0].category)
self.assertEqual(self.pet.category.name, fetched[0].category.name)
def test_async_add_pet_and_get_pet_by_id_with_http_info(self):
self.pet_api.add_pet(body=self.pet)
def callback_function(data):
#fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id)
self.assertIsNotNone(data)
self.assertEqual(self.pet.id, data[0].id)
self.assertIsNotNone(data[0].category)
self.assertEqual(self.pet.category.name, data[0].category.name)
thread = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id, callback=callback_function)
thread.join(10)
if thread.isAlive():
self.fail("Request timeout")
def test_update_pet(self): def test_update_pet(self):
self.pet.name = "hello kity with updated" self.pet.name = "hello kity with updated"
self.pet_api.update_pet(body=self.pet) self.pet_api.update_pet(body=self.pet)