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

This commit is contained in:
William Cheng
2020-02-04 15:31:10 +08:00
1179 changed files with 58478 additions and 9334 deletions

View File

@@ -54,17 +54,19 @@ from pprint import pprint
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
body = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.AnotherFakeApi(api_client)
body = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
## Documentation for API Endpoints

View File

@@ -23,16 +23,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.AnotherFakeApi()
body = petstore_api.Client() # Client | client model
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.AnotherFakeApi(api_client)
body = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
### Parameters

View File

@@ -36,15 +36,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body
try:
# creates an XmlItem
api_instance.create_xml_item(xml_item)
except ApiException as e:
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
try:
# creates an XmlItem
api_instance.create_xml_item(xml_item)
except ApiException as e:
print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
```
### Parameters
@@ -89,15 +91,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = True # bool | Input boolean as post body (optional)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
try:
api_response = api_instance.fake_outer_boolean_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
try:
api_response = api_instance.fake_outer_boolean_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e)
```
### Parameters
@@ -142,15 +146,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
try:
api_response = api_instance.fake_outer_composite_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
try:
api_response = api_instance.fake_outer_composite_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
```
### Parameters
@@ -195,15 +201,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = 3.4 # float | Input number as post body (optional)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = 3.4 # float | Input number as post body (optional)
try:
api_response = api_instance.fake_outer_number_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
try:
api_response = api_instance.fake_outer_number_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e)
```
### Parameters
@@ -248,15 +256,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = 'body_example' # str | Input string as post body (optional)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = 'body_example' # str | Input string as post body (optional)
try:
api_response = api_instance.fake_outer_string_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
try:
api_response = api_instance.fake_outer_string_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e)
```
### Parameters
@@ -301,14 +311,16 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
try:
api_instance.test_body_with_file_schema(body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
try:
api_instance.test_body_with_file_schema(body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
```
### Parameters
@@ -351,15 +363,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
query = 'query_example' # str |
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
query = 'query_example' # str |
body = petstore_api.User() # User |
try:
api_instance.test_body_with_query_params(query, body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
try:
api_instance.test_body_with_query_params(query, body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
```
### Parameters
@@ -405,16 +419,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = petstore_api.Client() # Client | client model
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
body = petstore_api.Client() # Client | client model
try:
# To test \"client\" model
api_response = api_instance.test_client_model(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
try:
# To test \"client\" model
api_response = api_instance.test_client_model(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
```
### Parameters
@@ -466,9 +482,11 @@ configuration.password = 'YOUR_PASSWORD'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
number = 3.4 # float | None
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
number = 3.4 # float | None
double = 3.4 # float | None
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
byte = 'byte_example' # str | None
@@ -483,11 +501,11 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
password = 'password_example' # str | None (optional)
param_callback = 'param_callback_example' # str | None (optional)
try:
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
except ApiException as e:
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
try:
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
except ApiException as e:
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
```
### Parameters
@@ -546,9 +564,11 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional)
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg')
enum_query_string_array = ['enum_query_string_array_example'] # list[str] | Query parameter enum test (string array) (optional)
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) (default to '-efg')
@@ -557,11 +577,11 @@ enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
enum_form_string_array = '$' # list[str] | Form parameter enum test (string array) (optional) (default to '$')
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to '-efg')
try:
# To test enum parameters
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
except ApiException as e:
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
try:
# To test enum parameters
api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
except ApiException as e:
print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
```
### Parameters
@@ -614,20 +634,22 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
required_string_group = 56 # int | Required String in group parameters
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
required_string_group = 56 # int | Required String in group parameters
required_boolean_group = True # bool | Required Boolean in group parameters
required_int64_group = 56 # int | Required Integer in group parameters
string_group = 56 # int | String in group parameters (optional)
boolean_group = True # bool | Boolean in group parameters (optional)
int64_group = 56 # int | Integer in group parameters (optional)
try:
# Fake endpoint to test group parameters (optional)
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
except ApiException as e:
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
try:
# Fake endpoint to test group parameters (optional)
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
except ApiException as e:
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
```
### Parameters
@@ -675,15 +697,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
param = {'key': 'param_example'} # dict(str, str) | request body
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
param = {'key': 'param_example'} # dict(str, str) | request body
try:
# test inline additionalProperties
api_instance.test_inline_additional_properties(param)
except ApiException as e:
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
try:
# test inline additionalProperties
api_instance.test_inline_additional_properties(param)
except ApiException as e:
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
```
### Parameters
@@ -726,16 +750,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
param = 'param_example' # str | field1
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
param = 'param_example' # str | field1
param2 = 'param2_example' # str | field2
try:
# test json serialization of form data
api_instance.test_json_form_data(param, param2)
except ApiException as e:
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
try:
# test json serialization of form data
api_instance.test_json_form_data(param, param2)
except ApiException as e:
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
```
### Parameters
@@ -781,18 +807,20 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
pipe = ['pipe_example'] # list[str] |
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
pipe = ['pipe_example'] # list[str] |
ioutil = ['ioutil_example'] # list[str] |
http = ['http_example'] # list[str] |
url = ['url_example'] # list[str] |
context = ['context_example'] # list[str] |
try:
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
except ApiException as e:
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
try:
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
except ApiException as e:
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
```
### Parameters

View File

@@ -31,16 +31,18 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
body = petstore_api.Client() # Client | client model
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
body = petstore_api.Client() # Client | client model
try:
# To test class name in snake case
api_response = api_instance.test_classname(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
try:
# To test class name in snake case
api_response = api_instance.test_classname(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
```
### Parameters

View File

@@ -35,15 +35,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Add a new pet to the store
api_instance.add_pet(body)
except ApiException as e:
print("Exception when calling PetApi->add_pet: %s\n" % e)
try:
# Add a new pet to the store
api_instance.add_pet(body)
except ApiException as e:
print("Exception when calling PetApi->add_pet: %s\n" % e)
```
### Parameters
@@ -93,16 +95,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 56 # int | Pet id to delete
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
pet_id = 56 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
try:
# Deletes a pet
api_instance.delete_pet(pet_id, api_key=api_key)
except ApiException as e:
print("Exception when calling PetApi->delete_pet: %s\n" % e)
try:
# Deletes a pet
api_instance.delete_pet(pet_id, api_key=api_key)
except ApiException as e:
print("Exception when calling PetApi->delete_pet: %s\n" % e)
```
### Parameters
@@ -155,16 +159,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
status = ['status_example'] # list[str] | Status values that need to be considered for filter
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
status = ['status_example'] # list[str] | Status values that need to be considered for filter
try:
# Finds Pets by status
api_response = api_instance.find_pets_by_status(status)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
try:
# Finds Pets by status
api_response = api_instance.find_pets_by_status(status)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
```
### Parameters
@@ -216,16 +222,18 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
tags = ['tags_example'] # list[str] | Tags to filter by
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
tags = ['tags_example'] # list[str] | Tags to filter by
try:
# Finds Pets by tags
api_response = api_instance.find_pets_by_tags(tags)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
try:
# Finds Pets by tags
api_response = api_instance.find_pets_by_tags(tags)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
```
### Parameters
@@ -279,16 +287,18 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 56 # int | ID of pet to return
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to return
try:
# Find pet by ID
api_response = api_instance.get_pet_by_id(pet_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
try:
# Find pet by ID
api_response = api_instance.get_pet_by_id(pet_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
```
### Parameters
@@ -339,15 +349,17 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Update an existing pet
api_instance.update_pet(body)
except ApiException as e:
print("Exception when calling PetApi->update_pet: %s\n" % e)
try:
# Update an existing pet
api_instance.update_pet(body)
except ApiException as e:
print("Exception when calling PetApi->update_pet: %s\n" % e)
```
### Parameters
@@ -399,17 +411,19 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 56 # int | ID of pet that needs to be updated
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
pet_id = 56 # int | ID of pet that needs to be updated
name = 'name_example' # str | Updated name of the pet (optional)
status = 'status_example' # str | Updated status of the pet (optional)
try:
# Updates a pet in the store with form data
api_instance.update_pet_with_form(pet_id, name=name, status=status)
except ApiException as e:
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
try:
# Updates a pet in the store with form data
api_instance.update_pet_with_form(pet_id, name=name, status=status)
except ApiException as e:
print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
```
### Parameters
@@ -460,18 +474,20 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 56 # int | ID of pet to update
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to update
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
file = '/path/to/file' # file | file to upload (optional)
try:
# uploads an image
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->upload_file: %s\n" % e)
try:
# uploads an image
api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->upload_file: %s\n" % e)
```
### Parameters
@@ -522,18 +538,20 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet_id = 56 # int | ID of pet to update
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to update
required_file = '/path/to/file' # file | file to upload
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
try:
# uploads an image (required)
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
try:
# uploads an image (required)
api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
```
### Parameters

View File

@@ -26,15 +26,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.StoreApi()
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.StoreApi(api_client)
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
try:
# Delete purchase order by ID
api_instance.delete_order(order_id)
except ApiException as e:
print("Exception when calling StoreApi->delete_order: %s\n" % e)
try:
# Delete purchase order by ID
api_instance.delete_order(order_id)
except ApiException as e:
print("Exception when calling StoreApi->delete_order: %s\n" % e)
```
### Parameters
@@ -88,15 +90,17 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Defining host is optional and default to http://petstore.swagger.io:80/v2
configuration.host = "http://petstore.swagger.io:80/v2"
# Create an instance of the API class
api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration))
try:
# Returns pet inventories by status
api_response = api_instance.get_inventory()
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.StoreApi(api_client)
try:
# Returns pet inventories by status
api_response = api_instance.get_inventory()
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->get_inventory: %s\n" % e)
```
### Parameters
@@ -138,16 +142,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.StoreApi()
order_id = 56 # int | ID of pet that needs to be fetched
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.StoreApi(api_client)
order_id = 56 # int | ID of pet that needs to be fetched
try:
# Find purchase order by ID
api_response = api_instance.get_order_by_id(order_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
try:
# Find purchase order by ID
api_response = api_instance.get_order_by_id(order_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
```
### Parameters
@@ -192,16 +198,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.StoreApi()
body = petstore_api.Order() # Order | order placed for purchasing the pet
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.StoreApi(api_client)
body = petstore_api.Order() # Order | order placed for purchasing the pet
try:
# Place an order for a pet
api_response = api_instance.place_order(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->place_order: %s\n" % e)
try:
# Place an order for a pet
api_response = api_instance.place_order(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->place_order: %s\n" % e)
```
### Parameters

View File

@@ -30,15 +30,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
body = petstore_api.User() # User | Created user object
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
body = petstore_api.User() # User | Created user object
try:
# Create user
api_instance.create_user(body)
except ApiException as e:
print("Exception when calling UserApi->create_user: %s\n" % e)
try:
# Create user
api_instance.create_user(body)
except ApiException as e:
print("Exception when calling UserApi->create_user: %s\n" % e)
```
### Parameters
@@ -81,15 +83,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
body = [petstore_api.User()] # list[User] | List of user object
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
body = [petstore_api.User()] # list[User] | List of user object
try:
# Creates list of users with given input array
api_instance.create_users_with_array_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
try:
# Creates list of users with given input array
api_instance.create_users_with_array_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
```
### Parameters
@@ -132,15 +136,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
body = [petstore_api.User()] # list[User] | List of user object
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
body = [petstore_api.User()] # list[User] | List of user object
try:
# Creates list of users with given input array
api_instance.create_users_with_list_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
try:
# Creates list of users with given input array
api_instance.create_users_with_list_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
```
### Parameters
@@ -185,15 +191,17 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The name that needs to be deleted
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
username = 'username_example' # str | The name that needs to be deleted
try:
# Delete user
api_instance.delete_user(username)
except ApiException as e:
print("Exception when calling UserApi->delete_user: %s\n" % e)
try:
# Delete user
api_instance.delete_user(username)
except ApiException as e:
print("Exception when calling UserApi->delete_user: %s\n" % e)
```
### Parameters
@@ -237,16 +245,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
try:
# Get user by user name
api_response = api_instance.get_user_by_name(username)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
try:
# Get user by user name
api_response = api_instance.get_user_by_name(username)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
```
### Parameters
@@ -291,17 +301,19 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The user name for login
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
username = 'username_example' # str | The user name for login
password = 'password_example' # str | The password for login in clear text
try:
# Logs user into the system
api_response = api_instance.login_user(username, password)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->login_user: %s\n" % e)
try:
# Logs user into the system
api_response = api_instance.login_user(username, password)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->login_user: %s\n" % e)
```
### Parameters
@@ -346,14 +358,16 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
try:
# Logs out current logged in user session
api_instance.logout_user()
except ApiException as e:
print("Exception when calling UserApi->logout_user: %s\n" % e)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
try:
# Logs out current logged in user session
api_instance.logout_user()
except ApiException as e:
print("Exception when calling UserApi->logout_user: %s\n" % e)
```
### Parameters
@@ -395,16 +409,18 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | name that need to be deleted
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = petstore_api.UserApi(api_client)
username = 'username_example' # str | name that need to be deleted
body = petstore_api.User() # User | Updated user object
try:
# Updated user
api_instance.update_user(username, body)
except ApiException as e:
print("Exception when calling UserApi->update_user: %s\n" % e)
try:
# Updated user
api_instance.update_user(username, body)
except ApiException as e:
print("Exception when calling UserApi->update_user: %s\n" % e)
```
### Parameters

View File

@@ -10,6 +10,7 @@
from __future__ import absolute_import
import atexit
import datetime
from dateutil.parser import parse
import json
@@ -80,11 +81,19 @@ class ApiClient(object):
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
self.client_side_validation = configuration.client_side_validation
def __del__(self):
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def close(self):
if self._pool:
self._pool.close()
self._pool.join()
self._pool = None
if hasattr(atexit, 'unregister'):
atexit.unregister(self.close)
@property
def pool(self):
@@ -92,6 +101,7 @@ class ApiClient(object):
avoids instantiating unused threadpool for blocking clients.
"""
if self._pool is None:
atexit.register(self.close)
self._pool = ThreadPool(self.pool_threads)
return self._pool

View File

@@ -39,6 +39,7 @@ class Configuration(object):
:Example:
API Key Authentication Example.
Given the following security scheme in the OpenAPI specification:
components:
securitySchemes:
@@ -54,11 +55,26 @@ class Configuration(object):
)
The following cookie will be added to the HTTP request:
Cookie: JSESSIONID abc123
HTTP Basic Authentication Example.
Given the following security scheme in the OpenAPI specification:
components:
securitySchemes:
http_basic_auth:
type: http
scheme: basic
Configure API client with HTTP basic authentication:
conf = petstore_api.Configuration(
username='the-user',
password='the-password',
)
"""
def __init__(self, host="http://petstore.swagger.io:80/v2",
api_key=None, api_key_prefix=None,
username=None, password=None):
username=None, password=None,
):
"""Constructor
"""
self.host = host
@@ -87,7 +103,7 @@ class Configuration(object):
self.password = password
"""Password for HTTP basic authentication
"""
self.access_token = ""
self.access_token = None
"""access token for OAuth/Bearer
"""
self.logger = {}