update python sample after rebase

This commit is contained in:
wing328
2016-04-08 23:54:47 +08:00
parent f44e5faf1b
commit 10de0b5c5b
8 changed files with 1069 additions and 574 deletions

File diff suppressed because one or more lines are too long

View File

@@ -251,3 +251,10 @@ Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/li
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))

View File

@@ -1,7 +1,10 @@
from __future__ import absolute_import
# import models into sdk package
from .models.animal import Animal
from .models.cat import Cat
from .models.category import Category
from .models.dog import Dog
from .models.inline_response_200 import InlineResponse200
from .models.model_200_response import Model200Response
from .models.model_return import ModelReturn

View File

@@ -2,7 +2,7 @@
"""
PetApi.py
Copyright 2015 SmartBear Software
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.
@@ -45,107 +45,6 @@ class PetApi(object):
config.api_client = ApiClient()
self.api_client = config.api_client
def update_pet(self, **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(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
:return: None
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.update_pet_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs)
return data
def update_pet_with_http_info(self, **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(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
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_pet" % key
)
params[key] = val
del params['kwargs']
resource_path = '/pet'.replace('{format}', 'json')
method = 'PUT'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json', 'application/xml'])
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def add_pet(self, **kwargs):
"""
Add a new pet to the store
@@ -208,16 +107,14 @@ class PetApi(object):
resource_path = '/pet'.replace('{format}', 'json')
method = 'POST'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
@@ -236,13 +133,218 @@ class PetApi(object):
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def add_pet_using_byte_array(self, **kwargs):
"""
Fake endpoint to test byte array in body parameter for adding 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_using_byte_array(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str body: Pet object in the form of byte array
:return: None
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.add_pet_using_byte_array_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.add_pet_using_byte_array_with_http_info(**kwargs)
return data
def add_pet_using_byte_array_with_http_info(self, **kwargs):
"""
Fake endpoint to test byte array in body parameter for adding 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_using_byte_array_with_http_info(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str body: Pet object in the form of byte array
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method add_pet_using_byte_array" % key
)
params[key] = val
del params['kwargs']
resource_path = '/pet?testing_byte_array=true'.replace('{format}', 'json')
path_params = {}
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json', 'application/xml'])
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def delete_pet(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(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.
"""
if kwargs.get('callback'):
return self.delete_pet_with_http_info(pet_id, **kwargs)
else:
(data, status_code, response_headers) = 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
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.
"""
all_params = ['pet_id', 'api_key']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_pet" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
query_params = {}
header_params = {}
if 'api_key' in params:
header_params['api_key'] = params['api_key']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -250,7 +352,7 @@ class PetApi(object):
def find_pets_by_status(self, **kwargs):
"""
Finds Pets by status
Multiple status values can be provided with comma seperated strings
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
@@ -262,7 +364,7 @@ class PetApi(object):
:param callback function: The callback function
for asynchronous request. (optional)
:param list[str] status: Status values that need to be considered for filter
:param list[str] status: Status values that need to be considered for query
:return: list[Pet]
If the method is called asynchronously,
returns the request thread.
@@ -276,7 +378,7 @@ class PetApi(object):
def find_pets_by_status_with_http_info(self, **kwargs):
"""
Finds Pets by status
Multiple status values can be provided with comma seperated strings
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
@@ -288,7 +390,7 @@ class PetApi(object):
:param callback function: The callback function
for asynchronous request. (optional)
:param list[str] status: Status values that need to be considered for filter
:param list[str] status: Status values that need to be considered for query
:return: list[Pet]
If the method is called asynchronously,
returns the request thread.
@@ -309,8 +411,6 @@ class PetApi(object):
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
method = 'GET'
path_params = {}
query_params = {}
@@ -319,8 +419,8 @@ class PetApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -337,13 +437,13 @@ class PetApi(object):
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='list[Pet]',
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -410,8 +510,6 @@ class PetApi(object):
resource_path = '/pet/findByTags'.replace('{format}', 'json')
method = 'GET'
path_params = {}
query_params = {}
@@ -420,8 +518,8 @@ class PetApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -438,13 +536,13 @@ class PetApi(object):
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='list[Pet]',
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -514,8 +612,6 @@ class PetApi(object):
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
@@ -524,8 +620,8 @@ class PetApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -540,19 +636,322 @@ class PetApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = ['api_key']
auth_settings = ['api_key', 'petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='Pet',
auth_settings=auth_settings,
callback=params.get('callback'))
def get_pet_by_id_in_object(self, pet_id, **kwargs):
"""
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
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_in_object(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 fetched (required)
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs)
else:
(data, status_code, response_headers) = self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs)
return data
def get_pet_by_id_in_object_with_http_info(self, pet_id, **kwargs):
"""
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
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_in_object_with_http_info(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 fetched (required)
:return: InlineResponse200
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['pet_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_pet_by_id_in_object" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id_in_object`")
resource_path = '/pet/{petId}?response=inline_arbitrary_object'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = ['api_key', 'petstore_auth']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse200',
auth_settings=auth_settings,
callback=params.get('callback'))
def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs):
"""
Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
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.pet_pet_idtesting_byte_arraytrue_get(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 fetched (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs)
else:
(data, status_code, response_headers) = self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs)
return data
def pet_pet_idtesting_byte_arraytrue_get_with_http_info(self, pet_id, **kwargs):
"""
Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
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.pet_pet_idtesting_byte_arraytrue_get_with_http_info(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 fetched (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['pet_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method pet_pet_idtesting_byte_arraytrue_get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`")
resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = ['api_key', 'petstore_auth']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str',
auth_settings=auth_settings,
callback=params.get('callback'))
def update_pet(self, **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(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
:return: None
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.update_pet_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs)
return data
def update_pet_with_http_info(self, **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(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
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_pet" % key
)
params[key] = val
del params['kwargs']
resource_path = '/pet'.replace('{format}', 'json')
path_params = {}
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json', 'application/xml'])
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def update_pet_with_form(self, pet_id, **kwargs):
"""
Updates a pet in the store with form data
@@ -622,8 +1021,6 @@ class PetApi(object):
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'POST'
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
@@ -632,12 +1029,12 @@ class PetApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
if 'name' in params:
form_params['name'] = params['name']
form_params.append(('name', params['name']))
if 'status' in params:
form_params['status'] = params['status']
form_params.append(('status', params['status']))
body_params = None
@@ -654,121 +1051,13 @@ class PetApi(object):
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def delete_pet(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(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.
"""
if kwargs.get('callback'):
return self.delete_pet_with_http_info(pet_id, **kwargs)
else:
(data, status_code, response_headers) = 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
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.
"""
all_params = ['pet_id', 'api_key']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_pet" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'DELETE'
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
query_params = {}
header_params = {}
if 'api_key' in params:
header_params['api_key'] = params['api_key']
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -842,8 +1131,6 @@ class PetApi(object):
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
method = 'POST'
path_params = {}
if 'pet_id' in params:
path_params['petId'] = params['pet_id']
@@ -852,12 +1139,12 @@ class PetApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
if 'additional_metadata' in params:
form_params['additionalMetadata'] = params['additional_metadata']
form_params.append(('additionalMetadata', params['additional_metadata']))
if 'file' in params:
files['file'] = params['file']
local_var_files['file'] = params['file']
body_params = None
@@ -874,13 +1161,13 @@ class PetApi(object):
# Authentication setting
auth_settings = ['petstore_auth']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))

View File

@@ -2,7 +2,7 @@
"""
StoreApi.py
Copyright 2015 SmartBear Software
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.
@@ -45,6 +45,207 @@ class StoreApi(object):
config.api_client = ApiClient()
self.api_client = config.api_client
def delete_order(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(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.
"""
if kwargs.get('callback'):
return self.delete_order_with_http_info(order_id, **kwargs)
else:
(data, status_code, response_headers) = 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
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.
"""
all_params = ['order_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_order" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
path_params = {}
if 'order_id' in params:
path_params['orderId'] = params['order_id']
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def find_orders_by_status(self, **kwargs):
"""
Finds orders by status
A single status value can be provided as a string
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_orders_by_status(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str status: Status value that needs to be considered for query
:return: list[Order]
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.find_orders_by_status_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.find_orders_by_status_with_http_info(**kwargs)
return data
def find_orders_by_status_with_http_info(self, **kwargs):
"""
Finds orders by status
A single status value can be provided as a string
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_orders_by_status_with_http_info(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str status: Status value that needs to be considered for query
:return: list[Order]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['status']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method find_orders_by_status" % key
)
params[key] = val
del params['kwargs']
resource_path = '/store/findByStatus'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'status' in params:
query_params['status'] = params['status']
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = ['test_api_client_id', 'test_api_client_secret']
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[Order]',
auth_settings=auth_settings,
callback=params.get('callback'))
def get_inventory(self, **kwargs):
"""
Returns pet inventories by status
@@ -105,16 +306,14 @@ class StoreApi(object):
resource_path = '/store/inventory'.replace('{format}', 'json')
method = 'GET'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -131,21 +330,21 @@ class StoreApi(object):
# Authentication setting
auth_settings = ['api_key']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='dict(str, int)',
auth_settings=auth_settings,
callback=params.get('callback'))
def place_order(self, **kwargs):
def get_inventory_in_object(self, **kwargs):
"""
Place an order for a pet
Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually 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
@@ -153,25 +352,24 @@ class StoreApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.place_order(callback=callback_function)
>>> thread = api.get_inventory_in_object(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param Order body: order placed for purchasing the pet
:return: Order
:return: object
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.place_order_with_http_info(**kwargs)
return self.get_inventory_in_object_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.place_order_with_http_info(**kwargs)
(data, status_code, response_headers) = self.get_inventory_in_object_with_http_info(**kwargs)
return data
def place_order_with_http_info(self, **kwargs):
def get_inventory_in_object_with_http_info(self, **kwargs):
"""
Place an order for a pet
Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually 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
@@ -179,17 +377,16 @@ class StoreApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.place_order_with_http_info(callback=callback_function)
>>> thread = api.get_inventory_in_object_with_http_info(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param Order body: order placed for purchasing the pet
:return: Order
:return: object
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body']
all_params = []
all_params.append('callback')
params = locals()
@@ -197,27 +394,23 @@ class StoreApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method place_order" % key
" to method get_inventory_in_object" % key
)
params[key] = val
del params['kwargs']
resource_path = '/store/order'.replace('{format}', 'json')
method = 'POST'
resource_path = '/store/inventory?response=arbitrary_object'.replace('{format}', 'json')
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
@@ -230,16 +423,16 @@ class StoreApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = []
auth_settings = ['api_key']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Order',
files=local_var_files,
response_type='object',
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -308,8 +501,6 @@ class StoreApi(object):
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'order_id' in params:
path_params['orderId'] = params['order_id']
@@ -318,8 +509,8 @@ class StoreApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -334,23 +525,23 @@ class StoreApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = []
auth_settings = ['test_api_key_header', 'test_api_key_query']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='Order',
auth_settings=auth_settings,
callback=params.get('callback'))
def delete_order(self, order_id, **kwargs):
def place_order(self, **kwargs):
"""
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
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
@@ -358,25 +549,25 @@ class StoreApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_order(order_id, callback=callback_function)
>>> thread = api.place_order(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
:param Order body: order placed for purchasing the pet
:return: Order
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.delete_order_with_http_info(order_id, **kwargs)
return self.place_order_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.delete_order_with_http_info(order_id, **kwargs)
(data, status_code, response_headers) = self.place_order_with_http_info(**kwargs)
return data
def delete_order_with_http_info(self, order_id, **kwargs):
def place_order_with_http_info(self, **kwargs):
"""
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
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
@@ -384,17 +575,17 @@ class StoreApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_order_with_http_info(order_id, callback=callback_function)
>>> thread = api.place_order_with_http_info(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
:param Order body: order placed for purchasing the pet
:return: Order
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['order_id']
all_params = ['body']
all_params.append('callback')
params = locals()
@@ -402,30 +593,25 @@ class StoreApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_order" % key
" to method place_order" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
method = 'DELETE'
resource_path = '/store/order'.replace('{format}', 'json')
path_params = {}
if 'order_id' in params:
path_params['orderId'] = params['order_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
@@ -438,15 +624,15 @@ class StoreApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = []
auth_settings = ['test_api_client_id', 'test_api_client_secret']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type=None,
files=local_var_files,
response_type='Order',
auth_settings=auth_settings,
callback=params.get('callback'))

View File

@@ -2,7 +2,7 @@
"""
UserApi.py
Copyright 2015 SmartBear Software
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.
@@ -107,16 +107,14 @@ class UserApi(object):
resource_path = '/user'.replace('{format}', 'json')
method = 'POST'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
@@ -135,13 +133,13 @@ class UserApi(object):
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -208,16 +206,14 @@ class UserApi(object):
resource_path = '/user/createWithArray'.replace('{format}', 'json')
method = 'POST'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
@@ -236,13 +232,13 @@ class UserApi(object):
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -309,16 +305,14 @@ class UserApi(object):
resource_path = '/user/createWithList'.replace('{format}', 'json')
method = 'POST'
path_params = {}
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
@@ -337,21 +331,21 @@ class UserApi(object):
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def login_user(self, **kwargs):
def delete_user(self, username, **kwargs):
"""
Logs user into the system
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
@@ -359,26 +353,25 @@ class UserApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.login_user(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 user name for login
:param str password: The password for login in clear text
:return: str
:param str username: The name that needs to be deleted (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.login_user_with_http_info(**kwargs)
return self.delete_user_with_http_info(username, **kwargs)
else:
(data, status_code, response_headers) = self.login_user_with_http_info(**kwargs)
(data, status_code, response_headers) = self.delete_user_with_http_info(username, **kwargs)
return data
def login_user_with_http_info(self, **kwargs):
def delete_user_with_http_info(self, username, **kwargs):
"""
Logs user into the system
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
@@ -386,18 +379,17 @@ class UserApi(object):
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.login_user_with_http_info(callback=callback_function)
>>> thread = api.delete_user_with_http_info(username, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The user name for login
:param str password: The password for login in clear text
:return: str
:param str username: The name that needs to be deleted (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['username', 'password']
all_params = ['username']
all_params.append('callback')
params = locals()
@@ -405,124 +397,26 @@ class UserApi(object):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method login_user" % key
" to method delete_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'username' is set
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
resource_path = '/user/login'.replace('{format}', 'json')
method = 'GET'
resource_path = '/user/{username}'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'username' in params:
query_params['username'] = params['username']
if 'password' in params:
query_params['password'] = params['password']
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='str',
auth_settings=auth_settings,
callback=params.get('callback'))
def logout_user(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(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.
"""
if kwargs.get('callback'):
return self.logout_user_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = 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
for asynchronous request. (optional)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method logout_user" % key
)
params[key] = val
del params['kwargs']
resource_path = '/user/logout'.replace('{format}', 'json')
method = 'GET'
path_params = {}
path_params['username'] = params['username']
query_params = {}
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -537,15 +431,15 @@ class UserApi(object):
select_header_content_type([])
# Authentication setting
auth_settings = []
auth_settings = ['test_http_basic']
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
@@ -615,8 +509,6 @@ class UserApi(object):
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'username' in params:
path_params['username'] = params['username']
@@ -625,8 +517,8 @@ class UserApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
@@ -643,17 +535,215 @@ class UserApi(object):
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type='User',
auth_settings=auth_settings,
callback=params.get('callback'))
def login_user(self, **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(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The user name for login
:param str password: The password for login in clear text
:return: str
If the method is called asynchronously,
returns the request thread.
"""
if kwargs.get('callback'):
return self.login_user_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = self.login_user_with_http_info(**kwargs)
return data
def login_user_with_http_info(self, **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(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str username: The user name for login
:param str password: The password for login in clear text
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['username', 'password']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method login_user" % key
)
params[key] = val
del params['kwargs']
resource_path = '/user/login'.replace('{format}', 'json')
path_params = {}
query_params = {}
if 'username' in params:
query_params['username'] = params['username']
if 'password' in params:
query_params['password'] = params['password']
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str',
auth_settings=auth_settings,
callback=params.get('callback'))
def logout_user(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(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.
"""
if kwargs.get('callback'):
return self.logout_user_with_http_info(**kwargs)
else:
(data, status_code, response_headers) = 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
for asynchronous request. (optional)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = []
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method logout_user" % key
)
params[key] = val
del params['kwargs']
resource_path = '/user/logout'.replace('{format}', 'json')
path_params = {}
query_params = {}
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def update_user(self, username, **kwargs):
"""
Updated user
@@ -721,8 +811,6 @@ class UserApi(object):
raise ValueError("Missing the required parameter `username` when calling `update_user`")
resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'PUT'
path_params = {}
if 'username' in params:
path_params['username'] = params['username']
@@ -731,8 +819,8 @@ class UserApi(object):
header_params = {}
form_params = {}
files = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
@@ -751,117 +839,13 @@ class UserApi(object):
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
return self.api_client.call_api(resource_path, 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
def delete_user(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(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.
"""
if kwargs.get('callback'):
return self.delete_user_with_http_info(username, **kwargs)
else:
(data, status_code, response_headers) = 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
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.
"""
all_params = ['username']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'username' is set
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'DELETE'
path_params = {}
if 'username' in params:
path_params['username'] = params['username']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json', 'application/xml'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
return self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))

View File

@@ -1,7 +1,10 @@
from __future__ import absolute_import
# import models into model package
from .animal import Animal
from .cat import Cat
from .category import Category
from .dog import Dog
from .inline_response_200 import InlineResponse200
from .model_200_response import Model200Response
from .model_return import ModelReturn

View File

@@ -37,14 +37,17 @@ class Name(object):
and the value is json key in definition.
"""
self.swagger_types = {
'name': 'int'
'name': 'int',
'snake_case': 'int'
}
self.attribute_map = {
'name': 'name'
'name': 'name',
'snake_case': 'snake_case'
}
self._name = None
self._snake_case = None
@property
def name(self):
@@ -68,6 +71,28 @@ class Name(object):
"""
self._name = name
@property
def snake_case(self):
"""
Gets the snake_case of this Name.
:return: The snake_case of this Name.
:rtype: int
"""
return self._snake_case
@snake_case.setter
def snake_case(self, snake_case):
"""
Sets the snake_case of this Name.
:param snake_case: The snake_case of this Name.
:type: int
"""
self._snake_case = snake_case
def to_dict(self):
"""
Returns the model properties as a dict