diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 967e1c5d293..5372dea0592 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -280,7 +280,7 @@ class ApiClient(object): _request_timeout=None): """ Makes the HTTP request (synchronous) and return the deserialized data. - To make an async request, define a function for callback. + To make an async request, set the async parameter. :param resource_path: Path to method endpoint. :param method: Method to call. @@ -304,10 +304,10 @@ class ApiClient(object): :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: - If provide parameter callback, + If async parameter is True, the request will be called asynchronously. The method will return the request thread. - If parameter callback is None, + If parameter async is False or missing, then the method will return the response directly. """ if not async: diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index 41c9778087c..512e755c24f 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -6,8 +6,9 @@ from __future__ import absolute_import import urllib3 -import sys import logging +import multiprocessing +import sys from six import iteritems from six.moves import http_client as httplib @@ -66,6 +67,16 @@ class Configuration(object): self.cert_file = None # client key file self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + # Proxy URL self.proxy = None diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index 15c11f0828e..49508f77324 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -47,7 +47,7 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=4): + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 @@ -67,6 +67,16 @@ class RESTClientObject(object): # if not set certificate file, use Mozilla's root certificates. ca_certs = certifi.where() + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = config.assert_hostname + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + # https pool manager if configuration.proxy: self.pool_manager = urllib3.ProxyManager( @@ -76,7 +86,8 @@ class RESTClientObject(object): ca_certs=ca_certs, cert_file=configuration.cert_file, key_file=configuration.key_file, - proxy_url=configuration.proxy + proxy_url=configuration.proxy, + **addition_pool_args ) else: self.pool_manager = urllib3.PoolManager( @@ -85,7 +96,8 @@ class RESTClientObject(object): cert_reqs=cert_reqs, ca_certs=ca_certs, cert_file=configuration.cert_file, - key_file=configuration.key_file + key_file=configuration.key_file, + **addition_pool_args ) def request(self, method, url, query_params=None, headers=None, diff --git a/samples/client/petstore/python-asyncio/.gitignore b/samples/client/petstore/python-asyncio/.gitignore new file mode 100644 index 00000000000..a655050c263 --- /dev/null +++ b/samples/client/petstore/python-asyncio/.gitignore @@ -0,0 +1,64 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/client/petstore/python-asyncio/.swagger-codegen-ignore b/samples/client/petstore/python-asyncio/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/python-asyncio/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION new file mode 100644 index 00000000000..f9f7450d135 --- /dev/null +++ b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/.travis.yml b/samples/client/petstore/python-asyncio/.travis.yml new file mode 100644 index 00000000000..86211e2d4a2 --- /dev/null +++ b/samples/client/petstore/python-asyncio/.travis.yml @@ -0,0 +1,14 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + #- "3.5-dev" # 3.5 development branch + #- "nightly" # points to the latest development branch e.g. 3.6-dev +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: nosetests diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md new file mode 100644 index 00000000000..87f80990fc5 --- /dev/null +++ b/samples/client/petstore/python-asyncio/README.md @@ -0,0 +1,176 @@ +# petstore-api +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.languages.PythonClientCodegen + +## Requirements. + +Python 2.7 and 3.4+ + +## Installation & Usage +### pip install + +If the python package is hosted on Github, you can install directly from Github + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import petstore_api +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import petstore_api +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +from __future__ import print_function +import time +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 + +try: + # To test special tags + api_response = api_instance.test_special_tags(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user +*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system +*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Capitalization](docs/Capitalization.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterBoolean](docs/OuterBoolean.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterNumber](docs/OuterNumber.md) + - [OuterString](docs/OuterString.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + - [Cat](docs/Cat.md) + - [Dog](docs/Dog.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## http_basic_test + +- **Type**: HTTP basic authentication + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + +apiteam@swagger.io + diff --git a/samples/client/petstore/python-asyncio/docs/AdditionalPropertiesClass.md b/samples/client/petstore/python-asyncio/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..ea12f270f02 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_property** | **dict(str, str)** | | [optional] +**map_of_map_property** | [**dict(str, dict(str, str))**](dict.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Animal.md b/samples/client/petstore/python-asyncio/docs/Animal.md new file mode 100644 index 00000000000..7ed4ba541fa --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/AnimalFarm.md b/samples/client/petstore/python-asyncio/docs/AnimalFarm.md new file mode 100644 index 00000000000..df6bab21dae --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..b78fcf86f43 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# petstore_api.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags + + +# **test_special_tags** +> Client test_special_tags(body) + +To test special tags + +To test special tags + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # To test special tags + api_response = api_instance.test_special_tags(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/docs/ApiResponse.md b/samples/client/petstore/python-asyncio/docs/ApiResponse.md new file mode 100644 index 00000000000..8fc302305ab --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **str** | | [optional] +**message** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/python-asyncio/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..aa3988ab167 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_array_number** | **list[list[float]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/ArrayOfNumberOnly.md b/samples/client/petstore/python-asyncio/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..2c3de967aec --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_number** | **list[float]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/ArrayTest.md b/samples/client/petstore/python-asyncio/docs/ArrayTest.md new file mode 100644 index 00000000000..6ab0d137806 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_of_string** | **list[str]** | | [optional] +**array_array_of_integer** | **list[list[int]]** | | [optional] +**array_array_of_model** | **list[list[ReadOnlyFirst]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Capitalization.md b/samples/client/petstore/python-asyncio/docs/Capitalization.md new file mode 100644 index 00000000000..85d88d239ee --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**small_camel** | **str** | | [optional] +**capital_camel** | **str** | | [optional] +**small_snake** | **str** | | [optional] +**capital_snake** | **str** | | [optional] +**sca_eth_flow_points** | **str** | | [optional] +**att_name** | **str** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Cat.md b/samples/client/petstore/python-asyncio/docs/Cat.md new file mode 100644 index 00000000000..8d30565d014 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Category.md b/samples/client/petstore/python-asyncio/docs/Category.md new file mode 100644 index 00000000000..7f453539bf8 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/ClassModel.md b/samples/client/petstore/python-asyncio/docs/ClassModel.md new file mode 100644 index 00000000000..7f6f6d17211 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_class** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Client.md b/samples/client/petstore/python-asyncio/docs/Client.md new file mode 100644 index 00000000000..88e99384f92 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Dog.md b/samples/client/petstore/python-asyncio/docs/Dog.md new file mode 100644 index 00000000000..f727487975c --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/EnumArrays.md b/samples/client/petstore/python-asyncio/docs/EnumArrays.md new file mode 100644 index 00000000000..e15a5f1fd04 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_symbol** | **str** | | [optional] +**array_enum** | **list[str]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/EnumClass.md b/samples/client/petstore/python-asyncio/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/EnumTest.md b/samples/client/petstore/python-asyncio/docs/EnumTest.md new file mode 100644 index 00000000000..94dd4864629 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/EnumTest.md @@ -0,0 +1,13 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **str** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **float** | | [optional] +**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md new file mode 100644 index 00000000000..eb669540e53 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -0,0 +1,440 @@ +# petstore_api.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data + + +# **fake_outer_boolean_serialize** +> OuterBoolean fake_outer_boolean_serialize(body=body) + + + +Test serialization of outer boolean types + +### Example +```python +from __future__ import print_function +import time +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.OuterBoolean() # OuterBoolean | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(body=body) + + + +Test serialization of object with outer number type + +### Example +```python +from __future__ import print_function +import time +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) + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> OuterNumber fake_outer_number_serialize(body=body) + + + +Test serialization of outer number types + +### Example +```python +from __future__ import print_function +import time +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.OuterNumber() # OuterNumber | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> OuterString fake_outer_string_serialize(body=body) + + + +Test serialization of outer string types + +### Example +```python +from __future__ import print_function +import time +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.OuterString() # OuterString | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_client_model** +> Client test_client_model(body) + +To test \"client\" model + +To test \"client\" model + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_endpoint_parameters** +> 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) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration() +configuration.username = 'YOUR_USERNAME' +configuration.password = 'YOUR_PASSWORD' + +# create an instance of the API class +api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) +number = 3.4 # float | None +double = 1.2 # float | None +pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None +byte = 'byte_example' # str | None +integer = 56 # int | None (optional) +int32 = 56 # int | None (optional) +int64 = 789 # int | None (optional) +float = 3.4 # float | None (optional) +string = 'string_example' # str | None (optional) +binary = 'B' # str | None (optional) +date = '2013-10-20' # date | None (optional) +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **pattern_without_delimiter** | **str**| None | + **byte** | **str**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **string** | **str**| None | [optional] + **binary** | **str**| None | [optional] + **date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + **param_callback** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_enum_parameters** +> test_enum_parameters(enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string, 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) + +To test enum parameters + +To test enum parameters + +### Example +```python +from __future__ import print_function +import time +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_form_string_array = ['enum_form_string_array_example'] # list[str] | Form parameter enum test (string array) (optional) +enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to -efg) +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) +enum_query_integer = 56 # int | Query parameter enum test (double) (optional) +enum_query_double = 1.2 # float | Query parameter enum test (double) (optional) + +try: + # To test enum parameters + api_instance.test_enum_parameters(enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string, 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) +except ApiException as e: + print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_form_string_array** | [**list[str]**](str.md)| Form parameter enum test (string array) | [optional] + **enum_form_string** | **str**| Form parameter enum test (string) | [optional] [default to -efg] + **enum_header_string_array** | [**list[str]**](str.md)| Header parameter enum test (string array) | [optional] + **enum_header_string** | **str**| Header parameter enum test (string) | [optional] [default to -efg] + **enum_query_string_array** | [**list[str]**](str.md)| Query parameter enum test (string array) | [optional] + **enum_query_string** | **str**| Query parameter enum test (string) | [optional] [default to -efg] + **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] + **enum_query_double** | **float**| Query parameter enum test (double) | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: */* + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_json_form_data** +> test_json_form_data(param, param2) + +test json serialization of form data + + + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **str**| field1 | + **param2** | **str**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..a103a4ee327 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# petstore_api.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **test_classname** +> Client test_classname(body) + +To test class name in snake case + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key_query +configuration = petstore_api.Configuration() +configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key_query'] = 'Bearer' + +# create an instance of the API class +api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration)) +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/docs/FormatTest.md b/samples/client/petstore/python-asyncio/docs/FormatTest.md new file mode 100644 index 00000000000..3e489e863fa --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**string** | **str** | | [optional] +**byte** | **str** | | +**binary** | **str** | | [optional] +**date** | **date** | | +**date_time** | **datetime** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/HasOnlyReadOnly.md b/samples/client/petstore/python-asyncio/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..44ad450b52c --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] +**foo** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/List.md b/samples/client/petstore/python-asyncio/docs/List.md new file mode 100644 index 00000000000..11f4f3a05f3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123_list** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/MapTest.md b/samples/client/petstore/python-asyncio/docs/MapTest.md new file mode 100644 index 00000000000..63cdab0374a --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/MapTest.md @@ -0,0 +1,11 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_map_of_string** | [**dict(str, dict(str, str))**](dict.md) | | [optional] +**map_of_enum_string** | **dict(str, str)** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/python-asyncio/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..b9808d5275e --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**date_time** | **datetime** | | [optional] +**map** | [**dict(str, Animal)**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Model200Response.md b/samples/client/petstore/python-asyncio/docs/Model200Response.md new file mode 100644 index 00000000000..30f47cae521 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**_class** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/ModelReturn.md b/samples/client/petstore/python-asyncio/docs/ModelReturn.md new file mode 100644 index 00000000000..2b03798e301 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ModelReturn.md @@ -0,0 +1,10 @@ +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Name.md b/samples/client/petstore/python-asyncio/docs/Name.md new file mode 100644 index 00000000000..542da3f0476 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snake_case** | **int** | | [optional] +**_property** | **str** | | [optional] +**_123_number** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/NumberOnly.md b/samples/client/petstore/python-asyncio/docs/NumberOnly.md new file mode 100644 index 00000000000..93a0fde7b93 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_number** | **float** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Order.md b/samples/client/petstore/python-asyncio/docs/Order.md new file mode 100644 index 00000000000..b5f7b22d34c --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**pet_id** | **int** | | [optional] +**quantity** | **int** | | [optional] +**ship_date** | **datetime** | | [optional] +**status** | **str** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to False] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/OuterBoolean.md b/samples/client/petstore/python-asyncio/docs/OuterBoolean.md new file mode 100644 index 00000000000..8b243399474 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/OuterBoolean.md @@ -0,0 +1,9 @@ +# OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/OuterComposite.md b/samples/client/petstore/python-asyncio/docs/OuterComposite.md new file mode 100644 index 00000000000..159e67b48ee --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/OuterEnum.md b/samples/client/petstore/python-asyncio/docs/OuterEnum.md new file mode 100644 index 00000000000..06d413b0168 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/OuterEnum.md @@ -0,0 +1,9 @@ +# OuterEnum + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/OuterNumber.md b/samples/client/petstore/python-asyncio/docs/OuterNumber.md new file mode 100644 index 00000000000..8aa37f329bd --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/OuterNumber.md @@ -0,0 +1,9 @@ +# OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/OuterString.md b/samples/client/petstore/python-asyncio/docs/OuterString.md new file mode 100644 index 00000000000..9ccaadaf98d --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/OuterString.md @@ -0,0 +1,9 @@ +# OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/Pet.md b/samples/client/petstore/python-asyncio/docs/Pet.md new file mode 100644 index 00000000000..9e15090300f --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **str** | | +**photo_urls** | **list[str]** | | +**tags** | [**list[Tag]**](Tag.md) | | [optional] +**status** | **str** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/PetApi.md b/samples/client/petstore/python-asyncio/docs/PetApi.md new file mode 100644 index 00000000000..74c6a5196fd --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/PetApi.md @@ -0,0 +1,440 @@ +# petstore_api.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image + + +# **add_pet** +> add_pet(body) + +Add a new pet to the store + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_pet** +> delete_pet(pet_id, api_key=api_key) + +Deletes a pet + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| Pet id to delete | + **api_key** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_status** +> list[Pet] find_pets_by_status(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**list[str]**](str.md)| Status values that need to be considered for filter | + +### Return type + +[**list[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_tags** +> list[Pet] find_pets_by_tags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**list[str]**](str.md)| Tags to filter by | + +### Return type + +[**list[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id** +> Pet get_pet_by_id(pet_id) + +Find pet by ID + +Returns a single pet + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +configuration = petstore_api.Configuration() +configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet** +> update_pet(body) + +Update an existing pet + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet_with_form** +> update_pet_with_form(pet_id, name=name, status=status) + +Updates a pet in the store with form data + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **str**| Updated name of the pet | [optional] + **status** | **str**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) + +uploads an image + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # int | ID of pet to update +additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) +file = '/path/to/file.txt' # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + **file** | **file**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/docs/ReadOnlyFirst.md b/samples/client/petstore/python-asyncio/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..93fed253d01 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] +**baz** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/SpecialModelName.md b/samples/client/petstore/python-asyncio/docs/SpecialModelName.md new file mode 100644 index 00000000000..022ee19169c --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/StoreApi.md b/samples/client/petstore/python-asyncio/docs/StoreApi.md new file mode 100644 index 00000000000..a75113975ef --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/StoreApi.md @@ -0,0 +1,205 @@ +# petstore_api.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet + + +# **delete_order** +> delete_order(order_id) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory** +> dict(str, int) get_inventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +configuration = petstore_api.Configuration() +configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# 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) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**dict(str, int)** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_order_by_id** +> Order get_order_by_id(order_id) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```python +from __future__ import print_function +import time +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 = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **place_order** +> Order place_order(body) + +Place an order for a pet + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/docs/Tag.md b/samples/client/petstore/python-asyncio/docs/Tag.md new file mode 100644 index 00000000000..243cd98eda6 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/User.md b/samples/client/petstore/python-asyncio/docs/User.md new file mode 100644 index 00000000000..443ac123fdc --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **str** | | [optional] +**first_name** | **str** | | [optional] +**last_name** | **str** | | [optional] +**email** | **str** | | [optional] +**password** | **str** | | [optional] +**phone** | **str** | | [optional] +**user_status** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-asyncio/docs/UserApi.md b/samples/client/petstore/python-asyncio/docs/UserApi.md new file mode 100644 index 00000000000..5b73179dce3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/UserApi.md @@ -0,0 +1,394 @@ +# petstore_api.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_user**](UserApi.md#create_user) | **POST** /user | Create user +[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system +[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +# **create_user** +> create_user(body) + +Create user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # Create user + api_instance.create_user(body) +except ApiException as e: + print("Exception when calling UserApi->create_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_array_input** +> create_users_with_array_input(body) + +Creates list of users with given input array + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**list[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_list_input** +> create_users_with_list_input(body) + +Creates list of users with given input array + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**list[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_user** +> delete_user(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # Delete user + api_instance.delete_user(username) +except ApiException as e: + print("Exception when calling UserApi->delete_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_user_by_name** +> User get_user_by_name(username) + +Get user by user name + + + +### Example +```python +from __future__ import print_function +import time +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. + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **login_user** +> str login_user(username, password) + +Logs user into the system + + + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logout_user** +> logout_user() + +Logs out current logged in user session + + + +### Example +```python +from __future__ import print_function +import time +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) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_user** +> update_user(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-asyncio/git_push.sh b/samples/client/petstore/python-asyncio/git_push.sh new file mode 100644 index 00000000000..ed374619b13 --- /dev/null +++ b/samples/client/petstore/python-asyncio/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py new file mode 100644 index 00000000000..cad09e2691c --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -0,0 +1,65 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into sdk package +from .models.additional_properties_class import AdditionalPropertiesClass +from .models.animal import Animal +from .models.animal_farm import AnimalFarm +from .models.api_response import ApiResponse +from .models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from .models.array_of_number_only import ArrayOfNumberOnly +from .models.array_test import ArrayTest +from .models.capitalization import Capitalization +from .models.category import Category +from .models.class_model import ClassModel +from .models.client import Client +from .models.enum_arrays import EnumArrays +from .models.enum_class import EnumClass +from .models.enum_test import EnumTest +from .models.format_test import FormatTest +from .models.has_only_read_only import HasOnlyReadOnly +from .models.list import List +from .models.map_test import MapTest +from .models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from .models.model_200_response import Model200Response +from .models.model_return import ModelReturn +from .models.name import Name +from .models.number_only import NumberOnly +from .models.order import Order +from .models.outer_boolean import OuterBoolean +from .models.outer_composite import OuterComposite +from .models.outer_enum import OuterEnum +from .models.outer_number import OuterNumber +from .models.outer_string import OuterString +from .models.pet import Pet +from .models.read_only_first import ReadOnlyFirst +from .models.special_model_name import SpecialModelName +from .models.tag import Tag +from .models.user import User +from .models.cat import Cat +from .models.dog import Dog + +# import apis into sdk package +from .apis.another_fake_api import AnotherFakeApi +from .apis.fake_api import FakeApi +from .apis.fake_classname_tags_123_api import FakeClassnameTags123Api +from .apis.pet_api import PetApi +from .apis.store_api import StoreApi +from .apis.user_api import UserApi + +# import ApiClient +from .api_client import ApiClient + +from .configuration import Configuration diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py new file mode 100644 index 00000000000..9f265a7f94a --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -0,0 +1,628 @@ +# coding: utf-8 +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import os +import re +import json +import mimetypes +import tempfile +from multiprocessing.pool import ThreadPool + +from datetime import date, datetime + +# python 2 and python 3 compatibility library +from six import PY3, integer_types, iteritems, text_type +from six.moves.urllib.parse import quote + +from . import models +from .configuration import Configuration +from .rest import ApiException, RESTClientObject + + +class ApiClient(object): + """ + Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param host: The base path for the server to call. + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to the API. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, text_type) + integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if PY3 else long, + 'float': float, + 'str': str, + 'bool': bool, + 'date': date, + 'datetime': datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """ + Gets user agent. + """ + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + """ + Sets user agent. + """ + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + async def __call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, _preload_content=True, + _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param)) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = await self.request(method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """ + Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime, date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """ + Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """ + Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match('list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == date: + return self.__deserialize_date(data) + elif klass == datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async=None, + _return_http_data_only=None, collection_formats=None, _preload_content=True, + _request_timeout=None): + """ + Makes the HTTP request (synchronous) and return the deserialized data. + To make an async request, set the async parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async bool: execute request asynchronously + :param _return_http_data_only: response data without head status code and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without + reading/decoding response data. Default is True. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :return: + If async parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async is False or missing, + then the method will return the response directly. + """ + if not async: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, method, + path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, _preload_content, _request_timeout)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, _request_timeout=None): + """ + Makes the HTTP request using RESTClient. + """ + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """ + Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in iteritems(params) if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """ + Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = mimetypes.\ + guess_type(filename)[0] or 'application/octet-stream' + params.append(tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """ + Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """ + Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """ + Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """ + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.\ + search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\ + group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "w") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """ + Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return unicode(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """ + Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """ + Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise ApiException( + status=0, + reason="Failed to parse `{0}` into a date object".format(string) + ) + + def __deserialize_datatime(self, string): + """ + Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise ApiException( + status=0, + reason=( + "Failed to parse `{0}` into a datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """ + Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not hasattr(klass, 'get_real_child_model'): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in iteritems(klass.swagger_types): + if data is not None \ + and klass.attribute_map[attr] in data \ + and isinstance(data, (list, dict)): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/apis/__init__.py new file mode 100644 index 00000000000..b4b975ca8e0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/__init__.py @@ -0,0 +1,9 @@ +from __future__ import absolute_import + +# import apis into api package +from .another_fake_api import AnotherFakeApi +from .fake_api import FakeApi +from .fake_classname_tags_123_api import FakeClassnameTags123Api +from .pet_api import PetApi +from .store_api import StoreApi +from .user_api import UserApi diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/another_fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/another_fake_api.py new file mode 100644 index 00000000000..8fb991ff3df --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/another_fake_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class AnotherFakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def test_special_tags(self, body, **kwargs): + """ + To test special tags + To test special tags + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_special_tags(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_special_tags_with_http_info(body, **kwargs) + else: + (data) = self.test_special_tags_with_http_info(body, **kwargs) + return data + + def test_special_tags_with_http_info(self, body, **kwargs): + """ + To test special tags + To test special tags + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_special_tags_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_special_tags" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_special_tags`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/another-fake/dummy', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/fake_api.py new file mode 100644 index 00000000000..46fb22f7290 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/fake_api.py @@ -0,0 +1,886 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class FakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def fake_outer_boolean_serialize(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_boolean_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_boolean_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) + return data + + def fake_outer_boolean_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_boolean_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_boolean_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/boolean', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterBoolean', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_composite_serialize(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_composite_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_composite_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) + return data + + def fake_outer_composite_serialize_with_http_info(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_composite_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_composite_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/composite', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterComposite', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_number_serialize(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_number_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_number_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) + return data + + def fake_outer_number_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_number_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_number_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/number', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterNumber', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_string_serialize(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_string_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_string_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) + return data + + def fake_outer_string_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_string_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_string_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/string', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterString', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_client_model(self, body, **kwargs): + """ + To test \"client\" model + To test \"client\" model + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_client_model(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_client_model_with_http_info(body, **kwargs) + else: + (data) = self.test_client_model_with_http_info(body, **kwargs) + return data + + def test_client_model_with_http_info(self, body, **kwargs): + """ + To test \"client\" model + To test \"client\" model + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_client_model_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_client_model" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_client_model`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, async=True) + >>> result = thread.get() + + :param async bool + :param float number: None (required) + :param float double: None (required) + :param str pattern_without_delimiter: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str string: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :param str param_callback: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) + else: + (data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) + return data + + def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, async=True) + >>> result = thread.get() + + :param async bool + :param float number: None (required) + :param float double: None (required) + :param str pattern_without_delimiter: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str string: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :param str param_callback: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password', 'param_callback'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_endpoint_parameters" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'number' is set + if ('number' not in params) or (params['number'] is None): + raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") + # verify the required parameter 'double' is set + if ('double' not in params) or (params['double'] is None): + raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") + # verify the required parameter 'pattern_without_delimiter' is set + if ('pattern_without_delimiter' not in params) or (params['pattern_without_delimiter'] is None): + raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") + # verify the required parameter 'byte' is set + if ('byte' not in params) or (params['byte'] is None): + raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") + + if 'number' in params and params['number'] > 543.2: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") + if 'number' in params and params['number'] < 32.1: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") + if 'double' in params and params['double'] > 123.4: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") + if 'double' in params and params['double'] < 67.8: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") + if 'pattern_without_delimiter' in params and not re.search('^[A-Z].*', params['pattern_without_delimiter']): + raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") + if 'integer' in params and params['integer'] > 100: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") + if 'integer' in params and params['integer'] < 10: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") + if 'int32' in params and params['int32'] > 200: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") + if 'int32' in params and params['int32'] < 20: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") + if 'float' in params and params['float'] > 987.6: + raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") + if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE): + raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") + if 'password' in params and len(params['password']) > 64: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") + if 'password' in params and len(params['password']) < 10: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'integer' in params: + form_params.append(('integer', params['integer'])) + if 'int32' in params: + form_params.append(('int32', params['int32'])) + if 'int64' in params: + form_params.append(('int64', params['int64'])) + if 'number' in params: + form_params.append(('number', params['number'])) + if 'float' in params: + form_params.append(('float', params['float'])) + if 'double' in params: + form_params.append(('double', params['double'])) + if 'string' in params: + form_params.append(('string', params['string'])) + if 'pattern_without_delimiter' in params: + form_params.append(('pattern_without_delimiter', params['pattern_without_delimiter'])) + if 'byte' in params: + form_params.append(('byte', params['byte'])) + if 'binary' in params: + form_params.append(('binary', params['binary'])) + if 'date' in params: + form_params.append(('date', params['date'])) + if 'date_time' in params: + form_params.append(('dateTime', params['date_time'])) + if 'password' in params: + form_params.append(('password', params['password'])) + if 'param_callback' in params: + form_params.append(('callback', params['param_callback'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) + + # Authentication setting + auth_settings = ['http_basic_test'] + + return self.api_client.call_api('/fake', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_enum_parameters(self, **kwargs): + """ + To test enum parameters + To test enum parameters + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_enum_parameters(async=True) + >>> result = thread.get() + + :param async bool + :param list[str] enum_form_string_array: Form parameter enum test (string array) + :param str enum_form_string: Form parameter enum test (string) + :param list[str] enum_header_string_array: Header parameter enum test (string array) + :param str enum_header_string: Header parameter enum test (string) + :param list[str] enum_query_string_array: Query parameter enum test (string array) + :param str enum_query_string: Query parameter enum test (string) + :param int enum_query_integer: Query parameter enum test (double) + :param float enum_query_double: Query parameter enum test (double) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_enum_parameters_with_http_info(**kwargs) + else: + (data) = self.test_enum_parameters_with_http_info(**kwargs) + return data + + def test_enum_parameters_with_http_info(self, **kwargs): + """ + To test enum parameters + To test enum parameters + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_enum_parameters_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param list[str] enum_form_string_array: Form parameter enum test (string array) + :param str enum_form_string: Form parameter enum test (string) + :param list[str] enum_header_string_array: Header parameter enum test (string array) + :param str enum_header_string: Header parameter enum test (string) + :param list[str] enum_query_string_array: Query parameter enum test (string array) + :param str enum_query_string: Query parameter enum test (string) + :param int enum_query_integer: Query parameter enum test (double) + :param float enum_query_double: Query parameter enum test (double) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['enum_form_string_array', 'enum_form_string', 'enum_header_string_array', 'enum_header_string', 'enum_query_string_array', 'enum_query_string', 'enum_query_integer', 'enum_query_double'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_enum_parameters" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'enum_query_string_array' in params: + query_params.append(('enum_query_string_array', params['enum_query_string_array'])) + collection_formats['enum_query_string_array'] = 'csv' + if 'enum_query_string' in params: + query_params.append(('enum_query_string', params['enum_query_string'])) + if 'enum_query_integer' in params: + query_params.append(('enum_query_integer', params['enum_query_integer'])) + + header_params = {} + if 'enum_header_string_array' in params: + header_params['enum_header_string_array'] = params['enum_header_string_array'] + collection_formats['enum_header_string_array'] = 'csv' + if 'enum_header_string' in params: + header_params['enum_header_string'] = params['enum_header_string'] + + form_params = [] + local_var_files = {} + if 'enum_form_string_array' in params: + form_params.append(('enum_form_string_array', params['enum_form_string_array'])) + collection_formats['enum_form_string_array'] = 'csv' + if 'enum_form_string' in params: + form_params.append(('enum_form_string', params['enum_form_string'])) + if 'enum_query_double' in params: + form_params.append(('enum_query_double', params['enum_query_double'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_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('/fake', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_json_form_data(self, param, param2, **kwargs): + """ + test json serialization of form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_json_form_data(param, param2, async=True) + >>> result = thread.get() + + :param async bool + :param str param: field1 (required) + :param str param2: field2 (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_json_form_data_with_http_info(param, param2, **kwargs) + else: + (data) = self.test_json_form_data_with_http_info(param, param2, **kwargs) + return data + + def test_json_form_data_with_http_info(self, param, param2, **kwargs): + """ + test json serialization of form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_json_form_data_with_http_info(param, param2, async=True) + >>> result = thread.get() + + :param async bool + :param str param: field1 (required) + :param str param2: field2 (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['param', 'param2'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_json_form_data" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'param' is set + if ('param' not in params) or (params['param'] is None): + raise ValueError("Missing the required parameter `param` when calling `test_json_form_data`") + # verify the required parameter 'param2' is set + if ('param2' not in params) or (params['param2'] is None): + raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'param' in params: + form_params.append(('param', params['param'])) + if 'param2' in params: + form_params.append(('param2', params['param2'])) + + body_params = None + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/jsonFormData', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/fake_classname_tags_123_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/fake_classname_tags_123_api.py new file mode 100644 index 00000000000..da75ad3cccd --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/fake_classname_tags_123_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class FakeClassnameTags123Api(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def test_classname(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_classname(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_classname_with_http_info(body, **kwargs) + else: + (data) = self.test_classname_with_http_info(body, **kwargs) + return data + + def test_classname_with_http_info(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_classname_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_classname" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_classname`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = ['api_key_query'] + + return self.api_client.call_api('/fake_classname_test', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/pet_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/pet_api.py new file mode 100644 index 00000000000..51b6ce82540 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/pet_api.py @@ -0,0 +1,826 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class PetApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_pet(self, body, **kwargs): + """ + Add a new pet to the store + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.add_pet(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.add_pet_with_http_info(body, **kwargs) + else: + (data) = self.add_pet_with_http_info(body, **kwargs) + return data + + def add_pet_with_http_info(self, body, **kwargs): + """ + Add a new pet to the store + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.add_pet_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `add_pet`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # 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('/pet', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.delete_pet(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_pet_with_http_info(pet_id, **kwargs) + else: + (data) = self.delete_pet_with_http_info(pet_id, **kwargs) + return data + + def delete_pet_with_http_info(self, pet_id, **kwargs): + """ + Deletes a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_pet_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_pets_by_status(self, status, **kwargs): + """ + Finds Pets by status + Multiple status values can be provided with comma separated strings + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_status(status, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] status: Status values that need to be considered for filter (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.find_pets_by_status_with_http_info(status, **kwargs) + else: + (data) = self.find_pets_by_status_with_http_info(status, **kwargs) + return data + + def find_pets_by_status_with_http_info(self, status, **kwargs): + """ + Finds Pets by status + Multiple status values can be provided with comma separated strings + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_status_with_http_info(status, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] status: Status values that need to be considered for filter (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['status'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_pets_by_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status' is set + if ('status' not in params) or (params['status'] is None): + raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status' in params: + query_params.append(('status', params['status'])) + collection_formats['status'] = 'csv' + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/findByStatus', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Pet]', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_pets_by_tags(self, tags, **kwargs): + """ + Finds Pets by tags + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_tags(tags, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] tags: Tags to filter by (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.find_pets_by_tags_with_http_info(tags, **kwargs) + else: + (data) = self.find_pets_by_tags_with_http_info(tags, **kwargs) + return data + + def find_pets_by_tags_with_http_info(self, tags, **kwargs): + """ + Finds Pets by tags + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_tags_with_http_info(tags, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] tags: Tags to filter by (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tags'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_pets_by_tags" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tags' is set + if ('tags' not in params) or (params['tags'] is None): + raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'tags' in params: + query_params.append(('tags', params['tags'])) + collection_formats['tags'] = 'csv' + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/findByTags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Pet]', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_pet_by_id(self, pet_id, **kwargs): + """ + Find pet by ID + Returns a single pet + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_pet_by_id(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to return (required) + :return: Pet + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) + else: + (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) + return data + + def get_pet_by_id_with_http_info(self, pet_id, **kwargs): + """ + Find pet by ID + Returns a single pet + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_pet_by_id_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to return (required) + :return: Pet + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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" % 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`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = ['api_key'] + + return self.api_client.call_api('/pet/{petId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Pet', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_pet(self, body, **kwargs): + """ + Update an existing pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_pet_with_http_info(body, **kwargs) + else: + (data) = self.update_pet_with_http_info(body, **kwargs) + return data + + def update_pet_with_http_info(self, body, **kwargs): + """ + Update an existing pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_pet`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # 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('/pet', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_pet_with_form(self, pet_id, **kwargs): + """ + Updates a pet in the store with form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_form(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet that needs to be updated (required) + :param str name: Updated name of the pet + :param str status: Updated status of the pet + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_pet_with_form_with_http_info(pet_id, **kwargs) + else: + (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) + return data + + def update_pet_with_form_with_http_info(self, pet_id, **kwargs): + """ + Updates a pet in the store with form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_form_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet that needs to be updated (required) + :param str name: Updated name of the pet + :param str status: Updated status of the pet + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'name', 'status'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_with_form" % 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 `update_pet_with_form`") + + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'name' in params: + form_params.append(('name', params['name'])) + if 'status' in params: + form_params.append(('status', params['status'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/x-www-form-urlencoded']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def upload_file(self, pet_id, **kwargs): + """ + uploads an image + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param str additional_metadata: Additional data to pass to server + :param file file: file to upload + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.upload_file_with_http_info(pet_id, **kwargs) + else: + (data) = self.upload_file_with_http_info(pet_id, **kwargs) + return data + + def upload_file_with_http_info(self, pet_id, **kwargs): + """ + uploads an image + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param str additional_metadata: Additional data to pass to server + :param file file: file to upload + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'additional_metadata', 'file'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 upload_file" % 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 `upload_file`") + + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'additional_metadata' in params: + form_params.append(('additionalMetadata', params['additional_metadata'])) + if 'file' in params: + local_var_files['file'] = params['file'] + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['multipart/form-data']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}/uploadImage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ApiResponse', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/store_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/store_api.py new file mode 100644 index 00000000000..e9d9599c363 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/store_api.py @@ -0,0 +1,408 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class StoreApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_order(self, order_id, **kwargs): + """ + Delete purchase order by ID + 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 pass async=True + >>> thread = api.delete_order(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param str order_id: ID of the order that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_order_with_http_info(order_id, **kwargs) + else: + (data) = self.delete_order_with_http_info(order_id, **kwargs) + return data + + def delete_order_with_http_info(self, order_id, **kwargs): + """ + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_order_with_http_info(order_id, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order/{order_id}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_inventory(self, **kwargs): + """ + Returns pet inventories by status + Returns a map of status codes to quantities + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_inventory(async=True) + >>> result = thread.get() + + :param async bool + :return: dict(str, int) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_inventory_with_http_info(**kwargs) + else: + (data) = self.get_inventory_with_http_info(**kwargs) + return data + + def get_inventory_with_http_info(self, **kwargs): + """ + Returns pet inventories by status + Returns a map of status codes to quantities + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_inventory_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: dict(str, int) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_inventory" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + 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']) + + # Authentication setting + auth_settings = ['api_key'] + + return self.api_client.call_api('/store/inventory', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, int)', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_order_by_id(self, order_id, **kwargs): + """ + Find purchase order by ID + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_order_by_id(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param int order_id: ID of pet that needs to be fetched (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_order_by_id_with_http_info(order_id, **kwargs) + else: + (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) + return data + + def get_order_by_id_with_http_info(self, order_id, **kwargs): + """ + Find purchase order by ID + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_order_by_id_with_http_info(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param int order_id: ID of pet that needs to be fetched (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['order_id'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_order_by_id" % 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 `get_order_by_id`") + + if 'order_id' in params and params['order_id'] > 5: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") + if 'order_id' in params and params['order_id'] < 1: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order/{order_id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Order', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def place_order(self, body, **kwargs): + """ + Place an order for a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.place_order(body, async=True) + >>> result = thread.get() + + :param async bool + :param Order body: order placed for purchasing the pet (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.place_order_with_http_info(body, **kwargs) + else: + (data) = self.place_order_with_http_info(body, **kwargs) + return data + + def place_order_with_http_info(self, body, **kwargs): + """ + Place an order for a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.place_order_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Order body: order placed for purchasing the pet (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 place_order" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `place_order`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Order', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/apis/user_api.py b/samples/client/petstore/python-asyncio/petstore_api/apis/user_api.py new file mode 100644 index 00000000000..ffdad2dd60f --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/apis/user_api.py @@ -0,0 +1,794 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class UserApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_user(self, body, **kwargs): + """ + Create user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_user(body, async=True) + >>> result = thread.get() + + :param async bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_user_with_http_info(body, **kwargs) + else: + (data) = self.create_user_with_http_info(body, **kwargs) + return data + + def create_user_with_http_info(self, body, **kwargs): + """ + Create user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_user_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_user`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_users_with_array_input(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_array_input(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_users_with_array_input_with_http_info(body, **kwargs) + else: + (data) = self.create_users_with_array_input_with_http_info(body, **kwargs) + return data + + def create_users_with_array_input_with_http_info(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_array_input_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_users_with_array_input" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/createWithArray', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_users_with_list_input(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_list_input(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_users_with_list_input_with_http_info(body, **kwargs) + else: + (data) = self.create_users_with_list_input_with_http_info(body, **kwargs) + return data + + def create_users_with_list_input_with_http_info(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_list_input_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_users_with_list_input" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/createWithList', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.delete_user(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_user_with_http_info(username, **kwargs) + else: + (data) = self.delete_user_with_http_info(username, **kwargs) + return data + + def delete_user_with_http_info(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_user_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_name(self, username, **kwargs): + """ + Get user by user name + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_user_by_name(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_user_by_name_with_http_info(username, **kwargs) + else: + (data) = self.get_user_by_name_with_http_info(username, **kwargs) + return data + + def get_user_by_name_with_http_info(self, username, **kwargs): + """ + Get user by user name + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_user_by_name_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_user_by_name" % 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 `get_user_by_name`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def login_user(self, username, password, **kwargs): + """ + Logs user into the system + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.login_user(username, password, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.login_user_with_http_info(username, password, **kwargs) + else: + (data) = self.login_user_with_http_info(username, password, **kwargs) + return data + + def login_user_with_http_info(self, username, password, **kwargs): + """ + Logs user into the system + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.login_user_with_http_info(username, password, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username', 'password'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + # 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 `login_user`") + # verify the required parameter 'password' is set + if ('password' not in params) or (params['password'] is None): + raise ValueError("Missing the required parameter `password` when calling `login_user`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'username' in params: + query_params.append(('username', params['username'])) + if 'password' in params: + query_params.append(('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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/login', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.logout_user(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.logout_user_with_http_info(**kwargs) + else: + (data) = self.logout_user_with_http_info(**kwargs) + return data + + def logout_user_with_http_info(self, **kwargs): + """ + Logs out current logged in user session + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.logout_user_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/logout', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_user(self, username, body, **kwargs): + """ + Updated user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_user(username, body, async=True) + >>> result = thread.get() + + :param async bool + :param str username: name that need to be deleted (required) + :param User body: Updated user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_user_with_http_info(username, body, **kwargs) + else: + (data) = self.update_user_with_http_info(username, body, **kwargs) + return data + + def update_user_with_http_info(self, username, body, **kwargs): + """ + Updated user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_user_with_http_info(username, body, async=True) + >>> result = thread.get() + + :param async bool + :param str username: name that need to be deleted (required) + :param User body: Updated user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username', 'body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_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 `update_user`") + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_user`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py new file mode 100644 index 00000000000..9e1fcf24089 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import urllib3 + +import logging +import multiprocessing +import sys + +from six import iteritems +from six.moves import http_client as httplib + + +class Configuration(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """ + Constructor + """ + # Default Base url + self.host = "http://petstore.swagger.io:80/v2" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # access token for OAuth + self.access_token = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("petstore_api") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @property + def logger_file(self): + """ + Gets the logger_file. + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """ + Sets the logger_file. + + If the logger_file is None, then add stream handler and remove file handler. + Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """ + Gets the debug status. + """ + return self.__debug + + @debug.setter + def debug(self, value): + """ + Sets the debug status. + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """ + Gets the logger_format. + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """ + Sets the logger_format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """ + Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] + elif self.api_key.get(identifier): + return self.api_key[identifier] + + def get_basic_auth_token(self): + """ + Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\ + .get('authorization') + + def auth_settings(self): + """ + Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + 'api_key': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, + 'api_key_query': + { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix('api_key_query') + }, + 'http_basic_test': + { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, + + 'petstore_auth': + { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, + + } + + def to_debug_report(self): + """ + Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.0.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py new file mode 100644 index 00000000000..21b5d20fa3c --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into model package +from .additional_properties_class import AdditionalPropertiesClass +from .animal import Animal +from .animal_farm import AnimalFarm +from .api_response import ApiResponse +from .array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from .array_of_number_only import ArrayOfNumberOnly +from .array_test import ArrayTest +from .capitalization import Capitalization +from .category import Category +from .class_model import ClassModel +from .client import Client +from .enum_arrays import EnumArrays +from .enum_class import EnumClass +from .enum_test import EnumTest +from .format_test import FormatTest +from .has_only_read_only import HasOnlyReadOnly +from .list import List +from .map_test import MapTest +from .mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from .model_200_response import Model200Response +from .model_return import ModelReturn +from .name import Name +from .number_only import NumberOnly +from .order import Order +from .outer_boolean import OuterBoolean +from .outer_composite import OuterComposite +from .outer_enum import OuterEnum +from .outer_number import OuterNumber +from .outer_string import OuterString +from .pet import Pet +from .read_only_first import ReadOnlyFirst +from .special_model_name import SpecialModelName +from .tag import Tag +from .user import User +from .cat import Cat +from .dog import Dog diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-asyncio/petstore_api/models/additional_properties_class.py new file mode 100644 index 00000000000..a5329b411cd --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/additional_properties_class.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class AdditionalPropertiesClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'map_property': 'dict(str, str)', + 'map_of_map_property': 'dict(str, dict(str, str))' + } + + attribute_map = { + 'map_property': 'map_property', + 'map_of_map_property': 'map_of_map_property' + } + + def __init__(self, map_property=None, map_of_map_property=None): + """ + AdditionalPropertiesClass - a model defined in Swagger + """ + + self._map_property = None + self._map_of_map_property = None + self.discriminator = None + + if map_property is not None: + self.map_property = map_property + if map_of_map_property is not None: + self.map_of_map_property = map_of_map_property + + @property + def map_property(self): + """ + Gets the map_property of this AdditionalPropertiesClass. + + :return: The map_property of this AdditionalPropertiesClass. + :rtype: dict(str, str) + """ + return self._map_property + + @map_property.setter + def map_property(self, map_property): + """ + Sets the map_property of this AdditionalPropertiesClass. + + :param map_property: The map_property of this AdditionalPropertiesClass. + :type: dict(str, str) + """ + + self._map_property = map_property + + @property + def map_of_map_property(self): + """ + Gets the map_of_map_property of this AdditionalPropertiesClass. + + :return: The map_of_map_property of this AdditionalPropertiesClass. + :rtype: dict(str, dict(str, str)) + """ + return self._map_of_map_property + + @map_of_map_property.setter + def map_of_map_property(self, map_of_map_property): + """ + Sets the map_of_map_property of this AdditionalPropertiesClass. + + :param map_of_map_property: The map_of_map_property of this AdditionalPropertiesClass. + :type: dict(str, dict(str, str)) + """ + + self._map_of_map_property = map_of_map_property + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, AdditionalPropertiesClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/animal.py b/samples/client/petstore/python-asyncio/petstore_api/models/animal.py new file mode 100644 index 00000000000..13d8276713d --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/animal.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Animal(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'class_name': 'str', + 'color': 'str' + } + + attribute_map = { + 'class_name': 'className', + 'color': 'color' + } + + discriminator_value_class_map = { + '': 'Dog', + '': 'Cat' + } + + def __init__(self, class_name=None, color='red'): + """ + Animal - a model defined in Swagger + """ + + self._class_name = None + self._color = None + self.discriminator = 'className' + + self.class_name = class_name + if color is not None: + self.color = color + + @property + def class_name(self): + """ + Gets the class_name of this Animal. + + :return: The class_name of this Animal. + :rtype: str + """ + return self._class_name + + @class_name.setter + def class_name(self, class_name): + """ + Sets the class_name of this Animal. + + :param class_name: The class_name of this Animal. + :type: str + """ + if class_name is None: + raise ValueError("Invalid value for `class_name`, must not be `None`") + + self._class_name = class_name + + @property + def color(self): + """ + Gets the color of this Animal. + + :return: The color of this Animal. + :rtype: str + """ + return self._color + + @color.setter + def color(self, color): + """ + Sets the color of this Animal. + + :param color: The color of this Animal. + :type: str + """ + + self._color = color + + def get_real_child_model(self, data): + """ + Returns the real base class specified by the discriminator + """ + discriminator_value = data[self.discriminator].lower() + if self.discriminator_value_class_map.has_key(discriminator_value): + return self.discriminator_value_class_map[discriminator_value] + else: + return None + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Animal): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py b/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py new file mode 100644 index 00000000000..fa47d63f881 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/animal_farm.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class AnimalFarm(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + AnimalFarm - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, AnimalFarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/api_response.py b/samples/client/petstore/python-asyncio/petstore_api/models/api_response.py new file mode 100644 index 00000000000..b2d784d8020 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/api_response.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ApiResponse(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'code': 'int', + 'type': 'str', + 'message': 'str' + } + + attribute_map = { + 'code': 'code', + 'type': 'type', + 'message': 'message' + } + + def __init__(self, code=None, type=None, message=None): + """ + ApiResponse - a model defined in Swagger + """ + + self._code = None + self._type = None + self._message = None + self.discriminator = None + + if code is not None: + self.code = code + if type is not None: + self.type = type + if message is not None: + self.message = message + + @property + def code(self): + """ + Gets the code of this ApiResponse. + + :return: The code of this ApiResponse. + :rtype: int + """ + return self._code + + @code.setter + def code(self, code): + """ + Sets the code of this ApiResponse. + + :param code: The code of this ApiResponse. + :type: int + """ + + self._code = code + + @property + def type(self): + """ + Gets the type of this ApiResponse. + + :return: The type of this ApiResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """ + Sets the type of this ApiResponse. + + :param type: The type of this ApiResponse. + :type: str + """ + + self._type = type + + @property + def message(self): + """ + Gets the message of this ApiResponse. + + :return: The message of this ApiResponse. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """ + Sets the message of this ApiResponse. + + :param message: The message of this ApiResponse. + :type: str + """ + + self._message = message + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ApiResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-asyncio/petstore_api/models/array_of_array_of_number_only.py new file mode 100644 index 00000000000..0792f5a8a23 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/array_of_array_of_number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayOfArrayOfNumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_array_number': 'list[list[float]]' + } + + attribute_map = { + 'array_array_number': 'ArrayArrayNumber' + } + + def __init__(self, array_array_number=None): + """ + ArrayOfArrayOfNumberOnly - a model defined in Swagger + """ + + self._array_array_number = None + self.discriminator = None + + if array_array_number is not None: + self.array_array_number = array_array_number + + @property + def array_array_number(self): + """ + Gets the array_array_number of this ArrayOfArrayOfNumberOnly. + + :return: The array_array_number of this ArrayOfArrayOfNumberOnly. + :rtype: list[list[float]] + """ + return self._array_array_number + + @array_array_number.setter + def array_array_number(self, array_array_number): + """ + Sets the array_array_number of this ArrayOfArrayOfNumberOnly. + + :param array_array_number: The array_array_number of this ArrayOfArrayOfNumberOnly. + :type: list[list[float]] + """ + + self._array_array_number = array_array_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayOfArrayOfNumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-asyncio/petstore_api/models/array_of_number_only.py new file mode 100644 index 00000000000..9d00e1b37a2 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/array_of_number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayOfNumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_number': 'list[float]' + } + + attribute_map = { + 'array_number': 'ArrayNumber' + } + + def __init__(self, array_number=None): + """ + ArrayOfNumberOnly - a model defined in Swagger + """ + + self._array_number = None + self.discriminator = None + + if array_number is not None: + self.array_number = array_number + + @property + def array_number(self): + """ + Gets the array_number of this ArrayOfNumberOnly. + + :return: The array_number of this ArrayOfNumberOnly. + :rtype: list[float] + """ + return self._array_number + + @array_number.setter + def array_number(self, array_number): + """ + Sets the array_number of this ArrayOfNumberOnly. + + :param array_number: The array_number of this ArrayOfNumberOnly. + :type: list[float] + """ + + self._array_number = array_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayOfNumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py new file mode 100644 index 00000000000..ac3079087c8 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/array_test.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_of_string': 'list[str]', + 'array_array_of_integer': 'list[list[int]]', + 'array_array_of_model': 'list[list[ReadOnlyFirst]]' + } + + attribute_map = { + 'array_of_string': 'array_of_string', + 'array_array_of_integer': 'array_array_of_integer', + 'array_array_of_model': 'array_array_of_model' + } + + def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): + """ + ArrayTest - a model defined in Swagger + """ + + self._array_of_string = None + self._array_array_of_integer = None + self._array_array_of_model = None + self.discriminator = None + + if array_of_string is not None: + self.array_of_string = array_of_string + if array_array_of_integer is not None: + self.array_array_of_integer = array_array_of_integer + if array_array_of_model is not None: + self.array_array_of_model = array_array_of_model + + @property + def array_of_string(self): + """ + Gets the array_of_string of this ArrayTest. + + :return: The array_of_string of this ArrayTest. + :rtype: list[str] + """ + return self._array_of_string + + @array_of_string.setter + def array_of_string(self, array_of_string): + """ + Sets the array_of_string of this ArrayTest. + + :param array_of_string: The array_of_string of this ArrayTest. + :type: list[str] + """ + + self._array_of_string = array_of_string + + @property + def array_array_of_integer(self): + """ + Gets the array_array_of_integer of this ArrayTest. + + :return: The array_array_of_integer of this ArrayTest. + :rtype: list[list[int]] + """ + return self._array_array_of_integer + + @array_array_of_integer.setter + def array_array_of_integer(self, array_array_of_integer): + """ + Sets the array_array_of_integer of this ArrayTest. + + :param array_array_of_integer: The array_array_of_integer of this ArrayTest. + :type: list[list[int]] + """ + + self._array_array_of_integer = array_array_of_integer + + @property + def array_array_of_model(self): + """ + Gets the array_array_of_model of this ArrayTest. + + :return: The array_array_of_model of this ArrayTest. + :rtype: list[list[ReadOnlyFirst]] + """ + return self._array_array_of_model + + @array_array_of_model.setter + def array_array_of_model(self, array_array_of_model): + """ + Sets the array_array_of_model of this ArrayTest. + + :param array_array_of_model: The array_array_of_model of this ArrayTest. + :type: list[list[ReadOnlyFirst]] + """ + + self._array_array_of_model = array_array_of_model + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/capitalization.py b/samples/client/petstore/python-asyncio/petstore_api/models/capitalization.py new file mode 100644 index 00000000000..c9be6ed4d15 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/capitalization.py @@ -0,0 +1,256 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Capitalization(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'small_camel': 'str', + 'capital_camel': 'str', + 'small_snake': 'str', + 'capital_snake': 'str', + 'sca_eth_flow_points': 'str', + 'att_name': 'str' + } + + attribute_map = { + 'small_camel': 'smallCamel', + 'capital_camel': 'CapitalCamel', + 'small_snake': 'small_Snake', + 'capital_snake': 'Capital_Snake', + 'sca_eth_flow_points': 'SCA_ETH_Flow_Points', + 'att_name': 'ATT_NAME' + } + + def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): + """ + Capitalization - a model defined in Swagger + """ + + self._small_camel = None + self._capital_camel = None + self._small_snake = None + self._capital_snake = None + self._sca_eth_flow_points = None + self._att_name = None + self.discriminator = None + + if small_camel is not None: + self.small_camel = small_camel + if capital_camel is not None: + self.capital_camel = capital_camel + if small_snake is not None: + self.small_snake = small_snake + if capital_snake is not None: + self.capital_snake = capital_snake + if sca_eth_flow_points is not None: + self.sca_eth_flow_points = sca_eth_flow_points + if att_name is not None: + self.att_name = att_name + + @property + def small_camel(self): + """ + Gets the small_camel of this Capitalization. + + :return: The small_camel of this Capitalization. + :rtype: str + """ + return self._small_camel + + @small_camel.setter + def small_camel(self, small_camel): + """ + Sets the small_camel of this Capitalization. + + :param small_camel: The small_camel of this Capitalization. + :type: str + """ + + self._small_camel = small_camel + + @property + def capital_camel(self): + """ + Gets the capital_camel of this Capitalization. + + :return: The capital_camel of this Capitalization. + :rtype: str + """ + return self._capital_camel + + @capital_camel.setter + def capital_camel(self, capital_camel): + """ + Sets the capital_camel of this Capitalization. + + :param capital_camel: The capital_camel of this Capitalization. + :type: str + """ + + self._capital_camel = capital_camel + + @property + def small_snake(self): + """ + Gets the small_snake of this Capitalization. + + :return: The small_snake of this Capitalization. + :rtype: str + """ + return self._small_snake + + @small_snake.setter + def small_snake(self, small_snake): + """ + Sets the small_snake of this Capitalization. + + :param small_snake: The small_snake of this Capitalization. + :type: str + """ + + self._small_snake = small_snake + + @property + def capital_snake(self): + """ + Gets the capital_snake of this Capitalization. + + :return: The capital_snake of this Capitalization. + :rtype: str + """ + return self._capital_snake + + @capital_snake.setter + def capital_snake(self, capital_snake): + """ + Sets the capital_snake of this Capitalization. + + :param capital_snake: The capital_snake of this Capitalization. + :type: str + """ + + self._capital_snake = capital_snake + + @property + def sca_eth_flow_points(self): + """ + Gets the sca_eth_flow_points of this Capitalization. + + :return: The sca_eth_flow_points of this Capitalization. + :rtype: str + """ + return self._sca_eth_flow_points + + @sca_eth_flow_points.setter + def sca_eth_flow_points(self, sca_eth_flow_points): + """ + Sets the sca_eth_flow_points of this Capitalization. + + :param sca_eth_flow_points: The sca_eth_flow_points of this Capitalization. + :type: str + """ + + self._sca_eth_flow_points = sca_eth_flow_points + + @property + def att_name(self): + """ + Gets the att_name of this Capitalization. + Name of the pet + + :return: The att_name of this Capitalization. + :rtype: str + """ + return self._att_name + + @att_name.setter + def att_name(self, att_name): + """ + Sets the att_name of this Capitalization. + Name of the pet + + :param att_name: The att_name of this Capitalization. + :type: str + """ + + self._att_name = att_name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Capitalization): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/cat.py b/samples/client/petstore/python-asyncio/petstore_api/models/cat.py new file mode 100644 index 00000000000..76dfdc0e5b1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/cat.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Cat(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'declawed': 'bool' + } + + attribute_map = { + 'declawed': 'declawed' + } + + def __init__(self, declawed=None): + """ + Cat - a model defined in Swagger + """ + + self._declawed = None + self.discriminator = None + + if declawed is not None: + self.declawed = declawed + + @property + def declawed(self): + """ + Gets the declawed of this Cat. + + :return: The declawed of this Cat. + :rtype: bool + """ + return self._declawed + + @declawed.setter + def declawed(self, declawed): + """ + Sets the declawed of this Cat. + + :param declawed: The declawed of this Cat. + :type: bool + """ + + self._declawed = declawed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Cat): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/category.py b/samples/client/petstore/python-asyncio/petstore_api/models/category.py new file mode 100644 index 00000000000..859283a3f77 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/category.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Category(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): + """ + Category - a model defined in Swagger + """ + + self._id = None + self._name = None + self.discriminator = None + + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """ + Gets the id of this Category. + + :return: The id of this Category. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Category. + + :param id: The id of this Category. + :type: int + """ + + self._id = id + + @property + def name(self): + """ + Gets the name of this Category. + + :return: The name of this Category. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Category. + + :param name: The name of this Category. + :type: str + """ + + self._name = name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Category): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/class_model.py b/samples/client/petstore/python-asyncio/petstore_api/models/class_model.py new file mode 100644 index 00000000000..7b39d38abe9 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/class_model.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ClassModel(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_class': 'str' + } + + attribute_map = { + '_class': '_class' + } + + def __init__(self, _class=None): + """ + ClassModel - a model defined in Swagger + """ + + self.__class = None + self.discriminator = None + + if _class is not None: + self._class = _class + + @property + def _class(self): + """ + Gets the _class of this ClassModel. + + :return: The _class of this ClassModel. + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """ + Sets the _class of this ClassModel. + + :param _class: The _class of this ClassModel. + :type: str + """ + + self.__class = _class + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ClassModel): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/client.py b/samples/client/petstore/python-asyncio/petstore_api/models/client.py new file mode 100644 index 00000000000..395f77913cc --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/client.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Client(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client': 'str' + } + + attribute_map = { + 'client': 'client' + } + + def __init__(self, client=None): + """ + Client - a model defined in Swagger + """ + + self._client = None + self.discriminator = None + + if client is not None: + self.client = client + + @property + def client(self): + """ + Gets the client of this Client. + + :return: The client of this Client. + :rtype: str + """ + return self._client + + @client.setter + def client(self, client): + """ + Sets the client of this Client. + + :param client: The client of this Client. + :type: str + """ + + self._client = client + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Client): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/dog.py b/samples/client/petstore/python-asyncio/petstore_api/models/dog.py new file mode 100644 index 00000000000..3c159ad0d6f --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/dog.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Dog(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'breed': 'str' + } + + attribute_map = { + 'breed': 'breed' + } + + def __init__(self, breed=None): + """ + Dog - a model defined in Swagger + """ + + self._breed = None + self.discriminator = None + + if breed is not None: + self.breed = breed + + @property + def breed(self): + """ + Gets the breed of this Dog. + + :return: The breed of this Dog. + :rtype: str + """ + return self._breed + + @breed.setter + def breed(self, breed): + """ + Sets the breed of this Dog. + + :param breed: The breed of this Dog. + :type: str + """ + + self._breed = breed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Dog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-asyncio/petstore_api/models/enum_arrays.py new file mode 100644 index 00000000000..893085ea235 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/enum_arrays.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumArrays(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'just_symbol': 'str', + 'array_enum': 'list[str]' + } + + attribute_map = { + 'just_symbol': 'just_symbol', + 'array_enum': 'array_enum' + } + + def __init__(self, just_symbol=None, array_enum=None): + """ + EnumArrays - a model defined in Swagger + """ + + self._just_symbol = None + self._array_enum = None + self.discriminator = None + + if just_symbol is not None: + self.just_symbol = just_symbol + if array_enum is not None: + self.array_enum = array_enum + + @property + def just_symbol(self): + """ + Gets the just_symbol of this EnumArrays. + + :return: The just_symbol of this EnumArrays. + :rtype: str + """ + return self._just_symbol + + @just_symbol.setter + def just_symbol(self, just_symbol): + """ + Sets the just_symbol of this EnumArrays. + + :param just_symbol: The just_symbol of this EnumArrays. + :type: str + """ + allowed_values = [">=", "$"] + if just_symbol not in allowed_values: + raise ValueError( + "Invalid value for `just_symbol` ({0}), must be one of {1}" + .format(just_symbol, allowed_values) + ) + + self._just_symbol = just_symbol + + @property + def array_enum(self): + """ + Gets the array_enum of this EnumArrays. + + :return: The array_enum of this EnumArrays. + :rtype: list[str] + """ + return self._array_enum + + @array_enum.setter + def array_enum(self, array_enum): + """ + Sets the array_enum of this EnumArrays. + + :param array_enum: The array_enum of this EnumArrays. + :type: list[str] + """ + allowed_values = ["fish", "crab"] + if not set(array_enum).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `array_enum` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set(array_enum)-set(allowed_values))), + ", ".join(map(str, allowed_values))) + ) + + self._array_enum = array_enum + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumArrays): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/enum_class.py b/samples/client/petstore/python-asyncio/petstore_api/models/enum_class.py new file mode 100644 index 00000000000..d9e0b771a7d --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/enum_class.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + """ + allowed enum values + """ + _ABC = "_abc" + _EFG = "-efg" + _XYZ_ = "(xyz)" + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + EnumClass - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py new file mode 100644 index 00000000000..6d7caa1f4bc --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/enum_test.py @@ -0,0 +1,220 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enum_string': 'str', + 'enum_integer': 'int', + 'enum_number': 'float', + 'outer_enum': 'OuterEnum' + } + + attribute_map = { + 'enum_string': 'enum_string', + 'enum_integer': 'enum_integer', + 'enum_number': 'enum_number', + 'outer_enum': 'outerEnum' + } + + def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): + """ + EnumTest - a model defined in Swagger + """ + + self._enum_string = None + self._enum_integer = None + self._enum_number = None + self._outer_enum = None + self.discriminator = None + + if enum_string is not None: + self.enum_string = enum_string + if enum_integer is not None: + self.enum_integer = enum_integer + if enum_number is not None: + self.enum_number = enum_number + if outer_enum is not None: + self.outer_enum = outer_enum + + @property + def enum_string(self): + """ + Gets the enum_string of this EnumTest. + + :return: The enum_string of this EnumTest. + :rtype: str + """ + return self._enum_string + + @enum_string.setter + def enum_string(self, enum_string): + """ + Sets the enum_string of this EnumTest. + + :param enum_string: The enum_string of this EnumTest. + :type: str + """ + allowed_values = ["UPPER", "lower", ""] + if enum_string not in allowed_values: + raise ValueError( + "Invalid value for `enum_string` ({0}), must be one of {1}" + .format(enum_string, allowed_values) + ) + + self._enum_string = enum_string + + @property + def enum_integer(self): + """ + Gets the enum_integer of this EnumTest. + + :return: The enum_integer of this EnumTest. + :rtype: int + """ + return self._enum_integer + + @enum_integer.setter + def enum_integer(self, enum_integer): + """ + Sets the enum_integer of this EnumTest. + + :param enum_integer: The enum_integer of this EnumTest. + :type: int + """ + allowed_values = [1, -1] + if enum_integer not in allowed_values: + raise ValueError( + "Invalid value for `enum_integer` ({0}), must be one of {1}" + .format(enum_integer, allowed_values) + ) + + self._enum_integer = enum_integer + + @property + def enum_number(self): + """ + Gets the enum_number of this EnumTest. + + :return: The enum_number of this EnumTest. + :rtype: float + """ + return self._enum_number + + @enum_number.setter + def enum_number(self, enum_number): + """ + Sets the enum_number of this EnumTest. + + :param enum_number: The enum_number of this EnumTest. + :type: float + """ + allowed_values = [1.1, -1.2] + if enum_number not in allowed_values: + raise ValueError( + "Invalid value for `enum_number` ({0}), must be one of {1}" + .format(enum_number, allowed_values) + ) + + self._enum_number = enum_number + + @property + def outer_enum(self): + """ + Gets the outer_enum of this EnumTest. + + :return: The outer_enum of this EnumTest. + :rtype: OuterEnum + """ + return self._outer_enum + + @outer_enum.setter + def outer_enum(self, outer_enum): + """ + Sets the outer_enum of this EnumTest. + + :param outer_enum: The outer_enum of this EnumTest. + :type: OuterEnum + """ + + self._outer_enum = outer_enum + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/format_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/format_test.py new file mode 100644 index 00000000000..139d1733b35 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/format_test.py @@ -0,0 +1,468 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class FormatTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'integer': 'int', + 'int32': 'int', + 'int64': 'int', + 'number': 'float', + 'float': 'float', + 'double': 'float', + 'string': 'str', + 'byte': 'str', + 'binary': 'str', + 'date': 'date', + 'date_time': 'datetime', + 'uuid': 'str', + 'password': 'str' + } + + attribute_map = { + 'integer': 'integer', + 'int32': 'int32', + 'int64': 'int64', + 'number': 'number', + 'float': 'float', + 'double': 'double', + 'string': 'string', + 'byte': 'byte', + 'binary': 'binary', + 'date': 'date', + 'date_time': 'dateTime', + 'uuid': 'uuid', + 'password': 'password' + } + + def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): + """ + FormatTest - a model defined in Swagger + """ + + self._integer = None + self._int32 = None + self._int64 = None + self._number = None + self._float = None + self._double = None + self._string = None + self._byte = None + self._binary = None + self._date = None + self._date_time = None + self._uuid = None + self._password = None + self.discriminator = None + + if integer is not None: + self.integer = integer + if int32 is not None: + self.int32 = int32 + if int64 is not None: + self.int64 = int64 + self.number = number + if float is not None: + self.float = float + if double is not None: + self.double = double + if string is not None: + self.string = string + self.byte = byte + if binary is not None: + self.binary = binary + self.date = date + if date_time is not None: + self.date_time = date_time + if uuid is not None: + self.uuid = uuid + self.password = password + + @property + def integer(self): + """ + Gets the integer of this FormatTest. + + :return: The integer of this FormatTest. + :rtype: int + """ + return self._integer + + @integer.setter + def integer(self, integer): + """ + Sets the integer of this FormatTest. + + :param integer: The integer of this FormatTest. + :type: int + """ + if integer is not None and integer > 100: + raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") + if integer is not None and integer < 10: + raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") + + self._integer = integer + + @property + def int32(self): + """ + Gets the int32 of this FormatTest. + + :return: The int32 of this FormatTest. + :rtype: int + """ + return self._int32 + + @int32.setter + def int32(self, int32): + """ + Sets the int32 of this FormatTest. + + :param int32: The int32 of this FormatTest. + :type: int + """ + if int32 is not None and int32 > 200: + raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") + if int32 is not None and int32 < 20: + raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") + + self._int32 = int32 + + @property + def int64(self): + """ + Gets the int64 of this FormatTest. + + :return: The int64 of this FormatTest. + :rtype: int + """ + return self._int64 + + @int64.setter + def int64(self, int64): + """ + Sets the int64 of this FormatTest. + + :param int64: The int64 of this FormatTest. + :type: int + """ + + self._int64 = int64 + + @property + def number(self): + """ + Gets the number of this FormatTest. + + :return: The number of this FormatTest. + :rtype: float + """ + return self._number + + @number.setter + def number(self, number): + """ + Sets the number of this FormatTest. + + :param number: The number of this FormatTest. + :type: float + """ + if number is None: + raise ValueError("Invalid value for `number`, must not be `None`") + if number is not None and number > 543.2: + raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") + if number is not None and number < 32.1: + raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") + + self._number = number + + @property + def float(self): + """ + Gets the float of this FormatTest. + + :return: The float of this FormatTest. + :rtype: float + """ + return self._float + + @float.setter + def float(self, float): + """ + Sets the float of this FormatTest. + + :param float: The float of this FormatTest. + :type: float + """ + if float is not None and float > 987.6: + raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") + if float is not None and float < 54.3: + raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") + + self._float = float + + @property + def double(self): + """ + Gets the double of this FormatTest. + + :return: The double of this FormatTest. + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """ + Sets the double of this FormatTest. + + :param double: The double of this FormatTest. + :type: float + """ + if double is not None and double > 123.4: + raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") + if double is not None and double < 67.8: + raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") + + self._double = double + + @property + def string(self): + """ + Gets the string of this FormatTest. + + :return: The string of this FormatTest. + :rtype: str + """ + return self._string + + @string.setter + def string(self, string): + """ + Sets the string of this FormatTest. + + :param string: The string of this FormatTest. + :type: str + """ + if string is not None and not re.search('[a-z]', string, flags=re.IGNORECASE): + raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") + + self._string = string + + @property + def byte(self): + """ + Gets the byte of this FormatTest. + + :return: The byte of this FormatTest. + :rtype: str + """ + return self._byte + + @byte.setter + def byte(self, byte): + """ + Sets the byte of this FormatTest. + + :param byte: The byte of this FormatTest. + :type: str + """ + if byte is None: + raise ValueError("Invalid value for `byte`, must not be `None`") + if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): + raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") + + self._byte = byte + + @property + def binary(self): + """ + Gets the binary of this FormatTest. + + :return: The binary of this FormatTest. + :rtype: str + """ + return self._binary + + @binary.setter + def binary(self, binary): + """ + Sets the binary of this FormatTest. + + :param binary: The binary of this FormatTest. + :type: str + """ + + self._binary = binary + + @property + def date(self): + """ + Gets the date of this FormatTest. + + :return: The date of this FormatTest. + :rtype: date + """ + return self._date + + @date.setter + def date(self, date): + """ + Sets the date of this FormatTest. + + :param date: The date of this FormatTest. + :type: date + """ + if date is None: + raise ValueError("Invalid value for `date`, must not be `None`") + + self._date = date + + @property + def date_time(self): + """ + Gets the date_time of this FormatTest. + + :return: The date_time of this FormatTest. + :rtype: datetime + """ + return self._date_time + + @date_time.setter + def date_time(self, date_time): + """ + Sets the date_time of this FormatTest. + + :param date_time: The date_time of this FormatTest. + :type: datetime + """ + + self._date_time = date_time + + @property + def uuid(self): + """ + Gets the uuid of this FormatTest. + + :return: The uuid of this FormatTest. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this FormatTest. + + :param uuid: The uuid of this FormatTest. + :type: str + """ + + self._uuid = uuid + + @property + def password(self): + """ + Gets the password of this FormatTest. + + :return: The password of this FormatTest. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """ + Sets the password of this FormatTest. + + :param password: The password of this FormatTest. + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") + if password is not None and len(password) > 64: + raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") + if password is not None and len(password) < 10: + raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") + + self._password = password + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, FormatTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-asyncio/petstore_api/models/has_only_read_only.py new file mode 100644 index 00000000000..da0c14ec5b1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/has_only_read_only.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class HasOnlyReadOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bar': 'str', + 'foo': 'str' + } + + attribute_map = { + 'bar': 'bar', + 'foo': 'foo' + } + + def __init__(self, bar=None, foo=None): + """ + HasOnlyReadOnly - a model defined in Swagger + """ + + self._bar = None + self._foo = None + self.discriminator = None + + if bar is not None: + self.bar = bar + if foo is not None: + self.foo = foo + + @property + def bar(self): + """ + Gets the bar of this HasOnlyReadOnly. + + :return: The bar of this HasOnlyReadOnly. + :rtype: str + """ + return self._bar + + @bar.setter + def bar(self, bar): + """ + Sets the bar of this HasOnlyReadOnly. + + :param bar: The bar of this HasOnlyReadOnly. + :type: str + """ + + self._bar = bar + + @property + def foo(self): + """ + Gets the foo of this HasOnlyReadOnly. + + :return: The foo of this HasOnlyReadOnly. + :rtype: str + """ + return self._foo + + @foo.setter + def foo(self, foo): + """ + Sets the foo of this HasOnlyReadOnly. + + :param foo: The foo of this HasOnlyReadOnly. + :type: str + """ + + self._foo = foo + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, HasOnlyReadOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/list.py b/samples/client/petstore/python-asyncio/petstore_api/models/list.py new file mode 100644 index 00000000000..2ac0e51fb12 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/list.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class List(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_123_list': 'str' + } + + attribute_map = { + '_123_list': '123-list' + } + + def __init__(self, _123_list=None): + """ + List - a model defined in Swagger + """ + + self.__123_list = None + self.discriminator = None + + if _123_list is not None: + self._123_list = _123_list + + @property + def _123_list(self): + """ + Gets the _123_list of this List. + + :return: The _123_list of this List. + :rtype: str + """ + return self.__123_list + + @_123_list.setter + def _123_list(self, _123_list): + """ + Sets the _123_list of this List. + + :param _123_list: The _123_list of this List. + :type: str + """ + + self.__123_list = _123_list + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, List): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py new file mode 100644 index 00000000000..3cb936e0db8 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class MapTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'map_map_of_string': 'dict(str, dict(str, str))', + 'map_of_enum_string': 'dict(str, str)' + } + + attribute_map = { + 'map_map_of_string': 'map_map_of_string', + 'map_of_enum_string': 'map_of_enum_string' + } + + def __init__(self, map_map_of_string=None, map_of_enum_string=None): + """ + MapTest - a model defined in Swagger + """ + + self._map_map_of_string = None + self._map_of_enum_string = None + self.discriminator = None + + if map_map_of_string is not None: + self.map_map_of_string = map_map_of_string + if map_of_enum_string is not None: + self.map_of_enum_string = map_of_enum_string + + @property + def map_map_of_string(self): + """ + Gets the map_map_of_string of this MapTest. + + :return: The map_map_of_string of this MapTest. + :rtype: dict(str, dict(str, str)) + """ + return self._map_map_of_string + + @map_map_of_string.setter + def map_map_of_string(self, map_map_of_string): + """ + Sets the map_map_of_string of this MapTest. + + :param map_map_of_string: The map_map_of_string of this MapTest. + :type: dict(str, dict(str, str)) + """ + + self._map_map_of_string = map_map_of_string + + @property + def map_of_enum_string(self): + """ + Gets the map_of_enum_string of this MapTest. + + :return: The map_of_enum_string of this MapTest. + :rtype: dict(str, str) + """ + return self._map_of_enum_string + + @map_of_enum_string.setter + def map_of_enum_string(self, map_of_enum_string): + """ + Sets the map_of_enum_string of this MapTest. + + :param map_of_enum_string: The map_of_enum_string of this MapTest. + :type: dict(str, str) + """ + allowed_values = ["UPPER", "lower"] + if not set(map_of_enum_string.keys()).issubset(set(allowed_values)): + raise ValueError( + "Invalid keys in `map_of_enum_string` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set(map_of_enum_string.keys())-set(allowed_values))), + ", ".join(map(str, allowed_values))) + ) + + self._map_of_enum_string = map_of_enum_string + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, MapTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..4b773deacef --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class MixedPropertiesAndAdditionalPropertiesClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'uuid': 'str', + 'date_time': 'datetime', + 'map': 'dict(str, Animal)' + } + + attribute_map = { + 'uuid': 'uuid', + 'date_time': 'dateTime', + 'map': 'map' + } + + def __init__(self, uuid=None, date_time=None, map=None): + """ + MixedPropertiesAndAdditionalPropertiesClass - a model defined in Swagger + """ + + self._uuid = None + self._date_time = None + self._map = None + self.discriminator = None + + if uuid is not None: + self.uuid = uuid + if date_time is not None: + self.date_time = date_time + if map is not None: + self.map = map + + @property + def uuid(self): + """ + Gets the uuid of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The uuid of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this MixedPropertiesAndAdditionalPropertiesClass. + + :param uuid: The uuid of this MixedPropertiesAndAdditionalPropertiesClass. + :type: str + """ + + self._uuid = uuid + + @property + def date_time(self): + """ + Gets the date_time of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The date_time of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: datetime + """ + return self._date_time + + @date_time.setter + def date_time(self, date_time): + """ + Sets the date_time of this MixedPropertiesAndAdditionalPropertiesClass. + + :param date_time: The date_time of this MixedPropertiesAndAdditionalPropertiesClass. + :type: datetime + """ + + self._date_time = date_time + + @property + def map(self): + """ + Gets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: dict(str, Animal) + """ + return self._map + + @map.setter + def map(self, map): + """ + Sets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + :param map: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :type: dict(str, Animal) + """ + + self._map = map + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, MixedPropertiesAndAdditionalPropertiesClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/model_200_response.py b/samples/client/petstore/python-asyncio/petstore_api/models/model_200_response.py new file mode 100644 index 00000000000..2b6aeb090c0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/model_200_response.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Model200Response(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + '_class': 'str' + } + + attribute_map = { + 'name': 'name', + '_class': 'class' + } + + def __init__(self, name=None, _class=None): + """ + Model200Response - a model defined in Swagger + """ + + self._name = None + self.__class = None + self.discriminator = None + + if name is not None: + self.name = name + if _class is not None: + self._class = _class + + @property + def name(self): + """ + Gets the name of this Model200Response. + + :return: The name of this Model200Response. + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Model200Response. + + :param name: The name of this Model200Response. + :type: int + """ + + self._name = name + + @property + def _class(self): + """ + Gets the _class of this Model200Response. + + :return: The _class of this Model200Response. + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """ + Sets the _class of this Model200Response. + + :param _class: The _class of this Model200Response. + :type: str + """ + + self.__class = _class + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Model200Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/model_return.py b/samples/client/petstore/python-asyncio/petstore_api/models/model_return.py new file mode 100644 index 00000000000..a2160d21dd1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/model_return.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ModelReturn(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_return': 'int' + } + + attribute_map = { + '_return': 'return' + } + + def __init__(self, _return=None): + """ + ModelReturn - a model defined in Swagger + """ + + self.__return = None + self.discriminator = None + + if _return is not None: + self._return = _return + + @property + def _return(self): + """ + Gets the _return of this ModelReturn. + + :return: The _return of this ModelReturn. + :rtype: int + """ + return self.__return + + @_return.setter + def _return(self, _return): + """ + Sets the _return of this ModelReturn. + + :param _return: The _return of this ModelReturn. + :type: int + """ + + self.__return = _return + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ModelReturn): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/name.py b/samples/client/petstore/python-asyncio/petstore_api/models/name.py new file mode 100644 index 00000000000..52b51890dde --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/name.py @@ -0,0 +1,203 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Name(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + 'snake_case': 'int', + '_property': 'str', + '_123_number': 'int' + } + + attribute_map = { + 'name': 'name', + 'snake_case': 'snake_case', + '_property': 'property', + '_123_number': '123Number' + } + + def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): + """ + Name - a model defined in Swagger + """ + + self._name = None + self._snake_case = None + self.__property = None + self.__123_number = None + self.discriminator = None + + self.name = name + if snake_case is not None: + self.snake_case = snake_case + if _property is not None: + self._property = _property + if _123_number is not None: + self._123_number = _123_number + + @property + def name(self): + """ + Gets the name of this Name. + + :return: The name of this Name. + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Name. + + :param name: The name of this Name. + :type: int + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + + 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 + + @property + def _property(self): + """ + Gets the _property of this Name. + + :return: The _property of this Name. + :rtype: str + """ + return self.__property + + @_property.setter + def _property(self, _property): + """ + Sets the _property of this Name. + + :param _property: The _property of this Name. + :type: str + """ + + self.__property = _property + + @property + def _123_number(self): + """ + Gets the _123_number of this Name. + + :return: The _123_number of this Name. + :rtype: int + """ + return self.__123_number + + @_123_number.setter + def _123_number(self, _123_number): + """ + Sets the _123_number of this Name. + + :param _123_number: The _123_number of this Name. + :type: int + """ + + self.__123_number = _123_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Name): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/number_only.py b/samples/client/petstore/python-asyncio/petstore_api/models/number_only.py new file mode 100644 index 00000000000..b0e279b53a5 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class NumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'just_number': 'float' + } + + attribute_map = { + 'just_number': 'JustNumber' + } + + def __init__(self, just_number=None): + """ + NumberOnly - a model defined in Swagger + """ + + self._just_number = None + self.discriminator = None + + if just_number is not None: + self.just_number = just_number + + @property + def just_number(self): + """ + Gets the just_number of this NumberOnly. + + :return: The just_number of this NumberOnly. + :rtype: float + """ + return self._just_number + + @just_number.setter + def just_number(self, just_number): + """ + Sets the just_number of this NumberOnly. + + :param just_number: The just_number of this NumberOnly. + :type: float + """ + + self._just_number = just_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, NumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/order.py b/samples/client/petstore/python-asyncio/petstore_api/models/order.py new file mode 100644 index 00000000000..52c7b6c227e --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/order.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Order(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'pet_id': 'int', + 'quantity': 'int', + 'ship_date': 'datetime', + 'status': 'str', + 'complete': 'bool' + } + + attribute_map = { + 'id': 'id', + 'pet_id': 'petId', + 'quantity': 'quantity', + 'ship_date': 'shipDate', + 'status': 'status', + 'complete': 'complete' + } + + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): + """ + Order - a model defined in Swagger + """ + + self._id = None + self._pet_id = None + self._quantity = None + self._ship_date = None + self._status = None + self._complete = None + self.discriminator = None + + if id is not None: + self.id = id + if pet_id is not None: + self.pet_id = pet_id + if quantity is not None: + self.quantity = quantity + if ship_date is not None: + self.ship_date = ship_date + if status is not None: + self.status = status + if complete is not None: + self.complete = complete + + @property + def id(self): + """ + Gets the id of this Order. + + :return: The id of this Order. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Order. + + :param id: The id of this Order. + :type: int + """ + + self._id = id + + @property + def pet_id(self): + """ + Gets the pet_id of this Order. + + :return: The pet_id of this Order. + :rtype: int + """ + return self._pet_id + + @pet_id.setter + def pet_id(self, pet_id): + """ + Sets the pet_id of this Order. + + :param pet_id: The pet_id of this Order. + :type: int + """ + + self._pet_id = pet_id + + @property + def quantity(self): + """ + Gets the quantity of this Order. + + :return: The quantity of this Order. + :rtype: int + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """ + Sets the quantity of this Order. + + :param quantity: The quantity of this Order. + :type: int + """ + + self._quantity = quantity + + @property + def ship_date(self): + """ + Gets the ship_date of this Order. + + :return: The ship_date of this Order. + :rtype: datetime + """ + return self._ship_date + + @ship_date.setter + def ship_date(self, ship_date): + """ + Sets the ship_date of this Order. + + :param ship_date: The ship_date of this Order. + :type: datetime + """ + + self._ship_date = ship_date + + @property + def status(self): + """ + Gets the status of this Order. + Order Status + + :return: The status of this Order. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """ + Sets the status of this Order. + Order Status + + :param status: The status of this Order. + :type: str + """ + allowed_values = ["placed", "approved", "delivered"] + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + @property + def complete(self): + """ + Gets the complete of this Order. + + :return: The complete of this Order. + :rtype: bool + """ + return self._complete + + @complete.setter + def complete(self, complete): + """ + Sets the complete of this Order. + + :param complete: The complete of this Order. + :type: bool + """ + + self._complete = complete + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Order): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_boolean.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_boolean.py new file mode 100644 index 00000000000..aa9aee11973 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_boolean.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterBoolean(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterBoolean - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterBoolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py new file mode 100644 index 00000000000..81611c17688 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_composite.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterComposite(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'my_number': 'OuterNumber', + 'my_string': 'OuterString', + 'my_boolean': 'OuterBoolean' + } + + attribute_map = { + 'my_number': 'my_number', + 'my_string': 'my_string', + 'my_boolean': 'my_boolean' + } + + def __init__(self, my_number=None, my_string=None, my_boolean=None): + """ + OuterComposite - a model defined in Swagger + """ + + self._my_number = None + self._my_string = None + self._my_boolean = None + self.discriminator = None + + if my_number is not None: + self.my_number = my_number + if my_string is not None: + self.my_string = my_string + if my_boolean is not None: + self.my_boolean = my_boolean + + @property + def my_number(self): + """ + Gets the my_number of this OuterComposite. + + :return: The my_number of this OuterComposite. + :rtype: OuterNumber + """ + return self._my_number + + @my_number.setter + def my_number(self, my_number): + """ + Sets the my_number of this OuterComposite. + + :param my_number: The my_number of this OuterComposite. + :type: OuterNumber + """ + + self._my_number = my_number + + @property + def my_string(self): + """ + Gets the my_string of this OuterComposite. + + :return: The my_string of this OuterComposite. + :rtype: OuterString + """ + return self._my_string + + @my_string.setter + def my_string(self, my_string): + """ + Sets the my_string of this OuterComposite. + + :param my_string: The my_string of this OuterComposite. + :type: OuterString + """ + + self._my_string = my_string + + @property + def my_boolean(self): + """ + Gets the my_boolean of this OuterComposite. + + :return: The my_boolean of this OuterComposite. + :rtype: OuterBoolean + """ + return self._my_boolean + + @my_boolean.setter + def my_boolean(self, my_boolean): + """ + Sets the my_boolean of this OuterComposite. + + :param my_boolean: The my_boolean of this OuterComposite. + :type: OuterBoolean + """ + + self._my_boolean = my_boolean + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterComposite): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_enum.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_enum.py new file mode 100644 index 00000000000..8772472c655 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_enum.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterEnum(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + """ + allowed enum values + """ + PLACED = "placed" + APPROVED = "approved" + DELIVERED = "delivered" + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterEnum - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterEnum): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_number.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_number.py new file mode 100644 index 00000000000..04c44923fb0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_number.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterNumber(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterNumber - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterNumber): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/outer_string.py b/samples/client/petstore/python-asyncio/petstore_api/models/outer_string.py new file mode 100644 index 00000000000..fd2d7c7623e --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/outer_string.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterString(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterString - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterString): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/pet.py b/samples/client/petstore/python-asyncio/petstore_api/models/pet.py new file mode 100644 index 00000000000..e1afa26f785 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/pet.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Pet(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'category': 'Category', + 'name': 'str', + 'photo_urls': 'list[str]', + 'tags': 'list[Tag]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'category': 'category', + 'name': 'name', + 'photo_urls': 'photoUrls', + 'tags': 'tags', + 'status': 'status' + } + + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): + """ + Pet - a model defined in Swagger + """ + + self._id = None + self._category = None + self._name = None + self._photo_urls = None + self._tags = None + self._status = None + self.discriminator = None + + if id is not None: + self.id = id + if category is not None: + self.category = category + self.name = name + self.photo_urls = photo_urls + if tags is not None: + self.tags = tags + if status is not None: + self.status = status + + @property + def id(self): + """ + Gets the id of this Pet. + + :return: The id of this Pet. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Pet. + + :param id: The id of this Pet. + :type: int + """ + + self._id = id + + @property + def category(self): + """ + Gets the category of this Pet. + + :return: The category of this Pet. + :rtype: Category + """ + return self._category + + @category.setter + def category(self, category): + """ + Sets the category of this Pet. + + :param category: The category of this Pet. + :type: Category + """ + + self._category = category + + @property + def name(self): + """ + Gets the name of this Pet. + + :return: The name of this Pet. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Pet. + + :param name: The name of this Pet. + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + + self._name = name + + @property + def photo_urls(self): + """ + Gets the photo_urls of this Pet. + + :return: The photo_urls of this Pet. + :rtype: list[str] + """ + return self._photo_urls + + @photo_urls.setter + def photo_urls(self, photo_urls): + """ + Sets the photo_urls of this Pet. + + :param photo_urls: The photo_urls of this Pet. + :type: list[str] + """ + if photo_urls is None: + raise ValueError("Invalid value for `photo_urls`, must not be `None`") + + self._photo_urls = photo_urls + + @property + def tags(self): + """ + Gets the tags of this Pet. + + :return: The tags of this Pet. + :rtype: list[Tag] + """ + return self._tags + + @tags.setter + def tags(self, tags): + """ + Sets the tags of this Pet. + + :param tags: The tags of this Pet. + :type: list[Tag] + """ + + self._tags = tags + + @property + def status(self): + """ + Gets the status of this Pet. + pet status in the store + + :return: The status of this Pet. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """ + Sets the status of this Pet. + pet status in the store + + :param status: The status of this Pet. + :type: str + """ + allowed_values = ["available", "pending", "sold"] + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Pet): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/read_only_first.py b/samples/client/petstore/python-asyncio/petstore_api/models/read_only_first.py new file mode 100644 index 00000000000..a26d1f33c87 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/read_only_first.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ReadOnlyFirst(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bar': 'str', + 'baz': 'str' + } + + attribute_map = { + 'bar': 'bar', + 'baz': 'baz' + } + + def __init__(self, bar=None, baz=None): + """ + ReadOnlyFirst - a model defined in Swagger + """ + + self._bar = None + self._baz = None + self.discriminator = None + + if bar is not None: + self.bar = bar + if baz is not None: + self.baz = baz + + @property + def bar(self): + """ + Gets the bar of this ReadOnlyFirst. + + :return: The bar of this ReadOnlyFirst. + :rtype: str + """ + return self._bar + + @bar.setter + def bar(self, bar): + """ + Sets the bar of this ReadOnlyFirst. + + :param bar: The bar of this ReadOnlyFirst. + :type: str + """ + + self._bar = bar + + @property + def baz(self): + """ + Gets the baz of this ReadOnlyFirst. + + :return: The baz of this ReadOnlyFirst. + :rtype: str + """ + return self._baz + + @baz.setter + def baz(self, baz): + """ + Sets the baz of this ReadOnlyFirst. + + :param baz: The baz of this ReadOnlyFirst. + :type: str + """ + + self._baz = baz + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ReadOnlyFirst): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/special_model_name.py b/samples/client/petstore/python-asyncio/petstore_api/models/special_model_name.py new file mode 100644 index 00000000000..6be888fb9e3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/special_model_name.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class SpecialModelName(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'special_property_name': 'int' + } + + attribute_map = { + 'special_property_name': '$special[property.name]' + } + + def __init__(self, special_property_name=None): + """ + SpecialModelName - a model defined in Swagger + """ + + self._special_property_name = None + self.discriminator = None + + if special_property_name is not None: + self.special_property_name = special_property_name + + @property + def special_property_name(self): + """ + Gets the special_property_name of this SpecialModelName. + + :return: The special_property_name of this SpecialModelName. + :rtype: int + """ + return self._special_property_name + + @special_property_name.setter + def special_property_name(self, special_property_name): + """ + Sets the special_property_name of this SpecialModelName. + + :param special_property_name: The special_property_name of this SpecialModelName. + :type: int + """ + + self._special_property_name = special_property_name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, SpecialModelName): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/tag.py b/samples/client/petstore/python-asyncio/petstore_api/models/tag.py new file mode 100644 index 00000000000..d59a490a07d --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/tag.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Tag(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): + """ + Tag - a model defined in Swagger + """ + + self._id = None + self._name = None + self.discriminator = None + + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """ + Gets the id of this Tag. + + :return: The id of this Tag. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Tag. + + :param id: The id of this Tag. + :type: int + """ + + self._id = id + + @property + def name(self): + """ + Gets the name of this Tag. + + :return: The name of this Tag. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Tag. + + :param name: The name of this Tag. + :type: str + """ + + self._name = name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Tag): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/user.py b/samples/client/petstore/python-asyncio/petstore_api/models/user.py new file mode 100644 index 00000000000..21993e90521 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/user.py @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class User(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'username': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'phone': 'str', + 'user_status': 'int' + } + + attribute_map = { + 'id': 'id', + 'username': 'username', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'phone': 'phone', + 'user_status': 'userStatus' + } + + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): + """ + User - a model defined in Swagger + """ + + self._id = None + self._username = None + self._first_name = None + self._last_name = None + self._email = None + self._password = None + self._phone = None + self._user_status = None + self.discriminator = None + + if id is not None: + self.id = id + if username is not None: + self.username = username + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if email is not None: + self.email = email + if password is not None: + self.password = password + if phone is not None: + self.phone = phone + if user_status is not None: + self.user_status = user_status + + @property + def id(self): + """ + Gets the id of this User. + + :return: The id of this User. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this User. + + :param id: The id of this User. + :type: int + """ + + self._id = id + + @property + def username(self): + """ + Gets the username of this User. + + :return: The username of this User. + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """ + Sets the username of this User. + + :param username: The username of this User. + :type: str + """ + + self._username = username + + @property + def first_name(self): + """ + Gets the first_name of this User. + + :return: The first_name of this User. + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """ + Sets the first_name of this User. + + :param first_name: The first_name of this User. + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """ + Gets the last_name of this User. + + :return: The last_name of this User. + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """ + Sets the last_name of this User. + + :param last_name: The last_name of this User. + :type: str + """ + + self._last_name = last_name + + @property + def email(self): + """ + Gets the email of this User. + + :return: The email of this User. + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """ + Sets the email of this User. + + :param email: The email of this User. + :type: str + """ + + self._email = email + + @property + def password(self): + """ + Gets the password of this User. + + :return: The password of this User. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """ + Sets the password of this User. + + :param password: The password of this User. + :type: str + """ + + self._password = password + + @property + def phone(self): + """ + Gets the phone of this User. + + :return: The phone of this User. + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """ + Sets the phone of this User. + + :param phone: The phone of this User. + :type: str + """ + + self._phone = phone + + @property + def user_status(self): + """ + Gets the user_status of this User. + User Status + + :return: The user_status of this User. + :rtype: int + """ + return self._user_status + + @user_status.setter + def user_status(self, user_status): + """ + Sets the user_status of this User. + User Status + + :param user_status: The user_status of this User. + :type: int + """ + + self._user_status = user_status + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-asyncio/petstore_api/rest.py b/samples/client/petstore/python-asyncio/petstore_api/rest.py new file mode 100644 index 00000000000..8cb130e035b --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/rest.py @@ -0,0 +1,251 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import aiohttp +import io +import json +import ssl +import certifi +import logging +import re + +# python 2 and python 3 compatibility library +from six import PY3 +from six.moves.urllib.parse import urlencode + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp, data): + self.aiohttp_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = data + + def getheaders(self): + """ + Returns a CIMultiDictProxy of the response headers. + """ + return self.aiohttp_response.headers + + def getheader(self, name, default=None): + """ + Returns a given response header. + """ + return self.aiohttp_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=4): + # maxsize is the number of requests to host that are allowed in parallel + # ca_certs vs cert_file vs key_file + # http://stackoverflow.com/a/23957365/2985775 + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + ssl_context = ssl.SSLContext() + if configuration.cert_file: + ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + connector = aiohttp.TCPConnector( + limit=maxsize, + verify_ssl=configuration.verify_ssl + ) + + # https pool manager + if configuration.proxy: + self.pool_manager = aiohttp.ClientSession( + connector=connector, + proxy=configuration.proxy + ) + else: + self.pool_manager = aiohttp.ClientSession( + connector=connector + ) + + async def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, _request_timeout=None): + """ + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: this is a non-applicable field for the AiohttpClient. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + body = json.dumps(body) + args["data"] = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': + data = aiohttp.FormData() + for k, v in post_params.items(): + data.add_field(k, v) + args["data"] = data + elif headers['Content-Type'] == 'multipart/form-data': + args["data"] = post_params + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided arguments. + Please check that your arguments match declared content type.""" + raise ApiException(status=0, reason=msg) + else: + args["data"] = query_params + + async with self.pool_manager.request(**args) as r: + data = await r.text() + r = RESTResponse(r, data) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + async def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + return (await self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + return (await self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None): + return (await self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def POST(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def PUT(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def PATCH(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """ + Custom error messages for exception + """ + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format(self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/samples/client/petstore/python-asyncio/requirements.txt b/samples/client/petstore/python-asyncio/requirements.txt new file mode 100644 index 00000000000..bafdc07532f --- /dev/null +++ b/samples/client/petstore/python-asyncio/requirements.txt @@ -0,0 +1,5 @@ +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.15.1 diff --git a/samples/client/petstore/python-asyncio/setup.py b/samples/client/petstore/python-asyncio/setup.py new file mode 100644 index 00000000000..b04ac0abe10 --- /dev/null +++ b/samples/client/petstore/python-asyncio/setup.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import sys +from setuptools import setup, find_packages + +NAME = "petstore-api" +VERSION = "1.0.0" +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] +REQUIRES.append("aiohttp") + +setup( + name=NAME, + version=VERSION, + description="Swagger Petstore", + author_email="apiteam@swagger.io", + url="", + keywords=["Swagger", "Swagger Petstore"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + """ +) diff --git a/samples/client/petstore/python-asyncio/test-requirements.txt b/samples/client/petstore/python-asyncio/test-requirements.txt new file mode 100644 index 00000000000..2702246c0e6 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/samples/client/petstore/python-asyncio/test/__init__.py b/samples/client/petstore/python-asyncio/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/python-asyncio/test/test_additional_properties_class.py b/samples/client/petstore/python-asyncio/test/test_additional_properties_class.py new file mode 100644 index 00000000000..e90e5f92efc --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_additional_properties_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass + + +class TestAdditionalPropertiesClass(unittest.TestCase): + """ AdditionalPropertiesClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAdditionalPropertiesClass(self): + """ + Test AdditionalPropertiesClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_animal.py b/samples/client/petstore/python-asyncio/test/test_animal.py new file mode 100644 index 00000000000..c675d583ccc --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_animal.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal import Animal + + +class TestAnimal(unittest.TestCase): + """ Animal unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnimal(self): + """ + Test Animal + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.animal.Animal() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_animal_farm.py b/samples/client/petstore/python-asyncio/test/test_animal_farm.py new file mode 100644 index 00000000000..e459318a948 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_animal_farm.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal_farm import AnimalFarm + + +class TestAnimalFarm(unittest.TestCase): + """ AnimalFarm unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnimalFarm(self): + """ + Test AnimalFarm + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.animal_farm.AnimalFarm() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_another_fake_api.py b/samples/client/petstore/python-asyncio/test/test_another_fake_api.py new file mode 100644 index 00000000000..9f562fe1134 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_another_fake_api.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.another_fake_api import AnotherFakeApi + + +class TestAnotherFakeApi(unittest.TestCase): + """ AnotherFakeApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.another_fake_api.AnotherFakeApi() + + def tearDown(self): + pass + + def test_test_special_tags(self): + """ + Test case for test_special_tags + + To test special tags + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_api_response.py b/samples/client/petstore/python-asyncio/test/test_api_response.py new file mode 100644 index 00000000000..928af048b43 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_api_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.api_response import ApiResponse + + +class TestApiResponse(unittest.TestCase): + """ ApiResponse unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testApiResponse(self): + """ + Test ApiResponse + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.api_response.ApiResponse() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_array_of_array_of_number_only.py b/samples/client/petstore/python-asyncio/test/test_array_of_array_of_number_only.py new file mode 100644 index 00000000000..740e45cbafd --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_array_of_array_of_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly + + +class TestArrayOfArrayOfNumberOnly(unittest.TestCase): + """ ArrayOfArrayOfNumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayOfArrayOfNumberOnly(self): + """ + Test ArrayOfArrayOfNumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_array_of_number_only.py b/samples/client/petstore/python-asyncio/test/test_array_of_number_only.py new file mode 100644 index 00000000000..6da67a490b6 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_array_of_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly + + +class TestArrayOfNumberOnly(unittest.TestCase): + """ ArrayOfNumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayOfNumberOnly(self): + """ + Test ArrayOfNumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_array_test.py b/samples/client/petstore/python-asyncio/test/test_array_test.py new file mode 100644 index 00000000000..dcf8cc111c0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_array_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_test import ArrayTest + + +class TestArrayTest(unittest.TestCase): + """ ArrayTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayTest(self): + """ + Test ArrayTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_test.ArrayTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_capitalization.py b/samples/client/petstore/python-asyncio/test/test_capitalization.py new file mode 100644 index 00000000000..4ea6d2e3fd0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_capitalization.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.capitalization import Capitalization + + +class TestCapitalization(unittest.TestCase): + """ Capitalization unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCapitalization(self): + """ + Test Capitalization + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.capitalization.Capitalization() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_cat.py b/samples/client/petstore/python-asyncio/test/test_cat.py new file mode 100644 index 00000000000..9d9fbc50ab3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_cat.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.cat import Cat + + +class TestCat(unittest.TestCase): + """ Cat unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCat(self): + """ + Test Cat + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.cat.Cat() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_category.py b/samples/client/petstore/python-asyncio/test/test_category.py new file mode 100644 index 00000000000..6ded8f0f1ac --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_category.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.category import Category + + +class TestCategory(unittest.TestCase): + """ Category unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCategory(self): + """ + Test Category + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.category.Category() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_class_model.py b/samples/client/petstore/python-asyncio/test/test_class_model.py new file mode 100644 index 00000000000..85d56bbe52a --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_class_model.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.class_model import ClassModel + + +class TestClassModel(unittest.TestCase): + """ ClassModel unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testClassModel(self): + """ + Test ClassModel + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.class_model.ClassModel() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_client.py b/samples/client/petstore/python-asyncio/test/test_client.py new file mode 100644 index 00000000000..363ced2923c --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_client.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.client import Client + + +class TestClient(unittest.TestCase): + """ Client unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testClient(self): + """ + Test Client + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.client.Client() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_dog.py b/samples/client/petstore/python-asyncio/test/test_dog.py new file mode 100644 index 00000000000..b0428646591 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_dog.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.dog import Dog + + +class TestDog(unittest.TestCase): + """ Dog unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDog(self): + """ + Test Dog + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.dog.Dog() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_enum_arrays.py b/samples/client/petstore/python-asyncio/test/test_enum_arrays.py new file mode 100644 index 00000000000..2803f17aede --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_enum_arrays.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_arrays import EnumArrays + + +class TestEnumArrays(unittest.TestCase): + """ EnumArrays unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumArrays(self): + """ + Test EnumArrays + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_arrays.EnumArrays() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_enum_class.py b/samples/client/petstore/python-asyncio/test/test_enum_class.py new file mode 100644 index 00000000000..f673e741f84 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_enum_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_class import EnumClass + + +class TestEnumClass(unittest.TestCase): + """ EnumClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumClass(self): + """ + Test EnumClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_class.EnumClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_enum_test.py b/samples/client/petstore/python-asyncio/test/test_enum_test.py new file mode 100644 index 00000000000..e27c0107fd2 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_enum_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_test import EnumTest + + +class TestEnumTest(unittest.TestCase): + """ EnumTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumTest(self): + """ + Test EnumTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_test.EnumTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_fake_api.py b/samples/client/petstore/python-asyncio/test/test_fake_api.py new file mode 100644 index 00000000000..55a02cf899c --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_fake_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_api import FakeApi + + +class TestFakeApi(unittest.TestCase): + """ FakeApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.fake_api.FakeApi() + + def tearDown(self): + pass + + def test_fake_outer_boolean_serialize(self): + """ + Test case for fake_outer_boolean_serialize + + + """ + pass + + def test_fake_outer_composite_serialize(self): + """ + Test case for fake_outer_composite_serialize + + + """ + pass + + def test_fake_outer_number_serialize(self): + """ + Test case for fake_outer_number_serialize + + + """ + pass + + def test_fake_outer_string_serialize(self): + """ + Test case for fake_outer_string_serialize + + + """ + pass + + def test_test_client_model(self): + """ + Test case for test_client_model + + To test \"client\" model + """ + pass + + def test_test_endpoint_parameters(self): + """ + Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + """ + pass + + def test_test_enum_parameters(self): + """ + Test case for test_enum_parameters + + To test enum parameters + """ + pass + + def test_test_json_form_data(self): + """ + Test case for test_json_form_data + + test json serialization of form data + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python-asyncio/test/test_fake_classname_tags_123_api.py new file mode 100644 index 00000000000..7a11a2378bf --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_fake_classname_tags_123_api.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_classname_tags_123_api import FakeClassnameTags123Api + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """ FakeClassnameTags123Api unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.fake_classname_tags_123_api.FakeClassnameTags123Api() + + def tearDown(self): + pass + + def test_test_classname(self): + """ + Test case for test_classname + + To test class name in snake case + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_format_test.py b/samples/client/petstore/python-asyncio/test/test_format_test.py new file mode 100644 index 00000000000..ad028c0b431 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_format_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.format_test import FormatTest + + +class TestFormatTest(unittest.TestCase): + """ FormatTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFormatTest(self): + """ + Test FormatTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.format_test.FormatTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_has_only_read_only.py b/samples/client/petstore/python-asyncio/test/test_has_only_read_only.py new file mode 100644 index 00000000000..af029f26814 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_has_only_read_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.has_only_read_only import HasOnlyReadOnly + + +class TestHasOnlyReadOnly(unittest.TestCase): + """ HasOnlyReadOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testHasOnlyReadOnly(self): + """ + Test HasOnlyReadOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_list.py b/samples/client/petstore/python-asyncio/test/test_list.py new file mode 100644 index 00000000000..14400e35281 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_list.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.list import List + + +class TestList(unittest.TestCase): + """ List unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testList(self): + """ + Test List + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.list.List() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_map_test.py b/samples/client/petstore/python-asyncio/test/test_map_test.py new file mode 100644 index 00000000000..c4b2092f0ce --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_map_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.map_test import MapTest + + +class TestMapTest(unittest.TestCase): + """ MapTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMapTest(self): + """ + Test MapTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.map_test.MapTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-asyncio/test/test_mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..f614d36da8a --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_mixed_properties_and_additional_properties_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass + + +class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): + """ MixedPropertiesAndAdditionalPropertiesClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMixedPropertiesAndAdditionalPropertiesClass(self): + """ + Test MixedPropertiesAndAdditionalPropertiesClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_model_200_response.py b/samples/client/petstore/python-asyncio/test/test_model_200_response.py new file mode 100644 index 00000000000..f202a2d454f --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_model_200_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_200_response import Model200Response + + +class TestModel200Response(unittest.TestCase): + """ Model200Response unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """ + Test Model200Response + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.model_200_response.Model200Response() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_model_return.py b/samples/client/petstore/python-asyncio/test/test_model_return.py new file mode 100644 index 00000000000..347c8e4d7cb --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_model_return.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_return import ModelReturn + + +class TestModelReturn(unittest.TestCase): + """ ModelReturn unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModelReturn(self): + """ + Test ModelReturn + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.model_return.ModelReturn() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_name.py b/samples/client/petstore/python-asyncio/test/test_name.py new file mode 100644 index 00000000000..c06e35427f6 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.name import Name + + +class TestName(unittest.TestCase): + """ Name unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testName(self): + """ + Test Name + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.name.Name() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_number_only.py b/samples/client/petstore/python-asyncio/test/test_number_only.py new file mode 100644 index 00000000000..db3197a9e5b --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.number_only import NumberOnly + + +class TestNumberOnly(unittest.TestCase): + """ NumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testNumberOnly(self): + """ + Test NumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.number_only.NumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_order.py b/samples/client/petstore/python-asyncio/test/test_order.py new file mode 100644 index 00000000000..d911487ce97 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_order.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.order import Order + + +class TestOrder(unittest.TestCase): + """ Order unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOrder(self): + """ + Test Order + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.order.Order() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_outer_boolean.py b/samples/client/petstore/python-asyncio/test/test_outer_boolean.py new file mode 100644 index 00000000000..9474ab76968 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_outer_boolean.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_boolean import OuterBoolean + + +class TestOuterBoolean(unittest.TestCase): + """ OuterBoolean unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterBoolean(self): + """ + Test OuterBoolean + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_boolean.OuterBoolean() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_outer_composite.py b/samples/client/petstore/python-asyncio/test/test_outer_composite.py new file mode 100644 index 00000000000..ebbd9d03e6f --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_outer_composite.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_composite import OuterComposite + + +class TestOuterComposite(unittest.TestCase): + """ OuterComposite unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterComposite(self): + """ + Test OuterComposite + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_composite.OuterComposite() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_outer_enum.py b/samples/client/petstore/python-asyncio/test/test_outer_enum.py new file mode 100644 index 00000000000..c6e1f030ef1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_outer_enum.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_enum import OuterEnum + + +class TestOuterEnum(unittest.TestCase): + """ OuterEnum unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnum(self): + """ + Test OuterEnum + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_enum.OuterEnum() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_outer_number.py b/samples/client/petstore/python-asyncio/test/test_outer_number.py new file mode 100644 index 00000000000..9f97b407047 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_outer_number.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_number import OuterNumber + + +class TestOuterNumber(unittest.TestCase): + """ OuterNumber unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterNumber(self): + """ + Test OuterNumber + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_number.OuterNumber() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_outer_string.py b/samples/client/petstore/python-asyncio/test/test_outer_string.py new file mode 100644 index 00000000000..b0ac85ed934 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_outer_string.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_string import OuterString + + +class TestOuterString(unittest.TestCase): + """ OuterString unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterString(self): + """ + Test OuterString + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_string.OuterString() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_pet.py b/samples/client/petstore/python-asyncio/test/test_pet.py new file mode 100644 index 00000000000..c3e8191bec3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_pet.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.pet import Pet + + +class TestPet(unittest.TestCase): + """ Pet unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPet(self): + """ + Test Pet + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.pet.Pet() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_pet_api.py b/samples/client/petstore/python-asyncio/test/test_pet_api.py new file mode 100644 index 00000000000..1eafc35b28c --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_pet_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.pet_api import PetApi + + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.pet_api.PetApi() + + def tearDown(self): + pass + + def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ + pass + + def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ + pass + + def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ + pass + + def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ + pass + + def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ + pass + + def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ + pass + + def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + pass + + def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_read_only_first.py b/samples/client/petstore/python-asyncio/test/test_read_only_first.py new file mode 100644 index 00000000000..c89d5d3b6a1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_read_only_first.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.read_only_first import ReadOnlyFirst + + +class TestReadOnlyFirst(unittest.TestCase): + """ ReadOnlyFirst unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testReadOnlyFirst(self): + """ + Test ReadOnlyFirst + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.read_only_first.ReadOnlyFirst() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_special_model_name.py b/samples/client/petstore/python-asyncio/test/test_special_model_name.py new file mode 100644 index 00000000000..d9fa392c36b --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_special_model_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.special_model_name import SpecialModelName + + +class TestSpecialModelName(unittest.TestCase): + """ SpecialModelName unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSpecialModelName(self): + """ + Test SpecialModelName + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.special_model_name.SpecialModelName() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_store_api.py b/samples/client/petstore/python-asyncio/test/test_store_api.py new file mode 100644 index 00000000000..f131b6068b2 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_store_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.store_api import StoreApi + + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.store_api.StoreApi() + + def tearDown(self): + pass + + def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ + pass + + def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ + pass + + def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ + pass + + def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_tag.py b/samples/client/petstore/python-asyncio/test/test_tag.py new file mode 100644 index 00000000000..76f79932c96 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_tag.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.tag import Tag + + +class TestTag(unittest.TestCase): + """ Tag unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTag(self): + """ + Test Tag + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.tag.Tag() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_user.py b/samples/client/petstore/python-asyncio/test/test_user.py new file mode 100644 index 00000000000..82f5d9058b0 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_user.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.user import User + + +class TestUser(unittest.TestCase): + """ User unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testUser(self): + """ + Test User + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.user.User() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_user_api.py b/samples/client/petstore/python-asyncio/test/test_user_api.py new file mode 100644 index 00000000000..3e0be964a2d --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_user_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.user_api import UserApi + + +class TestUserApi(unittest.TestCase): + """ UserApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.user_api.UserApi() + + def tearDown(self): + pass + + def test_create_user(self): + """ + Test case for create_user + + Create user + """ + pass + + def test_create_users_with_array_input(self): + """ + Test case for create_users_with_array_input + + Creates list of users with given input array + """ + pass + + def test_create_users_with_list_input(self): + """ + Test case for create_users_with_list_input + + Creates list of users with given input array + """ + pass + + def test_delete_user(self): + """ + Test case for delete_user + + Delete user + """ + pass + + def test_get_user_by_name(self): + """ + Test case for get_user_by_name + + Get user by user name + """ + pass + + def test_login_user(self): + """ + Test case for login_user + + Logs user into the system + """ + pass + + def test_logout_user(self): + """ + Test case for logout_user + + Logs out current logged in user session + """ + pass + + def test_update_user(self): + """ + Test case for update_user + + Updated user + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/tox.ini b/samples/client/petstore/python-asyncio/tox.ini new file mode 100644 index 00000000000..1cf0829dc93 --- /dev/null +++ b/samples/client/petstore/python-asyncio/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py27, py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + [] \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/.gitignore b/samples/client/petstore/python-tornado/.gitignore new file mode 100644 index 00000000000..a655050c263 --- /dev/null +++ b/samples/client/petstore/python-tornado/.gitignore @@ -0,0 +1,64 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/client/petstore/python-tornado/.swagger-codegen-ignore b/samples/client/petstore/python-tornado/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/python-tornado/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION new file mode 100644 index 00000000000..f9f7450d135 --- /dev/null +++ b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/.travis.yml b/samples/client/petstore/python-tornado/.travis.yml new file mode 100644 index 00000000000..86211e2d4a2 --- /dev/null +++ b/samples/client/petstore/python-tornado/.travis.yml @@ -0,0 +1,14 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + #- "3.5-dev" # 3.5 development branch + #- "nightly" # points to the latest development branch e.g. 3.6-dev +# command to install dependencies +install: "pip install -r requirements.txt" +# command to run tests +script: nosetests diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md new file mode 100644 index 00000000000..87f80990fc5 --- /dev/null +++ b/samples/client/petstore/python-tornado/README.md @@ -0,0 +1,176 @@ +# petstore-api +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.languages.PythonClientCodegen + +## Requirements. + +Python 2.7 and 3.4+ + +## Installation & Usage +### pip install + +If the python package is hosted on Github, you can install directly from Github + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import petstore_api +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import petstore_api +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +from __future__ import print_function +import time +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 + +try: + # To test special tags + api_response = api_instance.test_special_tags(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user +*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system +*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Capitalization](docs/Capitalization.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterBoolean](docs/OuterBoolean.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterNumber](docs/OuterNumber.md) + - [OuterString](docs/OuterString.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + - [Cat](docs/Cat.md) + - [Dog](docs/Dog.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## http_basic_test + +- **Type**: HTTP basic authentication + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + +apiteam@swagger.io + diff --git a/samples/client/petstore/python-tornado/docs/AdditionalPropertiesClass.md b/samples/client/petstore/python-tornado/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..ea12f270f02 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_property** | **dict(str, str)** | | [optional] +**map_of_map_property** | [**dict(str, dict(str, str))**](dict.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Animal.md b/samples/client/petstore/python-tornado/docs/Animal.md new file mode 100644 index 00000000000..7ed4ba541fa --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/AnimalFarm.md b/samples/client/petstore/python-tornado/docs/AnimalFarm.md new file mode 100644 index 00000000000..df6bab21dae --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..b78fcf86f43 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# petstore_api.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags + + +# **test_special_tags** +> Client test_special_tags(body) + +To test special tags + +To test special tags + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # To test special tags + api_response = api_instance.test_special_tags(body) + pprint(api_response) +except ApiException as e: + print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/docs/ApiResponse.md b/samples/client/petstore/python-tornado/docs/ApiResponse.md new file mode 100644 index 00000000000..8fc302305ab --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **str** | | [optional] +**message** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/python-tornado/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..aa3988ab167 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_array_number** | **list[list[float]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/ArrayOfNumberOnly.md b/samples/client/petstore/python-tornado/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..2c3de967aec --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_number** | **list[float]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/ArrayTest.md b/samples/client/petstore/python-tornado/docs/ArrayTest.md new file mode 100644 index 00000000000..6ab0d137806 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_of_string** | **list[str]** | | [optional] +**array_array_of_integer** | **list[list[int]]** | | [optional] +**array_array_of_model** | **list[list[ReadOnlyFirst]]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Capitalization.md b/samples/client/petstore/python-tornado/docs/Capitalization.md new file mode 100644 index 00000000000..85d88d239ee --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**small_camel** | **str** | | [optional] +**capital_camel** | **str** | | [optional] +**small_snake** | **str** | | [optional] +**capital_snake** | **str** | | [optional] +**sca_eth_flow_points** | **str** | | [optional] +**att_name** | **str** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Cat.md b/samples/client/petstore/python-tornado/docs/Cat.md new file mode 100644 index 00000000000..8d30565d014 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Category.md b/samples/client/petstore/python-tornado/docs/Category.md new file mode 100644 index 00000000000..7f453539bf8 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/ClassModel.md b/samples/client/petstore/python-tornado/docs/ClassModel.md new file mode 100644 index 00000000000..7f6f6d17211 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_class** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Client.md b/samples/client/petstore/python-tornado/docs/Client.md new file mode 100644 index 00000000000..88e99384f92 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Dog.md b/samples/client/petstore/python-tornado/docs/Dog.md new file mode 100644 index 00000000000..f727487975c --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/EnumArrays.md b/samples/client/petstore/python-tornado/docs/EnumArrays.md new file mode 100644 index 00000000000..e15a5f1fd04 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_symbol** | **str** | | [optional] +**array_enum** | **list[str]** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/EnumClass.md b/samples/client/petstore/python-tornado/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/EnumTest.md b/samples/client/petstore/python-tornado/docs/EnumTest.md new file mode 100644 index 00000000000..94dd4864629 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/EnumTest.md @@ -0,0 +1,13 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **str** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **float** | | [optional] +**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md new file mode 100644 index 00000000000..eb669540e53 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -0,0 +1,440 @@ +# petstore_api.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data + + +# **fake_outer_boolean_serialize** +> OuterBoolean fake_outer_boolean_serialize(body=body) + + + +Test serialization of outer boolean types + +### Example +```python +from __future__ import print_function +import time +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.OuterBoolean() # OuterBoolean | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(body=body) + + + +Test serialization of object with outer number type + +### Example +```python +from __future__ import print_function +import time +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) + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> OuterNumber fake_outer_number_serialize(body=body) + + + +Test serialization of outer number types + +### Example +```python +from __future__ import print_function +import time +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.OuterNumber() # OuterNumber | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> OuterString fake_outer_string_serialize(body=body) + + + +Test serialization of outer string types + +### Example +```python +from __future__ import print_function +import time +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.OuterString() # OuterString | 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_client_model** +> Client test_client_model(body) + +To test \"client\" model + +To test \"client\" model + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_endpoint_parameters** +> 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) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration() +configuration.username = 'YOUR_USERNAME' +configuration.password = 'YOUR_PASSWORD' + +# create an instance of the API class +api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) +number = 3.4 # float | None +double = 1.2 # float | None +pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None +byte = 'byte_example' # str | None +integer = 56 # int | None (optional) +int32 = 56 # int | None (optional) +int64 = 789 # int | None (optional) +float = 3.4 # float | None (optional) +string = 'string_example' # str | None (optional) +binary = 'B' # str | None (optional) +date = '2013-10-20' # date | None (optional) +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **pattern_without_delimiter** | **str**| None | + **byte** | **str**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **string** | **str**| None | [optional] + **binary** | **str**| None | [optional] + **date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + **param_callback** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 + - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_enum_parameters** +> test_enum_parameters(enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string, 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) + +To test enum parameters + +To test enum parameters + +### Example +```python +from __future__ import print_function +import time +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_form_string_array = ['enum_form_string_array_example'] # list[str] | Form parameter enum test (string array) (optional) +enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) (default to -efg) +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) +enum_query_integer = 56 # int | Query parameter enum test (double) (optional) +enum_query_double = 1.2 # float | Query parameter enum test (double) (optional) + +try: + # To test enum parameters + api_instance.test_enum_parameters(enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string, 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) +except ApiException as e: + print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_form_string_array** | [**list[str]**](str.md)| Form parameter enum test (string array) | [optional] + **enum_form_string** | **str**| Form parameter enum test (string) | [optional] [default to -efg] + **enum_header_string_array** | [**list[str]**](str.md)| Header parameter enum test (string array) | [optional] + **enum_header_string** | **str**| Header parameter enum test (string) | [optional] [default to -efg] + **enum_query_string_array** | [**list[str]**](str.md)| Query parameter enum test (string array) | [optional] + **enum_query_string** | **str**| Query parameter enum test (string) | [optional] [default to -efg] + **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] + **enum_query_double** | **float**| Query parameter enum test (double) | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: */* + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_json_form_data** +> test_json_form_data(param, param2) + +test json serialization of form data + + + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **str**| field1 | + **param2** | **str**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..a103a4ee327 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# petstore_api.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **test_classname** +> Client test_classname(body) + +To test class name in snake case + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key_query +configuration = petstore_api.Configuration() +configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key_query'] = 'Bearer' + +# create an instance of the API class +api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration)) +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/docs/FormatTest.md b/samples/client/petstore/python-tornado/docs/FormatTest.md new file mode 100644 index 00000000000..3e489e863fa --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**string** | **str** | | [optional] +**byte** | **str** | | +**binary** | **str** | | [optional] +**date** | **date** | | +**date_time** | **datetime** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/HasOnlyReadOnly.md b/samples/client/petstore/python-tornado/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..44ad450b52c --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] +**foo** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/List.md b/samples/client/petstore/python-tornado/docs/List.md new file mode 100644 index 00000000000..11f4f3a05f3 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123_list** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/MapTest.md b/samples/client/petstore/python-tornado/docs/MapTest.md new file mode 100644 index 00000000000..63cdab0374a --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/MapTest.md @@ -0,0 +1,11 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_map_of_string** | [**dict(str, dict(str, str))**](dict.md) | | [optional] +**map_of_enum_string** | **dict(str, str)** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/python-tornado/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..b9808d5275e --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**date_time** | **datetime** | | [optional] +**map** | [**dict(str, Animal)**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Model200Response.md b/samples/client/petstore/python-tornado/docs/Model200Response.md new file mode 100644 index 00000000000..30f47cae521 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**_class** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/ModelReturn.md b/samples/client/petstore/python-tornado/docs/ModelReturn.md new file mode 100644 index 00000000000..2b03798e301 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ModelReturn.md @@ -0,0 +1,10 @@ +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Name.md b/samples/client/petstore/python-tornado/docs/Name.md new file mode 100644 index 00000000000..542da3f0476 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snake_case** | **int** | | [optional] +**_property** | **str** | | [optional] +**_123_number** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/NumberOnly.md b/samples/client/petstore/python-tornado/docs/NumberOnly.md new file mode 100644 index 00000000000..93a0fde7b93 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_number** | **float** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Order.md b/samples/client/petstore/python-tornado/docs/Order.md new file mode 100644 index 00000000000..b5f7b22d34c --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**pet_id** | **int** | | [optional] +**quantity** | **int** | | [optional] +**ship_date** | **datetime** | | [optional] +**status** | **str** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to False] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/OuterBoolean.md b/samples/client/petstore/python-tornado/docs/OuterBoolean.md new file mode 100644 index 00000000000..8b243399474 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/OuterBoolean.md @@ -0,0 +1,9 @@ +# OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/OuterComposite.md b/samples/client/petstore/python-tornado/docs/OuterComposite.md new file mode 100644 index 00000000000..159e67b48ee --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/OuterEnum.md b/samples/client/petstore/python-tornado/docs/OuterEnum.md new file mode 100644 index 00000000000..06d413b0168 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/OuterEnum.md @@ -0,0 +1,9 @@ +# OuterEnum + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/OuterNumber.md b/samples/client/petstore/python-tornado/docs/OuterNumber.md new file mode 100644 index 00000000000..8aa37f329bd --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/OuterNumber.md @@ -0,0 +1,9 @@ +# OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/OuterString.md b/samples/client/petstore/python-tornado/docs/OuterString.md new file mode 100644 index 00000000000..9ccaadaf98d --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/OuterString.md @@ -0,0 +1,9 @@ +# OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/Pet.md b/samples/client/petstore/python-tornado/docs/Pet.md new file mode 100644 index 00000000000..9e15090300f --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **str** | | +**photo_urls** | **list[str]** | | +**tags** | [**list[Tag]**](Tag.md) | | [optional] +**status** | **str** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/PetApi.md b/samples/client/petstore/python-tornado/docs/PetApi.md new file mode 100644 index 00000000000..74c6a5196fd --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/PetApi.md @@ -0,0 +1,440 @@ +# petstore_api.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image + + +# **add_pet** +> add_pet(body) + +Add a new pet to the store + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_pet** +> delete_pet(pet_id, api_key=api_key) + +Deletes a pet + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| Pet id to delete | + **api_key** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_status** +> list[Pet] find_pets_by_status(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**list[str]**](str.md)| Status values that need to be considered for filter | + +### Return type + +[**list[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_tags** +> list[Pet] find_pets_by_tags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**list[str]**](str.md)| Tags to filter by | + +### Return type + +[**list[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id** +> Pet get_pet_by_id(pet_id) + +Find pet by ID + +Returns a single pet + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +configuration = petstore_api.Configuration() +configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet** +> update_pet(body) + +Update an existing pet + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# 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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet_with_form** +> update_pet_with_form(pet_id, name=name, status=status) + +Updates a pet in the store with form data + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **str**| Updated name of the pet | [optional] + **status** | **str**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) + +uploads an image + + + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 789 # int | ID of pet to update +additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) +file = '/path/to/file.txt' # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + **file** | **file**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/docs/ReadOnlyFirst.md b/samples/client/petstore/python-tornado/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..93fed253d01 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] +**baz** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/SpecialModelName.md b/samples/client/petstore/python-tornado/docs/SpecialModelName.md new file mode 100644 index 00000000000..022ee19169c --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/StoreApi.md b/samples/client/petstore/python-tornado/docs/StoreApi.md new file mode 100644 index 00000000000..a75113975ef --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/StoreApi.md @@ -0,0 +1,205 @@ +# petstore_api.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet + + +# **delete_order** +> delete_order(order_id) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory** +> dict(str, int) get_inventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +configuration = petstore_api.Configuration() +configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# 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) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**dict(str, int)** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_order_by_id** +> Order get_order_by_id(order_id) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```python +from __future__ import print_function +import time +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 = 789 # 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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **place_order** +> Order place_order(body) + +Place an order for a pet + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/docs/Tag.md b/samples/client/petstore/python-tornado/docs/Tag.md new file mode 100644 index 00000000000..243cd98eda6 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/User.md b/samples/client/petstore/python-tornado/docs/User.md new file mode 100644 index 00000000000..443ac123fdc --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **str** | | [optional] +**first_name** | **str** | | [optional] +**last_name** | **str** | | [optional] +**email** | **str** | | [optional] +**password** | **str** | | [optional] +**phone** | **str** | | [optional] +**user_status** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python-tornado/docs/UserApi.md b/samples/client/petstore/python-tornado/docs/UserApi.md new file mode 100644 index 00000000000..5b73179dce3 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/UserApi.md @@ -0,0 +1,394 @@ +# petstore_api.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_user**](UserApi.md#create_user) | **POST** /user | Create user +[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system +[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +# **create_user** +> create_user(body) + +Create user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # Create user + api_instance.create_user(body) +except ApiException as e: + print("Exception when calling UserApi->create_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_array_input** +> create_users_with_array_input(body) + +Creates list of users with given input array + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**list[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_list_input** +> create_users_with_list_input(body) + +Creates list of users with given input array + + + +### Example +```python +from __future__ import print_function +import time +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 + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**list[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_user** +> delete_user(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 + +try: + # Delete user + api_instance.delete_user(username) +except ApiException as e: + print("Exception when calling UserApi->delete_user: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_user_by_name** +> User get_user_by_name(username) + +Get user by user name + + + +### Example +```python +from __future__ import print_function +import time +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. + +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 + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **login_user** +> str login_user(username, password) + +Logs user into the system + + + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logout_user** +> logout_user() + +Logs out current logged in user session + + + +### Example +```python +from __future__ import print_function +import time +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) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_user** +> update_user(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```python +from __future__ import print_function +import time +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 +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) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/python-tornado/git_push.sh b/samples/client/petstore/python-tornado/git_push.sh new file mode 100644 index 00000000000..ed374619b13 --- /dev/null +++ b/samples/client/petstore/python-tornado/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py new file mode 100644 index 00000000000..cad09e2691c --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -0,0 +1,65 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into sdk package +from .models.additional_properties_class import AdditionalPropertiesClass +from .models.animal import Animal +from .models.animal_farm import AnimalFarm +from .models.api_response import ApiResponse +from .models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from .models.array_of_number_only import ArrayOfNumberOnly +from .models.array_test import ArrayTest +from .models.capitalization import Capitalization +from .models.category import Category +from .models.class_model import ClassModel +from .models.client import Client +from .models.enum_arrays import EnumArrays +from .models.enum_class import EnumClass +from .models.enum_test import EnumTest +from .models.format_test import FormatTest +from .models.has_only_read_only import HasOnlyReadOnly +from .models.list import List +from .models.map_test import MapTest +from .models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from .models.model_200_response import Model200Response +from .models.model_return import ModelReturn +from .models.name import Name +from .models.number_only import NumberOnly +from .models.order import Order +from .models.outer_boolean import OuterBoolean +from .models.outer_composite import OuterComposite +from .models.outer_enum import OuterEnum +from .models.outer_number import OuterNumber +from .models.outer_string import OuterString +from .models.pet import Pet +from .models.read_only_first import ReadOnlyFirst +from .models.special_model_name import SpecialModelName +from .models.tag import Tag +from .models.user import User +from .models.cat import Cat +from .models.dog import Dog + +# import apis into sdk package +from .apis.another_fake_api import AnotherFakeApi +from .apis.fake_api import FakeApi +from .apis.fake_classname_tags_123_api import FakeClassnameTags123Api +from .apis.pet_api import PetApi +from .apis.store_api import StoreApi +from .apis.user_api import UserApi + +# import ApiClient +from .api_client import ApiClient + +from .configuration import Configuration diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py new file mode 100644 index 00000000000..c30b14130a9 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -0,0 +1,630 @@ +# coding: utf-8 +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import os +import re +import json +import mimetypes +import tempfile +import tornado.gen +from multiprocessing.pool import ThreadPool + +from datetime import date, datetime + +# python 2 and python 3 compatibility library +from six import PY3, integer_types, iteritems, text_type +from six.moves.urllib.parse import quote + +from . import models +from .configuration import Configuration +from .rest import ApiException, RESTClientObject + + +class ApiClient(object): + """ + Generic API client for Swagger client library builds. + + Swagger generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the Swagger + templates. + + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + + :param host: The base path for the server to call. + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to the API. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, text_type) + integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if PY3 else long, + 'float': float, + 'str': str, + 'bool': bool, + 'date': date, + 'datetime': datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + self.pool = ThreadPool() + self.rest_client = RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + self.pool.close() + self.pool.join() + + @property + def user_agent(self): + """ + Gets user agent. + """ + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + """ + Sets user agent. + """ + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + @tornado.gen.coroutine + def __call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, _preload_content=True, + _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param)) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + url = self.configuration.host + resource_path + + # perform request and return response + response_data = yield self.request(method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """ + Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime, date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """ + Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """ + Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match('list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == date: + return self.__deserialize_date(data) + elif klass == datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async=None, + _return_http_data_only=None, collection_formats=None, _preload_content=True, + _request_timeout=None): + """ + Makes the HTTP request (synchronous) and return the deserialized data. + To make an async request, set the async parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async bool: execute request asynchronously + :param _return_http_data_only: response data without head status code and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without + reading/decoding response data. Default is True. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :return: + If async parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async is False or missing, + then the method will return the response directly. + """ + if not async: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, _preload_content, _request_timeout) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, method, + path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, _preload_content, _request_timeout)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, _request_timeout=None): + """ + Makes the HTTP request using RESTClient. + """ + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """ + Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in iteritems(params) if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """ + Builds form parameters. + + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = mimetypes.\ + guess_type(filename)[0] or 'application/octet-stream' + params.append(tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """ + Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """ + Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """ + Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """ + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.\ + search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\ + group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "w") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """ + Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return unicode(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """ + Return a original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """ + Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise ApiException( + status=0, + reason="Failed to parse `{0}` into a date object".format(string) + ) + + def __deserialize_datatime(self, string): + """ + Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise ApiException( + status=0, + reason=( + "Failed to parse `{0}` into a datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """ + Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.swagger_types and not hasattr(klass, 'get_real_child_model'): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in iteritems(klass.swagger_types): + if data is not None \ + and klass.attribute_map[attr] in data \ + and isinstance(data, (list, dict)): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/__init__.py b/samples/client/petstore/python-tornado/petstore_api/apis/__init__.py new file mode 100644 index 00000000000..b4b975ca8e0 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/__init__.py @@ -0,0 +1,9 @@ +from __future__ import absolute_import + +# import apis into api package +from .another_fake_api import AnotherFakeApi +from .fake_api import FakeApi +from .fake_classname_tags_123_api import FakeClassnameTags123Api +from .pet_api import PetApi +from .store_api import StoreApi +from .user_api import UserApi diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/another_fake_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/another_fake_api.py new file mode 100644 index 00000000000..8fb991ff3df --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/another_fake_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class AnotherFakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def test_special_tags(self, body, **kwargs): + """ + To test special tags + To test special tags + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_special_tags(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_special_tags_with_http_info(body, **kwargs) + else: + (data) = self.test_special_tags_with_http_info(body, **kwargs) + return data + + def test_special_tags_with_http_info(self, body, **kwargs): + """ + To test special tags + To test special tags + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_special_tags_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_special_tags" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_special_tags`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/another-fake/dummy', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/fake_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/fake_api.py new file mode 100644 index 00000000000..46fb22f7290 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/fake_api.py @@ -0,0 +1,886 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class FakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def fake_outer_boolean_serialize(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_boolean_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_boolean_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) + return data + + def fake_outer_boolean_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_boolean_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_boolean_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/boolean', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterBoolean', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_composite_serialize(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_composite_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_composite_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) + return data + + def fake_outer_composite_serialize_with_http_info(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_composite_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_composite_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/composite', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterComposite', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_number_serialize(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_number_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_number_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) + return data + + def fake_outer_number_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_number_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_number_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/number', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterNumber', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_string_serialize(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_string_serialize(async=True) + >>> result = thread.get() + + :param async bool + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.fake_outer_string_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) + return data + + def fake_outer_string_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.fake_outer_string_serialize_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 fake_outer_string_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/string', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterString', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_client_model(self, body, **kwargs): + """ + To test \"client\" model + To test \"client\" model + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_client_model(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_client_model_with_http_info(body, **kwargs) + else: + (data) = self.test_client_model_with_http_info(body, **kwargs) + return data + + def test_client_model_with_http_info(self, body, **kwargs): + """ + To test \"client\" model + To test \"client\" model + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_client_model_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_client_model" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_client_model`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, async=True) + >>> result = thread.get() + + :param async bool + :param float number: None (required) + :param float double: None (required) + :param str pattern_without_delimiter: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str string: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :param str param_callback: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) + else: + (data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) + return data + + def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs): + """ + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, async=True) + >>> result = thread.get() + + :param async bool + :param float number: None (required) + :param float double: None (required) + :param str pattern_without_delimiter: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str string: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :param str param_callback: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password', 'param_callback'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_endpoint_parameters" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'number' is set + if ('number' not in params) or (params['number'] is None): + raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") + # verify the required parameter 'double' is set + if ('double' not in params) or (params['double'] is None): + raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") + # verify the required parameter 'pattern_without_delimiter' is set + if ('pattern_without_delimiter' not in params) or (params['pattern_without_delimiter'] is None): + raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") + # verify the required parameter 'byte' is set + if ('byte' not in params) or (params['byte'] is None): + raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") + + if 'number' in params and params['number'] > 543.2: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") + if 'number' in params and params['number'] < 32.1: + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") + if 'double' in params and params['double'] > 123.4: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") + if 'double' in params and params['double'] < 67.8: + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") + if 'pattern_without_delimiter' in params and not re.search('^[A-Z].*', params['pattern_without_delimiter']): + raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") + if 'integer' in params and params['integer'] > 100: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") + if 'integer' in params and params['integer'] < 10: + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") + if 'int32' in params and params['int32'] > 200: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") + if 'int32' in params and params['int32'] < 20: + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") + if 'float' in params and params['float'] > 987.6: + raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") + if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE): + raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") + if 'password' in params and len(params['password']) > 64: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") + if 'password' in params and len(params['password']) < 10: + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'integer' in params: + form_params.append(('integer', params['integer'])) + if 'int32' in params: + form_params.append(('int32', params['int32'])) + if 'int64' in params: + form_params.append(('int64', params['int64'])) + if 'number' in params: + form_params.append(('number', params['number'])) + if 'float' in params: + form_params.append(('float', params['float'])) + if 'double' in params: + form_params.append(('double', params['double'])) + if 'string' in params: + form_params.append(('string', params['string'])) + if 'pattern_without_delimiter' in params: + form_params.append(('pattern_without_delimiter', params['pattern_without_delimiter'])) + if 'byte' in params: + form_params.append(('byte', params['byte'])) + if 'binary' in params: + form_params.append(('binary', params['binary'])) + if 'date' in params: + form_params.append(('date', params['date'])) + if 'date_time' in params: + form_params.append(('dateTime', params['date_time'])) + if 'password' in params: + form_params.append(('password', params['password'])) + if 'param_callback' in params: + form_params.append(('callback', params['param_callback'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/xml; charset=utf-8', 'application/json; charset=utf-8']) + + # Authentication setting + auth_settings = ['http_basic_test'] + + return self.api_client.call_api('/fake', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_enum_parameters(self, **kwargs): + """ + To test enum parameters + To test enum parameters + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_enum_parameters(async=True) + >>> result = thread.get() + + :param async bool + :param list[str] enum_form_string_array: Form parameter enum test (string array) + :param str enum_form_string: Form parameter enum test (string) + :param list[str] enum_header_string_array: Header parameter enum test (string array) + :param str enum_header_string: Header parameter enum test (string) + :param list[str] enum_query_string_array: Query parameter enum test (string array) + :param str enum_query_string: Query parameter enum test (string) + :param int enum_query_integer: Query parameter enum test (double) + :param float enum_query_double: Query parameter enum test (double) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_enum_parameters_with_http_info(**kwargs) + else: + (data) = self.test_enum_parameters_with_http_info(**kwargs) + return data + + def test_enum_parameters_with_http_info(self, **kwargs): + """ + To test enum parameters + To test enum parameters + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_enum_parameters_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :param list[str] enum_form_string_array: Form parameter enum test (string array) + :param str enum_form_string: Form parameter enum test (string) + :param list[str] enum_header_string_array: Header parameter enum test (string array) + :param str enum_header_string: Header parameter enum test (string) + :param list[str] enum_query_string_array: Query parameter enum test (string array) + :param str enum_query_string: Query parameter enum test (string) + :param int enum_query_integer: Query parameter enum test (double) + :param float enum_query_double: Query parameter enum test (double) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['enum_form_string_array', 'enum_form_string', 'enum_header_string_array', 'enum_header_string', 'enum_query_string_array', 'enum_query_string', 'enum_query_integer', 'enum_query_double'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_enum_parameters" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'enum_query_string_array' in params: + query_params.append(('enum_query_string_array', params['enum_query_string_array'])) + collection_formats['enum_query_string_array'] = 'csv' + if 'enum_query_string' in params: + query_params.append(('enum_query_string', params['enum_query_string'])) + if 'enum_query_integer' in params: + query_params.append(('enum_query_integer', params['enum_query_integer'])) + + header_params = {} + if 'enum_header_string_array' in params: + header_params['enum_header_string_array'] = params['enum_header_string_array'] + collection_formats['enum_header_string_array'] = 'csv' + if 'enum_header_string' in params: + header_params['enum_header_string'] = params['enum_header_string'] + + form_params = [] + local_var_files = {} + if 'enum_form_string_array' in params: + form_params.append(('enum_form_string_array', params['enum_form_string_array'])) + collection_formats['enum_form_string_array'] = 'csv' + if 'enum_form_string' in params: + form_params.append(('enum_form_string', params['enum_form_string'])) + if 'enum_query_double' in params: + form_params.append(('enum_query_double', params['enum_query_double'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_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('/fake', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_json_form_data(self, param, param2, **kwargs): + """ + test json serialization of form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_json_form_data(param, param2, async=True) + >>> result = thread.get() + + :param async bool + :param str param: field1 (required) + :param str param2: field2 (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_json_form_data_with_http_info(param, param2, **kwargs) + else: + (data) = self.test_json_form_data_with_http_info(param, param2, **kwargs) + return data + + def test_json_form_data_with_http_info(self, param, param2, **kwargs): + """ + test json serialization of form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_json_form_data_with_http_info(param, param2, async=True) + >>> result = thread.get() + + :param async bool + :param str param: field1 (required) + :param str param2: field2 (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['param', 'param2'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_json_form_data" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'param' is set + if ('param' not in params) or (params['param'] is None): + raise ValueError("Missing the required parameter `param` when calling `test_json_form_data`") + # verify the required parameter 'param2' is set + if ('param2' not in params) or (params['param2'] is None): + raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'param' in params: + form_params.append(('param', params['param'])) + if 'param2' in params: + form_params.append(('param2', params['param2'])) + + body_params = None + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/jsonFormData', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/fake_classname_tags_123_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/fake_classname_tags_123_api.py new file mode 100644 index 00000000000..da75ad3cccd --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/fake_classname_tags_123_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class FakeClassnameTags123Api(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def test_classname(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_classname(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_classname_with_http_info(body, **kwargs) + else: + (data) = self.test_classname_with_http_info(body, **kwargs) + return data + + def test_classname_with_http_info(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_classname_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 test_classname" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `test_classname`") + + + collection_formats = {} + + 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']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json']) + + # Authentication setting + auth_settings = ['api_key_query'] + + return self.api_client.call_api('/fake_classname_test', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Client', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/pet_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/pet_api.py new file mode 100644 index 00000000000..51b6ce82540 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/pet_api.py @@ -0,0 +1,826 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class PetApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_pet(self, body, **kwargs): + """ + Add a new pet to the store + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.add_pet(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.add_pet_with_http_info(body, **kwargs) + else: + (data) = self.add_pet_with_http_info(body, **kwargs) + return data + + def add_pet_with_http_info(self, body, **kwargs): + """ + Add a new pet to the store + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.add_pet_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `add_pet`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # 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('/pet', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.delete_pet(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_pet_with_http_info(pet_id, **kwargs) + else: + (data) = self.delete_pet_with_http_info(pet_id, **kwargs) + return data + + def delete_pet_with_http_info(self, pet_id, **kwargs): + """ + Deletes a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_pet_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_pets_by_status(self, status, **kwargs): + """ + Finds Pets by status + Multiple status values can be provided with comma separated strings + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_status(status, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] status: Status values that need to be considered for filter (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.find_pets_by_status_with_http_info(status, **kwargs) + else: + (data) = self.find_pets_by_status_with_http_info(status, **kwargs) + return data + + def find_pets_by_status_with_http_info(self, status, **kwargs): + """ + Finds Pets by status + Multiple status values can be provided with comma separated strings + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_status_with_http_info(status, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] status: Status values that need to be considered for filter (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['status'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_pets_by_status" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'status' is set + if ('status' not in params) or (params['status'] is None): + raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status' in params: + query_params.append(('status', params['status'])) + collection_formats['status'] = 'csv' + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/findByStatus', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Pet]', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_pets_by_tags(self, tags, **kwargs): + """ + Finds Pets by tags + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_tags(tags, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] tags: Tags to filter by (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.find_pets_by_tags_with_http_info(tags, **kwargs) + else: + (data) = self.find_pets_by_tags_with_http_info(tags, **kwargs) + return data + + def find_pets_by_tags_with_http_info(self, tags, **kwargs): + """ + Finds Pets by tags + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.find_pets_by_tags_with_http_info(tags, async=True) + >>> result = thread.get() + + :param async bool + :param list[str] tags: Tags to filter by (required) + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tags'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_pets_by_tags" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tags' is set + if ('tags' not in params) or (params['tags'] is None): + raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'tags' in params: + query_params.append(('tags', params['tags'])) + collection_formats['tags'] = 'csv' + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/findByTags', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Pet]', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_pet_by_id(self, pet_id, **kwargs): + """ + Find pet by ID + Returns a single pet + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_pet_by_id(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to return (required) + :return: Pet + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) + else: + (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) + return data + + def get_pet_by_id_with_http_info(self, pet_id, **kwargs): + """ + Find pet by ID + Returns a single pet + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_pet_by_id_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to return (required) + :return: Pet + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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" % 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`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = ['api_key'] + + return self.api_client.call_api('/pet/{petId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Pet', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_pet(self, body, **kwargs): + """ + Update an existing pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_pet_with_http_info(body, **kwargs) + else: + (data) = self.update_pet_with_http_info(body, **kwargs) + return data + + def update_pet_with_http_info(self, body, **kwargs): + """ + Update an existing pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Pet body: Pet object that needs to be added to the store (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_pet`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # 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('/pet', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_pet_with_form(self, pet_id, **kwargs): + """ + Updates a pet in the store with form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_form(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet that needs to be updated (required) + :param str name: Updated name of the pet + :param str status: Updated status of the pet + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_pet_with_form_with_http_info(pet_id, **kwargs) + else: + (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) + return data + + def update_pet_with_form_with_http_info(self, pet_id, **kwargs): + """ + Updates a pet in the store with form data + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_pet_with_form_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet that needs to be updated (required) + :param str name: Updated name of the pet + :param str status: Updated status of the pet + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'name', 'status'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_with_form" % 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 `update_pet_with_form`") + + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'name' in params: + form_params.append(('name', params['name'])) + if 'status' in params: + form_params.append(('status', params['status'])) + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/x-www-form-urlencoded']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def upload_file(self, pet_id, **kwargs): + """ + uploads an image + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param str additional_metadata: Additional data to pass to server + :param file file: file to upload + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.upload_file_with_http_info(pet_id, **kwargs) + else: + (data) = self.upload_file_with_http_info(pet_id, **kwargs) + return data + + def upload_file_with_http_info(self, pet_id, **kwargs): + """ + uploads an image + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_http_info(pet_id, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param str additional_metadata: Additional data to pass to server + :param file file: file to upload + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'additional_metadata', 'file'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 upload_file" % 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 `upload_file`") + + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'additional_metadata' in params: + form_params.append(('additionalMetadata', params['additional_metadata'])) + if 'file' in params: + local_var_files['file'] = params['file'] + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json']) + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['multipart/form-data']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api('/pet/{petId}/uploadImage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ApiResponse', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/store_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/store_api.py new file mode 100644 index 00000000000..e9d9599c363 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/store_api.py @@ -0,0 +1,408 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class StoreApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_order(self, order_id, **kwargs): + """ + Delete purchase order by ID + 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 pass async=True + >>> thread = api.delete_order(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param str order_id: ID of the order that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_order_with_http_info(order_id, **kwargs) + else: + (data) = self.delete_order_with_http_info(order_id, **kwargs) + return data + + def delete_order_with_http_info(self, order_id, **kwargs): + """ + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_order_with_http_info(order_id, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order/{order_id}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_inventory(self, **kwargs): + """ + Returns pet inventories by status + Returns a map of status codes to quantities + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_inventory(async=True) + >>> result = thread.get() + + :param async bool + :return: dict(str, int) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_inventory_with_http_info(**kwargs) + else: + (data) = self.get_inventory_with_http_info(**kwargs) + return data + + def get_inventory_with_http_info(self, **kwargs): + """ + Returns pet inventories by status + Returns a map of status codes to quantities + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_inventory_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: dict(str, int) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_inventory" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + 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']) + + # Authentication setting + auth_settings = ['api_key'] + + return self.api_client.call_api('/store/inventory', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, int)', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_order_by_id(self, order_id, **kwargs): + """ + Find purchase order by ID + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_order_by_id(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param int order_id: ID of pet that needs to be fetched (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_order_by_id_with_http_info(order_id, **kwargs) + else: + (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) + return data + + def get_order_by_id_with_http_info(self, order_id, **kwargs): + """ + Find purchase order by ID + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_order_by_id_with_http_info(order_id, async=True) + >>> result = thread.get() + + :param async bool + :param int order_id: ID of pet that needs to be fetched (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['order_id'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_order_by_id" % 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 `get_order_by_id`") + + if 'order_id' in params and params['order_id'] > 5: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") + if 'order_id' in params and params['order_id'] < 1: + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") + + collection_formats = {} + + path_params = {} + if 'order_id' in params: + path_params['order_id'] = 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order/{order_id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Order', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def place_order(self, body, **kwargs): + """ + Place an order for a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.place_order(body, async=True) + >>> result = thread.get() + + :param async bool + :param Order body: order placed for purchasing the pet (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.place_order_with_http_info(body, **kwargs) + else: + (data) = self.place_order_with_http_info(body, **kwargs) + return data + + def place_order_with_http_info(self, body, **kwargs): + """ + Place an order for a pet + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.place_order_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param Order body: order placed for purchasing the pet (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 place_order" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `place_order`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/store/order', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Order', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/apis/user_api.py b/samples/client/petstore/python-tornado/petstore_api/apis/user_api.py new file mode 100644 index 00000000000..ffdad2dd60f --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/apis/user_api.py @@ -0,0 +1,794 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..api_client import ApiClient + + +class UserApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_user(self, body, **kwargs): + """ + Create user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_user(body, async=True) + >>> result = thread.get() + + :param async bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_user_with_http_info(body, **kwargs) + else: + (data) = self.create_user_with_http_info(body, **kwargs) + return data + + def create_user_with_http_info(self, body, **kwargs): + """ + Create user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_user_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param User body: Created user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_user" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_user`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_users_with_array_input(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_array_input(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_users_with_array_input_with_http_info(body, **kwargs) + else: + (data) = self.create_users_with_array_input_with_http_info(body, **kwargs) + return data + + def create_users_with_array_input_with_http_info(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_array_input_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_users_with_array_input" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/createWithArray', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def create_users_with_list_input(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_list_input(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.create_users_with_list_input_with_http_info(body, **kwargs) + else: + (data) = self.create_users_with_list_input_with_http_info(body, **kwargs) + return data + + def create_users_with_list_input_with_http_info(self, body, **kwargs): + """ + Creates list of users with given input array + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.create_users_with_list_input_with_http_info(body, async=True) + >>> result = thread.get() + + :param async bool + :param list[User] body: List of user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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 create_users_with_list_input" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") + + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/createWithList', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.delete_user(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.delete_user_with_http_info(username, **kwargs) + else: + (data) = self.delete_user_with_http_info(username, **kwargs) + return data + + def delete_user_with_http_info(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.delete_user_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :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('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_name(self, username, **kwargs): + """ + Get user by user name + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_user_by_name(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_user_by_name_with_http_info(username, **kwargs) + else: + (data) = self.get_user_by_name_with_http_info(username, **kwargs) + return data + + def get_user_by_name_with_http_info(self, username, **kwargs): + """ + Get user by user name + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_user_by_name_with_http_info(username, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_user_by_name" % 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 `get_user_by_name`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def login_user(self, username, password, **kwargs): + """ + Logs user into the system + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.login_user(username, password, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.login_user_with_http_info(username, password, **kwargs) + else: + (data) = self.login_user_with_http_info(username, password, **kwargs) + return data + + def login_user_with_http_info(self, username, password, **kwargs): + """ + Logs user into the system + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.login_user_with_http_info(username, password, async=True) + >>> result = thread.get() + + :param async bool + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username', 'password'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + # 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 `login_user`") + # verify the required parameter 'password' is set + if ('password' not in params) or (params['password'] is None): + raise ValueError("Missing the required parameter `password` when calling `login_user`") + + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'username' in params: + query_params.append(('username', params['username'])) + if 'password' in params: + query_params.append(('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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/login', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + 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 pass async=True + >>> thread = api.logout_user(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.logout_user_with_http_info(**kwargs) + else: + (data) = self.logout_user_with_http_info(**kwargs) + return data + + def logout_user_with_http_info(self, **kwargs): + """ + Logs out current logged in user session + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.logout_user_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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'] + + collection_formats = {} + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/logout', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_user(self, username, body, **kwargs): + """ + Updated user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_user(username, body, async=True) + >>> result = thread.get() + + :param async bool + :param str username: name that need to be deleted (required) + :param User body: Updated user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.update_user_with_http_info(username, body, **kwargs) + else: + (data) = self.update_user_with_http_info(username, body, **kwargs) + return data + + def update_user_with_http_info(self, username, body, **kwargs): + """ + Updated user + This can only be done by the logged in user. + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.update_user_with_http_info(username, body, async=True) + >>> result = thread.get() + + :param async bool + :param str username: name that need to be deleted (required) + :param User body: Updated user object (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username', 'body'] + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + 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_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 `update_user`") + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_user`") + + + collection_formats = {} + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + 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/xml', 'application/json']) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/user/{username}', '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, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/configuration.py b/samples/client/petstore/python-tornado/petstore_api/configuration.py new file mode 100644 index 00000000000..9e1fcf24089 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/configuration.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import urllib3 + +import logging +import multiprocessing +import sys + +from six import iteritems +from six.moves import http_client as httplib + + +class Configuration(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Ref: https://github.com/swagger-api/swagger-codegen + Do not edit the class manually. + """ + + def __init__(self): + """ + Constructor + """ + # Default Base url + self.host = "http://petstore.swagger.io:80/v2" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # access token for OAuth + self.access_token = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("petstore_api") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @property + def logger_file(self): + """ + Gets the logger_file. + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """ + Sets the logger_file. + + If the logger_file is None, then add stream handler and remove file handler. + Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """ + Gets the debug status. + """ + return self.__debug + + @debug.setter + def debug(self, value): + """ + Sets the debug status. + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """ + Gets the logger_format. + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """ + Sets the logger_format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """ + Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :return: The token for api key authentication. + """ + if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] + elif self.api_key.get(identifier): + return self.api_key[identifier] + + def get_basic_auth_token(self): + """ + Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\ + .get('authorization') + + def auth_settings(self): + """ + Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + return { + 'api_key': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, + 'api_key_query': + { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix('api_key_query') + }, + 'http_basic_test': + { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, + + 'petstore_auth': + { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, + + } + + def to_debug_report(self): + """ + Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.0.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py new file mode 100644 index 00000000000..21b5d20fa3c --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +# import models into model package +from .additional_properties_class import AdditionalPropertiesClass +from .animal import Animal +from .animal_farm import AnimalFarm +from .api_response import ApiResponse +from .array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from .array_of_number_only import ArrayOfNumberOnly +from .array_test import ArrayTest +from .capitalization import Capitalization +from .category import Category +from .class_model import ClassModel +from .client import Client +from .enum_arrays import EnumArrays +from .enum_class import EnumClass +from .enum_test import EnumTest +from .format_test import FormatTest +from .has_only_read_only import HasOnlyReadOnly +from .list import List +from .map_test import MapTest +from .mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from .model_200_response import Model200Response +from .model_return import ModelReturn +from .name import Name +from .number_only import NumberOnly +from .order import Order +from .outer_boolean import OuterBoolean +from .outer_composite import OuterComposite +from .outer_enum import OuterEnum +from .outer_number import OuterNumber +from .outer_string import OuterString +from .pet import Pet +from .read_only_first import ReadOnlyFirst +from .special_model_name import SpecialModelName +from .tag import Tag +from .user import User +from .cat import Cat +from .dog import Dog diff --git a/samples/client/petstore/python-tornado/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-tornado/petstore_api/models/additional_properties_class.py new file mode 100644 index 00000000000..a5329b411cd --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/additional_properties_class.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class AdditionalPropertiesClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'map_property': 'dict(str, str)', + 'map_of_map_property': 'dict(str, dict(str, str))' + } + + attribute_map = { + 'map_property': 'map_property', + 'map_of_map_property': 'map_of_map_property' + } + + def __init__(self, map_property=None, map_of_map_property=None): + """ + AdditionalPropertiesClass - a model defined in Swagger + """ + + self._map_property = None + self._map_of_map_property = None + self.discriminator = None + + if map_property is not None: + self.map_property = map_property + if map_of_map_property is not None: + self.map_of_map_property = map_of_map_property + + @property + def map_property(self): + """ + Gets the map_property of this AdditionalPropertiesClass. + + :return: The map_property of this AdditionalPropertiesClass. + :rtype: dict(str, str) + """ + return self._map_property + + @map_property.setter + def map_property(self, map_property): + """ + Sets the map_property of this AdditionalPropertiesClass. + + :param map_property: The map_property of this AdditionalPropertiesClass. + :type: dict(str, str) + """ + + self._map_property = map_property + + @property + def map_of_map_property(self): + """ + Gets the map_of_map_property of this AdditionalPropertiesClass. + + :return: The map_of_map_property of this AdditionalPropertiesClass. + :rtype: dict(str, dict(str, str)) + """ + return self._map_of_map_property + + @map_of_map_property.setter + def map_of_map_property(self, map_of_map_property): + """ + Sets the map_of_map_property of this AdditionalPropertiesClass. + + :param map_of_map_property: The map_of_map_property of this AdditionalPropertiesClass. + :type: dict(str, dict(str, str)) + """ + + self._map_of_map_property = map_of_map_property + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, AdditionalPropertiesClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/animal.py b/samples/client/petstore/python-tornado/petstore_api/models/animal.py new file mode 100644 index 00000000000..13d8276713d --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/animal.py @@ -0,0 +1,166 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Animal(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'class_name': 'str', + 'color': 'str' + } + + attribute_map = { + 'class_name': 'className', + 'color': 'color' + } + + discriminator_value_class_map = { + '': 'Dog', + '': 'Cat' + } + + def __init__(self, class_name=None, color='red'): + """ + Animal - a model defined in Swagger + """ + + self._class_name = None + self._color = None + self.discriminator = 'className' + + self.class_name = class_name + if color is not None: + self.color = color + + @property + def class_name(self): + """ + Gets the class_name of this Animal. + + :return: The class_name of this Animal. + :rtype: str + """ + return self._class_name + + @class_name.setter + def class_name(self, class_name): + """ + Sets the class_name of this Animal. + + :param class_name: The class_name of this Animal. + :type: str + """ + if class_name is None: + raise ValueError("Invalid value for `class_name`, must not be `None`") + + self._class_name = class_name + + @property + def color(self): + """ + Gets the color of this Animal. + + :return: The color of this Animal. + :rtype: str + """ + return self._color + + @color.setter + def color(self, color): + """ + Sets the color of this Animal. + + :param color: The color of this Animal. + :type: str + """ + + self._color = color + + def get_real_child_model(self, data): + """ + Returns the real base class specified by the discriminator + """ + discriminator_value = data[self.discriminator].lower() + if self.discriminator_value_class_map.has_key(discriminator_value): + return self.discriminator_value_class_map[discriminator_value] + else: + return None + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Animal): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py b/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py new file mode 100644 index 00000000000..fa47d63f881 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/animal_farm.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class AnimalFarm(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + AnimalFarm - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, AnimalFarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/api_response.py b/samples/client/petstore/python-tornado/petstore_api/models/api_response.py new file mode 100644 index 00000000000..b2d784d8020 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/api_response.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ApiResponse(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'code': 'int', + 'type': 'str', + 'message': 'str' + } + + attribute_map = { + 'code': 'code', + 'type': 'type', + 'message': 'message' + } + + def __init__(self, code=None, type=None, message=None): + """ + ApiResponse - a model defined in Swagger + """ + + self._code = None + self._type = None + self._message = None + self.discriminator = None + + if code is not None: + self.code = code + if type is not None: + self.type = type + if message is not None: + self.message = message + + @property + def code(self): + """ + Gets the code of this ApiResponse. + + :return: The code of this ApiResponse. + :rtype: int + """ + return self._code + + @code.setter + def code(self, code): + """ + Sets the code of this ApiResponse. + + :param code: The code of this ApiResponse. + :type: int + """ + + self._code = code + + @property + def type(self): + """ + Gets the type of this ApiResponse. + + :return: The type of this ApiResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """ + Sets the type of this ApiResponse. + + :param type: The type of this ApiResponse. + :type: str + """ + + self._type = type + + @property + def message(self): + """ + Gets the message of this ApiResponse. + + :return: The message of this ApiResponse. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """ + Sets the message of this ApiResponse. + + :param message: The message of this ApiResponse. + :type: str + """ + + self._message = message + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ApiResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-tornado/petstore_api/models/array_of_array_of_number_only.py new file mode 100644 index 00000000000..0792f5a8a23 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/array_of_array_of_number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayOfArrayOfNumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_array_number': 'list[list[float]]' + } + + attribute_map = { + 'array_array_number': 'ArrayArrayNumber' + } + + def __init__(self, array_array_number=None): + """ + ArrayOfArrayOfNumberOnly - a model defined in Swagger + """ + + self._array_array_number = None + self.discriminator = None + + if array_array_number is not None: + self.array_array_number = array_array_number + + @property + def array_array_number(self): + """ + Gets the array_array_number of this ArrayOfArrayOfNumberOnly. + + :return: The array_array_number of this ArrayOfArrayOfNumberOnly. + :rtype: list[list[float]] + """ + return self._array_array_number + + @array_array_number.setter + def array_array_number(self, array_array_number): + """ + Sets the array_array_number of this ArrayOfArrayOfNumberOnly. + + :param array_array_number: The array_array_number of this ArrayOfArrayOfNumberOnly. + :type: list[list[float]] + """ + + self._array_array_number = array_array_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayOfArrayOfNumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-tornado/petstore_api/models/array_of_number_only.py new file mode 100644 index 00000000000..9d00e1b37a2 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/array_of_number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayOfNumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_number': 'list[float]' + } + + attribute_map = { + 'array_number': 'ArrayNumber' + } + + def __init__(self, array_number=None): + """ + ArrayOfNumberOnly - a model defined in Swagger + """ + + self._array_number = None + self.discriminator = None + + if array_number is not None: + self.array_number = array_number + + @property + def array_number(self): + """ + Gets the array_number of this ArrayOfNumberOnly. + + :return: The array_number of this ArrayOfNumberOnly. + :rtype: list[float] + """ + return self._array_number + + @array_number.setter + def array_number(self, array_number): + """ + Sets the array_number of this ArrayOfNumberOnly. + + :param array_number: The array_number of this ArrayOfNumberOnly. + :type: list[float] + """ + + self._array_number = array_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayOfNumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/array_test.py b/samples/client/petstore/python-tornado/petstore_api/models/array_test.py new file mode 100644 index 00000000000..ac3079087c8 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/array_test.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ArrayTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'array_of_string': 'list[str]', + 'array_array_of_integer': 'list[list[int]]', + 'array_array_of_model': 'list[list[ReadOnlyFirst]]' + } + + attribute_map = { + 'array_of_string': 'array_of_string', + 'array_array_of_integer': 'array_array_of_integer', + 'array_array_of_model': 'array_array_of_model' + } + + def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): + """ + ArrayTest - a model defined in Swagger + """ + + self._array_of_string = None + self._array_array_of_integer = None + self._array_array_of_model = None + self.discriminator = None + + if array_of_string is not None: + self.array_of_string = array_of_string + if array_array_of_integer is not None: + self.array_array_of_integer = array_array_of_integer + if array_array_of_model is not None: + self.array_array_of_model = array_array_of_model + + @property + def array_of_string(self): + """ + Gets the array_of_string of this ArrayTest. + + :return: The array_of_string of this ArrayTest. + :rtype: list[str] + """ + return self._array_of_string + + @array_of_string.setter + def array_of_string(self, array_of_string): + """ + Sets the array_of_string of this ArrayTest. + + :param array_of_string: The array_of_string of this ArrayTest. + :type: list[str] + """ + + self._array_of_string = array_of_string + + @property + def array_array_of_integer(self): + """ + Gets the array_array_of_integer of this ArrayTest. + + :return: The array_array_of_integer of this ArrayTest. + :rtype: list[list[int]] + """ + return self._array_array_of_integer + + @array_array_of_integer.setter + def array_array_of_integer(self, array_array_of_integer): + """ + Sets the array_array_of_integer of this ArrayTest. + + :param array_array_of_integer: The array_array_of_integer of this ArrayTest. + :type: list[list[int]] + """ + + self._array_array_of_integer = array_array_of_integer + + @property + def array_array_of_model(self): + """ + Gets the array_array_of_model of this ArrayTest. + + :return: The array_array_of_model of this ArrayTest. + :rtype: list[list[ReadOnlyFirst]] + """ + return self._array_array_of_model + + @array_array_of_model.setter + def array_array_of_model(self, array_array_of_model): + """ + Sets the array_array_of_model of this ArrayTest. + + :param array_array_of_model: The array_array_of_model of this ArrayTest. + :type: list[list[ReadOnlyFirst]] + """ + + self._array_array_of_model = array_array_of_model + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ArrayTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/capitalization.py b/samples/client/petstore/python-tornado/petstore_api/models/capitalization.py new file mode 100644 index 00000000000..c9be6ed4d15 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/capitalization.py @@ -0,0 +1,256 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Capitalization(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'small_camel': 'str', + 'capital_camel': 'str', + 'small_snake': 'str', + 'capital_snake': 'str', + 'sca_eth_flow_points': 'str', + 'att_name': 'str' + } + + attribute_map = { + 'small_camel': 'smallCamel', + 'capital_camel': 'CapitalCamel', + 'small_snake': 'small_Snake', + 'capital_snake': 'Capital_Snake', + 'sca_eth_flow_points': 'SCA_ETH_Flow_Points', + 'att_name': 'ATT_NAME' + } + + def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): + """ + Capitalization - a model defined in Swagger + """ + + self._small_camel = None + self._capital_camel = None + self._small_snake = None + self._capital_snake = None + self._sca_eth_flow_points = None + self._att_name = None + self.discriminator = None + + if small_camel is not None: + self.small_camel = small_camel + if capital_camel is not None: + self.capital_camel = capital_camel + if small_snake is not None: + self.small_snake = small_snake + if capital_snake is not None: + self.capital_snake = capital_snake + if sca_eth_flow_points is not None: + self.sca_eth_flow_points = sca_eth_flow_points + if att_name is not None: + self.att_name = att_name + + @property + def small_camel(self): + """ + Gets the small_camel of this Capitalization. + + :return: The small_camel of this Capitalization. + :rtype: str + """ + return self._small_camel + + @small_camel.setter + def small_camel(self, small_camel): + """ + Sets the small_camel of this Capitalization. + + :param small_camel: The small_camel of this Capitalization. + :type: str + """ + + self._small_camel = small_camel + + @property + def capital_camel(self): + """ + Gets the capital_camel of this Capitalization. + + :return: The capital_camel of this Capitalization. + :rtype: str + """ + return self._capital_camel + + @capital_camel.setter + def capital_camel(self, capital_camel): + """ + Sets the capital_camel of this Capitalization. + + :param capital_camel: The capital_camel of this Capitalization. + :type: str + """ + + self._capital_camel = capital_camel + + @property + def small_snake(self): + """ + Gets the small_snake of this Capitalization. + + :return: The small_snake of this Capitalization. + :rtype: str + """ + return self._small_snake + + @small_snake.setter + def small_snake(self, small_snake): + """ + Sets the small_snake of this Capitalization. + + :param small_snake: The small_snake of this Capitalization. + :type: str + """ + + self._small_snake = small_snake + + @property + def capital_snake(self): + """ + Gets the capital_snake of this Capitalization. + + :return: The capital_snake of this Capitalization. + :rtype: str + """ + return self._capital_snake + + @capital_snake.setter + def capital_snake(self, capital_snake): + """ + Sets the capital_snake of this Capitalization. + + :param capital_snake: The capital_snake of this Capitalization. + :type: str + """ + + self._capital_snake = capital_snake + + @property + def sca_eth_flow_points(self): + """ + Gets the sca_eth_flow_points of this Capitalization. + + :return: The sca_eth_flow_points of this Capitalization. + :rtype: str + """ + return self._sca_eth_flow_points + + @sca_eth_flow_points.setter + def sca_eth_flow_points(self, sca_eth_flow_points): + """ + Sets the sca_eth_flow_points of this Capitalization. + + :param sca_eth_flow_points: The sca_eth_flow_points of this Capitalization. + :type: str + """ + + self._sca_eth_flow_points = sca_eth_flow_points + + @property + def att_name(self): + """ + Gets the att_name of this Capitalization. + Name of the pet + + :return: The att_name of this Capitalization. + :rtype: str + """ + return self._att_name + + @att_name.setter + def att_name(self, att_name): + """ + Sets the att_name of this Capitalization. + Name of the pet + + :param att_name: The att_name of this Capitalization. + :type: str + """ + + self._att_name = att_name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Capitalization): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/cat.py b/samples/client/petstore/python-tornado/petstore_api/models/cat.py new file mode 100644 index 00000000000..76dfdc0e5b1 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/cat.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Cat(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'declawed': 'bool' + } + + attribute_map = { + 'declawed': 'declawed' + } + + def __init__(self, declawed=None): + """ + Cat - a model defined in Swagger + """ + + self._declawed = None + self.discriminator = None + + if declawed is not None: + self.declawed = declawed + + @property + def declawed(self): + """ + Gets the declawed of this Cat. + + :return: The declawed of this Cat. + :rtype: bool + """ + return self._declawed + + @declawed.setter + def declawed(self, declawed): + """ + Sets the declawed of this Cat. + + :param declawed: The declawed of this Cat. + :type: bool + """ + + self._declawed = declawed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Cat): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/category.py b/samples/client/petstore/python-tornado/petstore_api/models/category.py new file mode 100644 index 00000000000..859283a3f77 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/category.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Category(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): + """ + Category - a model defined in Swagger + """ + + self._id = None + self._name = None + self.discriminator = None + + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """ + Gets the id of this Category. + + :return: The id of this Category. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Category. + + :param id: The id of this Category. + :type: int + """ + + self._id = id + + @property + def name(self): + """ + Gets the name of this Category. + + :return: The name of this Category. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Category. + + :param name: The name of this Category. + :type: str + """ + + self._name = name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Category): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/class_model.py b/samples/client/petstore/python-tornado/petstore_api/models/class_model.py new file mode 100644 index 00000000000..7b39d38abe9 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/class_model.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ClassModel(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_class': 'str' + } + + attribute_map = { + '_class': '_class' + } + + def __init__(self, _class=None): + """ + ClassModel - a model defined in Swagger + """ + + self.__class = None + self.discriminator = None + + if _class is not None: + self._class = _class + + @property + def _class(self): + """ + Gets the _class of this ClassModel. + + :return: The _class of this ClassModel. + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """ + Sets the _class of this ClassModel. + + :param _class: The _class of this ClassModel. + :type: str + """ + + self.__class = _class + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ClassModel): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/client.py b/samples/client/petstore/python-tornado/petstore_api/models/client.py new file mode 100644 index 00000000000..395f77913cc --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/client.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Client(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client': 'str' + } + + attribute_map = { + 'client': 'client' + } + + def __init__(self, client=None): + """ + Client - a model defined in Swagger + """ + + self._client = None + self.discriminator = None + + if client is not None: + self.client = client + + @property + def client(self): + """ + Gets the client of this Client. + + :return: The client of this Client. + :rtype: str + """ + return self._client + + @client.setter + def client(self, client): + """ + Sets the client of this Client. + + :param client: The client of this Client. + :type: str + """ + + self._client = client + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Client): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/dog.py b/samples/client/petstore/python-tornado/petstore_api/models/dog.py new file mode 100644 index 00000000000..3c159ad0d6f --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/dog.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Dog(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'breed': 'str' + } + + attribute_map = { + 'breed': 'breed' + } + + def __init__(self, breed=None): + """ + Dog - a model defined in Swagger + """ + + self._breed = None + self.discriminator = None + + if breed is not None: + self.breed = breed + + @property + def breed(self): + """ + Gets the breed of this Dog. + + :return: The breed of this Dog. + :rtype: str + """ + return self._breed + + @breed.setter + def breed(self, breed): + """ + Sets the breed of this Dog. + + :param breed: The breed of this Dog. + :type: str + """ + + self._breed = breed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Dog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-tornado/petstore_api/models/enum_arrays.py new file mode 100644 index 00000000000..893085ea235 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/enum_arrays.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumArrays(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'just_symbol': 'str', + 'array_enum': 'list[str]' + } + + attribute_map = { + 'just_symbol': 'just_symbol', + 'array_enum': 'array_enum' + } + + def __init__(self, just_symbol=None, array_enum=None): + """ + EnumArrays - a model defined in Swagger + """ + + self._just_symbol = None + self._array_enum = None + self.discriminator = None + + if just_symbol is not None: + self.just_symbol = just_symbol + if array_enum is not None: + self.array_enum = array_enum + + @property + def just_symbol(self): + """ + Gets the just_symbol of this EnumArrays. + + :return: The just_symbol of this EnumArrays. + :rtype: str + """ + return self._just_symbol + + @just_symbol.setter + def just_symbol(self, just_symbol): + """ + Sets the just_symbol of this EnumArrays. + + :param just_symbol: The just_symbol of this EnumArrays. + :type: str + """ + allowed_values = [">=", "$"] + if just_symbol not in allowed_values: + raise ValueError( + "Invalid value for `just_symbol` ({0}), must be one of {1}" + .format(just_symbol, allowed_values) + ) + + self._just_symbol = just_symbol + + @property + def array_enum(self): + """ + Gets the array_enum of this EnumArrays. + + :return: The array_enum of this EnumArrays. + :rtype: list[str] + """ + return self._array_enum + + @array_enum.setter + def array_enum(self, array_enum): + """ + Sets the array_enum of this EnumArrays. + + :param array_enum: The array_enum of this EnumArrays. + :type: list[str] + """ + allowed_values = ["fish", "crab"] + if not set(array_enum).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `array_enum` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set(array_enum)-set(allowed_values))), + ", ".join(map(str, allowed_values))) + ) + + self._array_enum = array_enum + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumArrays): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/enum_class.py b/samples/client/petstore/python-tornado/petstore_api/models/enum_class.py new file mode 100644 index 00000000000..d9e0b771a7d --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/enum_class.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + """ + allowed enum values + """ + _ABC = "_abc" + _EFG = "-efg" + _XYZ_ = "(xyz)" + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + EnumClass - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py b/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py new file mode 100644 index 00000000000..6d7caa1f4bc --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/enum_test.py @@ -0,0 +1,220 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class EnumTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enum_string': 'str', + 'enum_integer': 'int', + 'enum_number': 'float', + 'outer_enum': 'OuterEnum' + } + + attribute_map = { + 'enum_string': 'enum_string', + 'enum_integer': 'enum_integer', + 'enum_number': 'enum_number', + 'outer_enum': 'outerEnum' + } + + def __init__(self, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): + """ + EnumTest - a model defined in Swagger + """ + + self._enum_string = None + self._enum_integer = None + self._enum_number = None + self._outer_enum = None + self.discriminator = None + + if enum_string is not None: + self.enum_string = enum_string + if enum_integer is not None: + self.enum_integer = enum_integer + if enum_number is not None: + self.enum_number = enum_number + if outer_enum is not None: + self.outer_enum = outer_enum + + @property + def enum_string(self): + """ + Gets the enum_string of this EnumTest. + + :return: The enum_string of this EnumTest. + :rtype: str + """ + return self._enum_string + + @enum_string.setter + def enum_string(self, enum_string): + """ + Sets the enum_string of this EnumTest. + + :param enum_string: The enum_string of this EnumTest. + :type: str + """ + allowed_values = ["UPPER", "lower", ""] + if enum_string not in allowed_values: + raise ValueError( + "Invalid value for `enum_string` ({0}), must be one of {1}" + .format(enum_string, allowed_values) + ) + + self._enum_string = enum_string + + @property + def enum_integer(self): + """ + Gets the enum_integer of this EnumTest. + + :return: The enum_integer of this EnumTest. + :rtype: int + """ + return self._enum_integer + + @enum_integer.setter + def enum_integer(self, enum_integer): + """ + Sets the enum_integer of this EnumTest. + + :param enum_integer: The enum_integer of this EnumTest. + :type: int + """ + allowed_values = [1, -1] + if enum_integer not in allowed_values: + raise ValueError( + "Invalid value for `enum_integer` ({0}), must be one of {1}" + .format(enum_integer, allowed_values) + ) + + self._enum_integer = enum_integer + + @property + def enum_number(self): + """ + Gets the enum_number of this EnumTest. + + :return: The enum_number of this EnumTest. + :rtype: float + """ + return self._enum_number + + @enum_number.setter + def enum_number(self, enum_number): + """ + Sets the enum_number of this EnumTest. + + :param enum_number: The enum_number of this EnumTest. + :type: float + """ + allowed_values = [1.1, -1.2] + if enum_number not in allowed_values: + raise ValueError( + "Invalid value for `enum_number` ({0}), must be one of {1}" + .format(enum_number, allowed_values) + ) + + self._enum_number = enum_number + + @property + def outer_enum(self): + """ + Gets the outer_enum of this EnumTest. + + :return: The outer_enum of this EnumTest. + :rtype: OuterEnum + """ + return self._outer_enum + + @outer_enum.setter + def outer_enum(self, outer_enum): + """ + Sets the outer_enum of this EnumTest. + + :param outer_enum: The outer_enum of this EnumTest. + :type: OuterEnum + """ + + self._outer_enum = outer_enum + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, EnumTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/format_test.py b/samples/client/petstore/python-tornado/petstore_api/models/format_test.py new file mode 100644 index 00000000000..139d1733b35 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/format_test.py @@ -0,0 +1,468 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class FormatTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'integer': 'int', + 'int32': 'int', + 'int64': 'int', + 'number': 'float', + 'float': 'float', + 'double': 'float', + 'string': 'str', + 'byte': 'str', + 'binary': 'str', + 'date': 'date', + 'date_time': 'datetime', + 'uuid': 'str', + 'password': 'str' + } + + attribute_map = { + 'integer': 'integer', + 'int32': 'int32', + 'int64': 'int64', + 'number': 'number', + 'float': 'float', + 'double': 'double', + 'string': 'string', + 'byte': 'byte', + 'binary': 'binary', + 'date': 'date', + 'date_time': 'dateTime', + 'uuid': 'uuid', + 'password': 'password' + } + + def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): + """ + FormatTest - a model defined in Swagger + """ + + self._integer = None + self._int32 = None + self._int64 = None + self._number = None + self._float = None + self._double = None + self._string = None + self._byte = None + self._binary = None + self._date = None + self._date_time = None + self._uuid = None + self._password = None + self.discriminator = None + + if integer is not None: + self.integer = integer + if int32 is not None: + self.int32 = int32 + if int64 is not None: + self.int64 = int64 + self.number = number + if float is not None: + self.float = float + if double is not None: + self.double = double + if string is not None: + self.string = string + self.byte = byte + if binary is not None: + self.binary = binary + self.date = date + if date_time is not None: + self.date_time = date_time + if uuid is not None: + self.uuid = uuid + self.password = password + + @property + def integer(self): + """ + Gets the integer of this FormatTest. + + :return: The integer of this FormatTest. + :rtype: int + """ + return self._integer + + @integer.setter + def integer(self, integer): + """ + Sets the integer of this FormatTest. + + :param integer: The integer of this FormatTest. + :type: int + """ + if integer is not None and integer > 100: + raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") + if integer is not None and integer < 10: + raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") + + self._integer = integer + + @property + def int32(self): + """ + Gets the int32 of this FormatTest. + + :return: The int32 of this FormatTest. + :rtype: int + """ + return self._int32 + + @int32.setter + def int32(self, int32): + """ + Sets the int32 of this FormatTest. + + :param int32: The int32 of this FormatTest. + :type: int + """ + if int32 is not None and int32 > 200: + raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") + if int32 is not None and int32 < 20: + raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") + + self._int32 = int32 + + @property + def int64(self): + """ + Gets the int64 of this FormatTest. + + :return: The int64 of this FormatTest. + :rtype: int + """ + return self._int64 + + @int64.setter + def int64(self, int64): + """ + Sets the int64 of this FormatTest. + + :param int64: The int64 of this FormatTest. + :type: int + """ + + self._int64 = int64 + + @property + def number(self): + """ + Gets the number of this FormatTest. + + :return: The number of this FormatTest. + :rtype: float + """ + return self._number + + @number.setter + def number(self, number): + """ + Sets the number of this FormatTest. + + :param number: The number of this FormatTest. + :type: float + """ + if number is None: + raise ValueError("Invalid value for `number`, must not be `None`") + if number is not None and number > 543.2: + raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") + if number is not None and number < 32.1: + raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") + + self._number = number + + @property + def float(self): + """ + Gets the float of this FormatTest. + + :return: The float of this FormatTest. + :rtype: float + """ + return self._float + + @float.setter + def float(self, float): + """ + Sets the float of this FormatTest. + + :param float: The float of this FormatTest. + :type: float + """ + if float is not None and float > 987.6: + raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") + if float is not None and float < 54.3: + raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") + + self._float = float + + @property + def double(self): + """ + Gets the double of this FormatTest. + + :return: The double of this FormatTest. + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """ + Sets the double of this FormatTest. + + :param double: The double of this FormatTest. + :type: float + """ + if double is not None and double > 123.4: + raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") + if double is not None and double < 67.8: + raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") + + self._double = double + + @property + def string(self): + """ + Gets the string of this FormatTest. + + :return: The string of this FormatTest. + :rtype: str + """ + return self._string + + @string.setter + def string(self, string): + """ + Sets the string of this FormatTest. + + :param string: The string of this FormatTest. + :type: str + """ + if string is not None and not re.search('[a-z]', string, flags=re.IGNORECASE): + raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") + + self._string = string + + @property + def byte(self): + """ + Gets the byte of this FormatTest. + + :return: The byte of this FormatTest. + :rtype: str + """ + return self._byte + + @byte.setter + def byte(self, byte): + """ + Sets the byte of this FormatTest. + + :param byte: The byte of this FormatTest. + :type: str + """ + if byte is None: + raise ValueError("Invalid value for `byte`, must not be `None`") + if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): + raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") + + self._byte = byte + + @property + def binary(self): + """ + Gets the binary of this FormatTest. + + :return: The binary of this FormatTest. + :rtype: str + """ + return self._binary + + @binary.setter + def binary(self, binary): + """ + Sets the binary of this FormatTest. + + :param binary: The binary of this FormatTest. + :type: str + """ + + self._binary = binary + + @property + def date(self): + """ + Gets the date of this FormatTest. + + :return: The date of this FormatTest. + :rtype: date + """ + return self._date + + @date.setter + def date(self, date): + """ + Sets the date of this FormatTest. + + :param date: The date of this FormatTest. + :type: date + """ + if date is None: + raise ValueError("Invalid value for `date`, must not be `None`") + + self._date = date + + @property + def date_time(self): + """ + Gets the date_time of this FormatTest. + + :return: The date_time of this FormatTest. + :rtype: datetime + """ + return self._date_time + + @date_time.setter + def date_time(self, date_time): + """ + Sets the date_time of this FormatTest. + + :param date_time: The date_time of this FormatTest. + :type: datetime + """ + + self._date_time = date_time + + @property + def uuid(self): + """ + Gets the uuid of this FormatTest. + + :return: The uuid of this FormatTest. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this FormatTest. + + :param uuid: The uuid of this FormatTest. + :type: str + """ + + self._uuid = uuid + + @property + def password(self): + """ + Gets the password of this FormatTest. + + :return: The password of this FormatTest. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """ + Sets the password of this FormatTest. + + :param password: The password of this FormatTest. + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") + if password is not None and len(password) > 64: + raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") + if password is not None and len(password) < 10: + raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") + + self._password = password + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, FormatTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-tornado/petstore_api/models/has_only_read_only.py new file mode 100644 index 00000000000..da0c14ec5b1 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/has_only_read_only.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class HasOnlyReadOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bar': 'str', + 'foo': 'str' + } + + attribute_map = { + 'bar': 'bar', + 'foo': 'foo' + } + + def __init__(self, bar=None, foo=None): + """ + HasOnlyReadOnly - a model defined in Swagger + """ + + self._bar = None + self._foo = None + self.discriminator = None + + if bar is not None: + self.bar = bar + if foo is not None: + self.foo = foo + + @property + def bar(self): + """ + Gets the bar of this HasOnlyReadOnly. + + :return: The bar of this HasOnlyReadOnly. + :rtype: str + """ + return self._bar + + @bar.setter + def bar(self, bar): + """ + Sets the bar of this HasOnlyReadOnly. + + :param bar: The bar of this HasOnlyReadOnly. + :type: str + """ + + self._bar = bar + + @property + def foo(self): + """ + Gets the foo of this HasOnlyReadOnly. + + :return: The foo of this HasOnlyReadOnly. + :rtype: str + """ + return self._foo + + @foo.setter + def foo(self, foo): + """ + Sets the foo of this HasOnlyReadOnly. + + :param foo: The foo of this HasOnlyReadOnly. + :type: str + """ + + self._foo = foo + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, HasOnlyReadOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/list.py b/samples/client/petstore/python-tornado/petstore_api/models/list.py new file mode 100644 index 00000000000..2ac0e51fb12 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/list.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class List(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_123_list': 'str' + } + + attribute_map = { + '_123_list': '123-list' + } + + def __init__(self, _123_list=None): + """ + List - a model defined in Swagger + """ + + self.__123_list = None + self.discriminator = None + + if _123_list is not None: + self._123_list = _123_list + + @property + def _123_list(self): + """ + Gets the _123_list of this List. + + :return: The _123_list of this List. + :rtype: str + """ + return self.__123_list + + @_123_list.setter + def _123_list(self, _123_list): + """ + Sets the _123_list of this List. + + :param _123_list: The _123_list of this List. + :type: str + """ + + self.__123_list = _123_list + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, List): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/map_test.py b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py new file mode 100644 index 00000000000..3cb936e0db8 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class MapTest(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'map_map_of_string': 'dict(str, dict(str, str))', + 'map_of_enum_string': 'dict(str, str)' + } + + attribute_map = { + 'map_map_of_string': 'map_map_of_string', + 'map_of_enum_string': 'map_of_enum_string' + } + + def __init__(self, map_map_of_string=None, map_of_enum_string=None): + """ + MapTest - a model defined in Swagger + """ + + self._map_map_of_string = None + self._map_of_enum_string = None + self.discriminator = None + + if map_map_of_string is not None: + self.map_map_of_string = map_map_of_string + if map_of_enum_string is not None: + self.map_of_enum_string = map_of_enum_string + + @property + def map_map_of_string(self): + """ + Gets the map_map_of_string of this MapTest. + + :return: The map_map_of_string of this MapTest. + :rtype: dict(str, dict(str, str)) + """ + return self._map_map_of_string + + @map_map_of_string.setter + def map_map_of_string(self, map_map_of_string): + """ + Sets the map_map_of_string of this MapTest. + + :param map_map_of_string: The map_map_of_string of this MapTest. + :type: dict(str, dict(str, str)) + """ + + self._map_map_of_string = map_map_of_string + + @property + def map_of_enum_string(self): + """ + Gets the map_of_enum_string of this MapTest. + + :return: The map_of_enum_string of this MapTest. + :rtype: dict(str, str) + """ + return self._map_of_enum_string + + @map_of_enum_string.setter + def map_of_enum_string(self, map_of_enum_string): + """ + Sets the map_of_enum_string of this MapTest. + + :param map_of_enum_string: The map_of_enum_string of this MapTest. + :type: dict(str, str) + """ + allowed_values = ["UPPER", "lower"] + if not set(map_of_enum_string.keys()).issubset(set(allowed_values)): + raise ValueError( + "Invalid keys in `map_of_enum_string` [{0}], must be a subset of [{1}]" + .format(", ".join(map(str, set(map_of_enum_string.keys())-set(allowed_values))), + ", ".join(map(str, allowed_values))) + ) + + self._map_of_enum_string = map_of_enum_string + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, MapTest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..4b773deacef --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class MixedPropertiesAndAdditionalPropertiesClass(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'uuid': 'str', + 'date_time': 'datetime', + 'map': 'dict(str, Animal)' + } + + attribute_map = { + 'uuid': 'uuid', + 'date_time': 'dateTime', + 'map': 'map' + } + + def __init__(self, uuid=None, date_time=None, map=None): + """ + MixedPropertiesAndAdditionalPropertiesClass - a model defined in Swagger + """ + + self._uuid = None + self._date_time = None + self._map = None + self.discriminator = None + + if uuid is not None: + self.uuid = uuid + if date_time is not None: + self.date_time = date_time + if map is not None: + self.map = map + + @property + def uuid(self): + """ + Gets the uuid of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The uuid of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this MixedPropertiesAndAdditionalPropertiesClass. + + :param uuid: The uuid of this MixedPropertiesAndAdditionalPropertiesClass. + :type: str + """ + + self._uuid = uuid + + @property + def date_time(self): + """ + Gets the date_time of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The date_time of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: datetime + """ + return self._date_time + + @date_time.setter + def date_time(self, date_time): + """ + Sets the date_time of this MixedPropertiesAndAdditionalPropertiesClass. + + :param date_time: The date_time of this MixedPropertiesAndAdditionalPropertiesClass. + :type: datetime + """ + + self._date_time = date_time + + @property + def map(self): + """ + Gets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + :return: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :rtype: dict(str, Animal) + """ + return self._map + + @map.setter + def map(self, map): + """ + Sets the map of this MixedPropertiesAndAdditionalPropertiesClass. + + :param map: The map of this MixedPropertiesAndAdditionalPropertiesClass. + :type: dict(str, Animal) + """ + + self._map = map + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, MixedPropertiesAndAdditionalPropertiesClass): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/model_200_response.py b/samples/client/petstore/python-tornado/petstore_api/models/model_200_response.py new file mode 100644 index 00000000000..2b6aeb090c0 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/model_200_response.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Model200Response(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + '_class': 'str' + } + + attribute_map = { + 'name': 'name', + '_class': 'class' + } + + def __init__(self, name=None, _class=None): + """ + Model200Response - a model defined in Swagger + """ + + self._name = None + self.__class = None + self.discriminator = None + + if name is not None: + self.name = name + if _class is not None: + self._class = _class + + @property + def name(self): + """ + Gets the name of this Model200Response. + + :return: The name of this Model200Response. + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Model200Response. + + :param name: The name of this Model200Response. + :type: int + """ + + self._name = name + + @property + def _class(self): + """ + Gets the _class of this Model200Response. + + :return: The _class of this Model200Response. + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """ + Sets the _class of this Model200Response. + + :param _class: The _class of this Model200Response. + :type: str + """ + + self.__class = _class + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Model200Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/model_return.py b/samples/client/petstore/python-tornado/petstore_api/models/model_return.py new file mode 100644 index 00000000000..a2160d21dd1 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/model_return.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ModelReturn(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_return': 'int' + } + + attribute_map = { + '_return': 'return' + } + + def __init__(self, _return=None): + """ + ModelReturn - a model defined in Swagger + """ + + self.__return = None + self.discriminator = None + + if _return is not None: + self._return = _return + + @property + def _return(self): + """ + Gets the _return of this ModelReturn. + + :return: The _return of this ModelReturn. + :rtype: int + """ + return self.__return + + @_return.setter + def _return(self, _return): + """ + Sets the _return of this ModelReturn. + + :param _return: The _return of this ModelReturn. + :type: int + """ + + self.__return = _return + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ModelReturn): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/name.py b/samples/client/petstore/python-tornado/petstore_api/models/name.py new file mode 100644 index 00000000000..52b51890dde --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/name.py @@ -0,0 +1,203 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Name(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + 'snake_case': 'int', + '_property': 'str', + '_123_number': 'int' + } + + attribute_map = { + 'name': 'name', + 'snake_case': 'snake_case', + '_property': 'property', + '_123_number': '123Number' + } + + def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): + """ + Name - a model defined in Swagger + """ + + self._name = None + self._snake_case = None + self.__property = None + self.__123_number = None + self.discriminator = None + + self.name = name + if snake_case is not None: + self.snake_case = snake_case + if _property is not None: + self._property = _property + if _123_number is not None: + self._123_number = _123_number + + @property + def name(self): + """ + Gets the name of this Name. + + :return: The name of this Name. + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Name. + + :param name: The name of this Name. + :type: int + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + + 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 + + @property + def _property(self): + """ + Gets the _property of this Name. + + :return: The _property of this Name. + :rtype: str + """ + return self.__property + + @_property.setter + def _property(self, _property): + """ + Sets the _property of this Name. + + :param _property: The _property of this Name. + :type: str + """ + + self.__property = _property + + @property + def _123_number(self): + """ + Gets the _123_number of this Name. + + :return: The _123_number of this Name. + :rtype: int + """ + return self.__123_number + + @_123_number.setter + def _123_number(self, _123_number): + """ + Sets the _123_number of this Name. + + :param _123_number: The _123_number of this Name. + :type: int + """ + + self.__123_number = _123_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Name): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/number_only.py b/samples/client/petstore/python-tornado/petstore_api/models/number_only.py new file mode 100644 index 00000000000..b0e279b53a5 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/number_only.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class NumberOnly(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'just_number': 'float' + } + + attribute_map = { + 'just_number': 'JustNumber' + } + + def __init__(self, just_number=None): + """ + NumberOnly - a model defined in Swagger + """ + + self._just_number = None + self.discriminator = None + + if just_number is not None: + self.just_number = just_number + + @property + def just_number(self): + """ + Gets the just_number of this NumberOnly. + + :return: The just_number of this NumberOnly. + :rtype: float + """ + return self._just_number + + @just_number.setter + def just_number(self, just_number): + """ + Sets the just_number of this NumberOnly. + + :param just_number: The just_number of this NumberOnly. + :type: float + """ + + self._just_number = just_number + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, NumberOnly): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/order.py b/samples/client/petstore/python-tornado/petstore_api/models/order.py new file mode 100644 index 00000000000..52c7b6c227e --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/order.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Order(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'pet_id': 'int', + 'quantity': 'int', + 'ship_date': 'datetime', + 'status': 'str', + 'complete': 'bool' + } + + attribute_map = { + 'id': 'id', + 'pet_id': 'petId', + 'quantity': 'quantity', + 'ship_date': 'shipDate', + 'status': 'status', + 'complete': 'complete' + } + + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): + """ + Order - a model defined in Swagger + """ + + self._id = None + self._pet_id = None + self._quantity = None + self._ship_date = None + self._status = None + self._complete = None + self.discriminator = None + + if id is not None: + self.id = id + if pet_id is not None: + self.pet_id = pet_id + if quantity is not None: + self.quantity = quantity + if ship_date is not None: + self.ship_date = ship_date + if status is not None: + self.status = status + if complete is not None: + self.complete = complete + + @property + def id(self): + """ + Gets the id of this Order. + + :return: The id of this Order. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Order. + + :param id: The id of this Order. + :type: int + """ + + self._id = id + + @property + def pet_id(self): + """ + Gets the pet_id of this Order. + + :return: The pet_id of this Order. + :rtype: int + """ + return self._pet_id + + @pet_id.setter + def pet_id(self, pet_id): + """ + Sets the pet_id of this Order. + + :param pet_id: The pet_id of this Order. + :type: int + """ + + self._pet_id = pet_id + + @property + def quantity(self): + """ + Gets the quantity of this Order. + + :return: The quantity of this Order. + :rtype: int + """ + return self._quantity + + @quantity.setter + def quantity(self, quantity): + """ + Sets the quantity of this Order. + + :param quantity: The quantity of this Order. + :type: int + """ + + self._quantity = quantity + + @property + def ship_date(self): + """ + Gets the ship_date of this Order. + + :return: The ship_date of this Order. + :rtype: datetime + """ + return self._ship_date + + @ship_date.setter + def ship_date(self, ship_date): + """ + Sets the ship_date of this Order. + + :param ship_date: The ship_date of this Order. + :type: datetime + """ + + self._ship_date = ship_date + + @property + def status(self): + """ + Gets the status of this Order. + Order Status + + :return: The status of this Order. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """ + Sets the status of this Order. + Order Status + + :param status: The status of this Order. + :type: str + """ + allowed_values = ["placed", "approved", "delivered"] + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + @property + def complete(self): + """ + Gets the complete of this Order. + + :return: The complete of this Order. + :rtype: bool + """ + return self._complete + + @complete.setter + def complete(self, complete): + """ + Sets the complete of this Order. + + :param complete: The complete of this Order. + :type: bool + """ + + self._complete = complete + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Order): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_boolean.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_boolean.py new file mode 100644 index 00000000000..aa9aee11973 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_boolean.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterBoolean(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterBoolean - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterBoolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py new file mode 100644 index 00000000000..81611c17688 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_composite.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterComposite(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'my_number': 'OuterNumber', + 'my_string': 'OuterString', + 'my_boolean': 'OuterBoolean' + } + + attribute_map = { + 'my_number': 'my_number', + 'my_string': 'my_string', + 'my_boolean': 'my_boolean' + } + + def __init__(self, my_number=None, my_string=None, my_boolean=None): + """ + OuterComposite - a model defined in Swagger + """ + + self._my_number = None + self._my_string = None + self._my_boolean = None + self.discriminator = None + + if my_number is not None: + self.my_number = my_number + if my_string is not None: + self.my_string = my_string + if my_boolean is not None: + self.my_boolean = my_boolean + + @property + def my_number(self): + """ + Gets the my_number of this OuterComposite. + + :return: The my_number of this OuterComposite. + :rtype: OuterNumber + """ + return self._my_number + + @my_number.setter + def my_number(self, my_number): + """ + Sets the my_number of this OuterComposite. + + :param my_number: The my_number of this OuterComposite. + :type: OuterNumber + """ + + self._my_number = my_number + + @property + def my_string(self): + """ + Gets the my_string of this OuterComposite. + + :return: The my_string of this OuterComposite. + :rtype: OuterString + """ + return self._my_string + + @my_string.setter + def my_string(self, my_string): + """ + Sets the my_string of this OuterComposite. + + :param my_string: The my_string of this OuterComposite. + :type: OuterString + """ + + self._my_string = my_string + + @property + def my_boolean(self): + """ + Gets the my_boolean of this OuterComposite. + + :return: The my_boolean of this OuterComposite. + :rtype: OuterBoolean + """ + return self._my_boolean + + @my_boolean.setter + def my_boolean(self, my_boolean): + """ + Sets the my_boolean of this OuterComposite. + + :param my_boolean: The my_boolean of this OuterComposite. + :type: OuterBoolean + """ + + self._my_boolean = my_boolean + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterComposite): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_enum.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_enum.py new file mode 100644 index 00000000000..8772472c655 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_enum.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterEnum(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + """ + allowed enum values + """ + PLACED = "placed" + APPROVED = "approved" + DELIVERED = "delivered" + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterEnum - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterEnum): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_number.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_number.py new file mode 100644 index 00000000000..04c44923fb0 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_number.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterNumber(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterNumber - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterNumber): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/outer_string.py b/samples/client/petstore/python-tornado/petstore_api/models/outer_string.py new file mode 100644 index 00000000000..fd2d7c7623e --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/outer_string.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterString(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + + } + + attribute_map = { + + } + + def __init__(self): + """ + OuterString - a model defined in Swagger + """ + + self.discriminator = None + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterString): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/pet.py b/samples/client/petstore/python-tornado/petstore_api/models/pet.py new file mode 100644 index 00000000000..e1afa26f785 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/pet.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Pet(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'category': 'Category', + 'name': 'str', + 'photo_urls': 'list[str]', + 'tags': 'list[Tag]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'category': 'category', + 'name': 'name', + 'photo_urls': 'photoUrls', + 'tags': 'tags', + 'status': 'status' + } + + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): + """ + Pet - a model defined in Swagger + """ + + self._id = None + self._category = None + self._name = None + self._photo_urls = None + self._tags = None + self._status = None + self.discriminator = None + + if id is not None: + self.id = id + if category is not None: + self.category = category + self.name = name + self.photo_urls = photo_urls + if tags is not None: + self.tags = tags + if status is not None: + self.status = status + + @property + def id(self): + """ + Gets the id of this Pet. + + :return: The id of this Pet. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Pet. + + :param id: The id of this Pet. + :type: int + """ + + self._id = id + + @property + def category(self): + """ + Gets the category of this Pet. + + :return: The category of this Pet. + :rtype: Category + """ + return self._category + + @category.setter + def category(self, category): + """ + Sets the category of this Pet. + + :param category: The category of this Pet. + :type: Category + """ + + self._category = category + + @property + def name(self): + """ + Gets the name of this Pet. + + :return: The name of this Pet. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Pet. + + :param name: The name of this Pet. + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") + + self._name = name + + @property + def photo_urls(self): + """ + Gets the photo_urls of this Pet. + + :return: The photo_urls of this Pet. + :rtype: list[str] + """ + return self._photo_urls + + @photo_urls.setter + def photo_urls(self, photo_urls): + """ + Sets the photo_urls of this Pet. + + :param photo_urls: The photo_urls of this Pet. + :type: list[str] + """ + if photo_urls is None: + raise ValueError("Invalid value for `photo_urls`, must not be `None`") + + self._photo_urls = photo_urls + + @property + def tags(self): + """ + Gets the tags of this Pet. + + :return: The tags of this Pet. + :rtype: list[Tag] + """ + return self._tags + + @tags.setter + def tags(self, tags): + """ + Sets the tags of this Pet. + + :param tags: The tags of this Pet. + :type: list[Tag] + """ + + self._tags = tags + + @property + def status(self): + """ + Gets the status of this Pet. + pet status in the store + + :return: The status of this Pet. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """ + Sets the status of this Pet. + pet status in the store + + :param status: The status of this Pet. + :type: str + """ + allowed_values = ["available", "pending", "sold"] + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Pet): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/read_only_first.py b/samples/client/petstore/python-tornado/petstore_api/models/read_only_first.py new file mode 100644 index 00000000000..a26d1f33c87 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/read_only_first.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class ReadOnlyFirst(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bar': 'str', + 'baz': 'str' + } + + attribute_map = { + 'bar': 'bar', + 'baz': 'baz' + } + + def __init__(self, bar=None, baz=None): + """ + ReadOnlyFirst - a model defined in Swagger + """ + + self._bar = None + self._baz = None + self.discriminator = None + + if bar is not None: + self.bar = bar + if baz is not None: + self.baz = baz + + @property + def bar(self): + """ + Gets the bar of this ReadOnlyFirst. + + :return: The bar of this ReadOnlyFirst. + :rtype: str + """ + return self._bar + + @bar.setter + def bar(self, bar): + """ + Sets the bar of this ReadOnlyFirst. + + :param bar: The bar of this ReadOnlyFirst. + :type: str + """ + + self._bar = bar + + @property + def baz(self): + """ + Gets the baz of this ReadOnlyFirst. + + :return: The baz of this ReadOnlyFirst. + :rtype: str + """ + return self._baz + + @baz.setter + def baz(self, baz): + """ + Sets the baz of this ReadOnlyFirst. + + :param baz: The baz of this ReadOnlyFirst. + :type: str + """ + + self._baz = baz + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, ReadOnlyFirst): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/special_model_name.py b/samples/client/petstore/python-tornado/petstore_api/models/special_model_name.py new file mode 100644 index 00000000000..6be888fb9e3 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/special_model_name.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class SpecialModelName(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'special_property_name': 'int' + } + + attribute_map = { + 'special_property_name': '$special[property.name]' + } + + def __init__(self, special_property_name=None): + """ + SpecialModelName - a model defined in Swagger + """ + + self._special_property_name = None + self.discriminator = None + + if special_property_name is not None: + self.special_property_name = special_property_name + + @property + def special_property_name(self): + """ + Gets the special_property_name of this SpecialModelName. + + :return: The special_property_name of this SpecialModelName. + :rtype: int + """ + return self._special_property_name + + @special_property_name.setter + def special_property_name(self, special_property_name): + """ + Sets the special_property_name of this SpecialModelName. + + :param special_property_name: The special_property_name of this SpecialModelName. + :type: int + """ + + self._special_property_name = special_property_name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, SpecialModelName): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/tag.py b/samples/client/petstore/python-tornado/petstore_api/models/tag.py new file mode 100644 index 00000000000..d59a490a07d --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/tag.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class Tag(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): + """ + Tag - a model defined in Swagger + """ + + self._id = None + self._name = None + self.discriminator = None + + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """ + Gets the id of this Tag. + + :return: The id of this Tag. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Tag. + + :param id: The id of this Tag. + :type: int + """ + + self._id = id + + @property + def name(self): + """ + Gets the name of this Tag. + + :return: The name of this Tag. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Tag. + + :param name: The name of this Tag. + :type: str + """ + + self._name = name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, Tag): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/models/user.py b/samples/client/petstore/python-tornado/petstore_api/models/user.py new file mode 100644 index 00000000000..21993e90521 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/user.py @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class User(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'username': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'phone': 'str', + 'user_status': 'int' + } + + attribute_map = { + 'id': 'id', + 'username': 'username', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'phone': 'phone', + 'user_status': 'userStatus' + } + + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): + """ + User - a model defined in Swagger + """ + + self._id = None + self._username = None + self._first_name = None + self._last_name = None + self._email = None + self._password = None + self._phone = None + self._user_status = None + self.discriminator = None + + if id is not None: + self.id = id + if username is not None: + self.username = username + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if email is not None: + self.email = email + if password is not None: + self.password = password + if phone is not None: + self.phone = phone + if user_status is not None: + self.user_status = user_status + + @property + def id(self): + """ + Gets the id of this User. + + :return: The id of this User. + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this User. + + :param id: The id of this User. + :type: int + """ + + self._id = id + + @property + def username(self): + """ + Gets the username of this User. + + :return: The username of this User. + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """ + Sets the username of this User. + + :param username: The username of this User. + :type: str + """ + + self._username = username + + @property + def first_name(self): + """ + Gets the first_name of this User. + + :return: The first_name of this User. + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """ + Sets the first_name of this User. + + :param first_name: The first_name of this User. + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """ + Gets the last_name of this User. + + :return: The last_name of this User. + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """ + Sets the last_name of this User. + + :param last_name: The last_name of this User. + :type: str + """ + + self._last_name = last_name + + @property + def email(self): + """ + Gets the email of this User. + + :return: The email of this User. + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """ + Sets the email of this User. + + :param email: The email of this User. + :type: str + """ + + self._email = email + + @property + def password(self): + """ + Gets the password of this User. + + :return: The password of this User. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """ + Sets the password of this User. + + :param password: The password of this User. + :type: str + """ + + self._password = password + + @property + def phone(self): + """ + Gets the phone of this User. + + :return: The phone of this User. + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """ + Sets the phone of this User. + + :param phone: The phone of this User. + :type: str + """ + + self._phone = phone + + @property + def user_status(self): + """ + Gets the user_status of this User. + User Status + + :return: The user_status of this User. + :rtype: int + """ + return self._user_status + + @user_status.setter + def user_status(self, user_status): + """ + Sets the user_status of this User. + User Status + + :param user_status: The user_status of this User. + :type: int + """ + + self._user_status = user_status + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/rest.py b/samples/client/petstore/python-tornado/petstore_api/rest.py new file mode 100644 index 00000000000..dc76fcdb917 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/rest.py @@ -0,0 +1,259 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import io +import json +import ssl +import certifi +import logging +import re +import tornado +import tornado.gen +from tornado.httpclient import AsyncHTTPClient, HTTPRequest + +# python 2 and python 3 compatibility library +from six import PY3 +from six.moves.urllib.parse import urlencode +from urllib3.filepost import encode_multipart_formdata + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp, data): + self.tornado_response = resp + self.status = resp.code + self.reason = resp.reason + self.data = data + + def getheaders(self): + """ + Returns a CIMultiDictProxy of the response headers. + """ + return self.tornado_response.headers + + def getheader(self, name, default=None): + """ + Returns a given response header. + """ + return self.tornado_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=4): + # maxsize is the number of requests to host that are allowed in parallel + # ca_certs vs cert_file vs key_file + # http://stackoverflow.com/a/23957365/2985775 + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + self.ssl_context = ssl_context = ssl.SSLContext() + if configuration.cert_file: + ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + self.proxy_port = self.proxy_host = None + + # https pool manager + if configuration.proxy: + self.proxy_port = 80 + self.proxy_host = configuration.proxy + + self.pool_manager = AsyncHTTPClient() + + @tornado.gen.coroutine + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, _request_timeout=None): + """ + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: this is a non-applicable field for the AiohttpClient. + :param _request_timeout: timeout setting for this request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + request = HTTPRequest(url) + request.ssl_context = self.ssl_context + request.proxy_host = self.proxy_host + request.proxy_port = self.proxy_port + request.method = method + if headers: + request.headers = headers + if 'Content-Type' not in headers: + request.headers['Content-Type'] = 'application/json' + request.request_timeout = _request_timeout or 5 * 60 + + + post_params = post_params or {} + + if query_params: + request.url += '?' + urlencode(query_params) + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body: + body = json.dumps(body) + request.body = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': + request.body = urlencode(post_params) + # TODO: transform to multipart form + elif headers['Content-Type'] == 'multipart/form-data': + request.body = encode_multipart_formdata(post_params) + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, bytes): + request.body = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided arguments. + Please check that your arguments match declared content type.""" + raise ApiException(status=0, reason=msg) + + r = yield self.pool_manager.fetch(request) + r = RESTResponse(r, r.body) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + @tornado.gen.coroutine + def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + result = yield self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + result = yield self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None): + result = yield self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def POST(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def PUT(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def PATCH(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """ + Custom error messages for exception + """ + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format(self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/samples/client/petstore/python-tornado/requirements.txt b/samples/client/petstore/python-tornado/requirements.txt new file mode 100644 index 00000000000..bafdc07532f --- /dev/null +++ b/samples/client/petstore/python-tornado/requirements.txt @@ -0,0 +1,5 @@ +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.15.1 diff --git a/samples/client/petstore/python-tornado/setup.py b/samples/client/petstore/python-tornado/setup.py new file mode 100644 index 00000000000..7373560db31 --- /dev/null +++ b/samples/client/petstore/python-tornado/setup.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import sys +from setuptools import setup, find_packages + +NAME = "petstore-api" +VERSION = "1.0.0" +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"] +REQUIRES.append("tornado") + +setup( + name=NAME, + version=VERSION, + description="Swagger Petstore", + author_email="apiteam@swagger.io", + url="", + keywords=["Swagger", "Swagger Petstore"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + """ +) diff --git a/samples/client/petstore/python-tornado/test-requirements.txt b/samples/client/petstore/python-tornado/test-requirements.txt new file mode 100644 index 00000000000..2702246c0e6 --- /dev/null +++ b/samples/client/petstore/python-tornado/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0.3 +nose>=1.3.7 +pluggy>=0.3.1 +py>=1.4.31 +randomize>=0.13 diff --git a/samples/client/petstore/python-tornado/test/__init__.py b/samples/client/petstore/python-tornado/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/python-tornado/test/test_additional_properties_class.py b/samples/client/petstore/python-tornado/test/test_additional_properties_class.py new file mode 100644 index 00000000000..e90e5f92efc --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_additional_properties_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass + + +class TestAdditionalPropertiesClass(unittest.TestCase): + """ AdditionalPropertiesClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAdditionalPropertiesClass(self): + """ + Test AdditionalPropertiesClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_animal.py b/samples/client/petstore/python-tornado/test/test_animal.py new file mode 100644 index 00000000000..c675d583ccc --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_animal.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal import Animal + + +class TestAnimal(unittest.TestCase): + """ Animal unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnimal(self): + """ + Test Animal + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.animal.Animal() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_animal_farm.py b/samples/client/petstore/python-tornado/test/test_animal_farm.py new file mode 100644 index 00000000000..e459318a948 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_animal_farm.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.animal_farm import AnimalFarm + + +class TestAnimalFarm(unittest.TestCase): + """ AnimalFarm unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnimalFarm(self): + """ + Test AnimalFarm + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.animal_farm.AnimalFarm() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_another_fake_api.py b/samples/client/petstore/python-tornado/test/test_another_fake_api.py new file mode 100644 index 00000000000..9f562fe1134 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_another_fake_api.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.another_fake_api import AnotherFakeApi + + +class TestAnotherFakeApi(unittest.TestCase): + """ AnotherFakeApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.another_fake_api.AnotherFakeApi() + + def tearDown(self): + pass + + def test_test_special_tags(self): + """ + Test case for test_special_tags + + To test special tags + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_api_response.py b/samples/client/petstore/python-tornado/test/test_api_response.py new file mode 100644 index 00000000000..928af048b43 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_api_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.api_response import ApiResponse + + +class TestApiResponse(unittest.TestCase): + """ ApiResponse unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testApiResponse(self): + """ + Test ApiResponse + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.api_response.ApiResponse() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_array_of_array_of_number_only.py b/samples/client/petstore/python-tornado/test/test_array_of_array_of_number_only.py new file mode 100644 index 00000000000..740e45cbafd --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_array_of_array_of_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly + + +class TestArrayOfArrayOfNumberOnly(unittest.TestCase): + """ ArrayOfArrayOfNumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayOfArrayOfNumberOnly(self): + """ + Test ArrayOfArrayOfNumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_array_of_number_only.py b/samples/client/petstore/python-tornado/test/test_array_of_number_only.py new file mode 100644 index 00000000000..6da67a490b6 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_array_of_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly + + +class TestArrayOfNumberOnly(unittest.TestCase): + """ ArrayOfNumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayOfNumberOnly(self): + """ + Test ArrayOfNumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_array_test.py b/samples/client/petstore/python-tornado/test/test_array_test.py new file mode 100644 index 00000000000..dcf8cc111c0 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_array_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.array_test import ArrayTest + + +class TestArrayTest(unittest.TestCase): + """ ArrayTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testArrayTest(self): + """ + Test ArrayTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.array_test.ArrayTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_capitalization.py b/samples/client/petstore/python-tornado/test/test_capitalization.py new file mode 100644 index 00000000000..4ea6d2e3fd0 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_capitalization.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.capitalization import Capitalization + + +class TestCapitalization(unittest.TestCase): + """ Capitalization unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCapitalization(self): + """ + Test Capitalization + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.capitalization.Capitalization() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_cat.py b/samples/client/petstore/python-tornado/test/test_cat.py new file mode 100644 index 00000000000..9d9fbc50ab3 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_cat.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.cat import Cat + + +class TestCat(unittest.TestCase): + """ Cat unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCat(self): + """ + Test Cat + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.cat.Cat() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_category.py b/samples/client/petstore/python-tornado/test/test_category.py new file mode 100644 index 00000000000..6ded8f0f1ac --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_category.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.category import Category + + +class TestCategory(unittest.TestCase): + """ Category unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCategory(self): + """ + Test Category + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.category.Category() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_class_model.py b/samples/client/petstore/python-tornado/test/test_class_model.py new file mode 100644 index 00000000000..85d56bbe52a --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_class_model.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.class_model import ClassModel + + +class TestClassModel(unittest.TestCase): + """ ClassModel unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testClassModel(self): + """ + Test ClassModel + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.class_model.ClassModel() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_client.py b/samples/client/petstore/python-tornado/test/test_client.py new file mode 100644 index 00000000000..363ced2923c --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_client.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.client import Client + + +class TestClient(unittest.TestCase): + """ Client unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testClient(self): + """ + Test Client + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.client.Client() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_dog.py b/samples/client/petstore/python-tornado/test/test_dog.py new file mode 100644 index 00000000000..b0428646591 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_dog.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.dog import Dog + + +class TestDog(unittest.TestCase): + """ Dog unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDog(self): + """ + Test Dog + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.dog.Dog() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_enum_arrays.py b/samples/client/petstore/python-tornado/test/test_enum_arrays.py new file mode 100644 index 00000000000..2803f17aede --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_enum_arrays.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_arrays import EnumArrays + + +class TestEnumArrays(unittest.TestCase): + """ EnumArrays unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumArrays(self): + """ + Test EnumArrays + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_arrays.EnumArrays() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_enum_class.py b/samples/client/petstore/python-tornado/test/test_enum_class.py new file mode 100644 index 00000000000..f673e741f84 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_enum_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_class import EnumClass + + +class TestEnumClass(unittest.TestCase): + """ EnumClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumClass(self): + """ + Test EnumClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_class.EnumClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_enum_test.py b/samples/client/petstore/python-tornado/test/test_enum_test.py new file mode 100644 index 00000000000..e27c0107fd2 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_enum_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.enum_test import EnumTest + + +class TestEnumTest(unittest.TestCase): + """ EnumTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumTest(self): + """ + Test EnumTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.enum_test.EnumTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_fake_api.py b/samples/client/petstore/python-tornado/test/test_fake_api.py new file mode 100644 index 00000000000..55a02cf899c --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_fake_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_api import FakeApi + + +class TestFakeApi(unittest.TestCase): + """ FakeApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.fake_api.FakeApi() + + def tearDown(self): + pass + + def test_fake_outer_boolean_serialize(self): + """ + Test case for fake_outer_boolean_serialize + + + """ + pass + + def test_fake_outer_composite_serialize(self): + """ + Test case for fake_outer_composite_serialize + + + """ + pass + + def test_fake_outer_number_serialize(self): + """ + Test case for fake_outer_number_serialize + + + """ + pass + + def test_fake_outer_string_serialize(self): + """ + Test case for fake_outer_string_serialize + + + """ + pass + + def test_test_client_model(self): + """ + Test case for test_client_model + + To test \"client\" model + """ + pass + + def test_test_endpoint_parameters(self): + """ + Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + """ + pass + + def test_test_enum_parameters(self): + """ + Test case for test_enum_parameters + + To test enum parameters + """ + pass + + def test_test_json_form_data(self): + """ + Test case for test_json_form_data + + test json serialization of form data + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python-tornado/test/test_fake_classname_tags_123_api.py new file mode 100644 index 00000000000..7a11a2378bf --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_fake_classname_tags_123_api.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_classname_tags_123_api import FakeClassnameTags123Api + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """ FakeClassnameTags123Api unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.fake_classname_tags_123_api.FakeClassnameTags123Api() + + def tearDown(self): + pass + + def test_test_classname(self): + """ + Test case for test_classname + + To test class name in snake case + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_format_test.py b/samples/client/petstore/python-tornado/test/test_format_test.py new file mode 100644 index 00000000000..ad028c0b431 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_format_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.format_test import FormatTest + + +class TestFormatTest(unittest.TestCase): + """ FormatTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFormatTest(self): + """ + Test FormatTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.format_test.FormatTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_has_only_read_only.py b/samples/client/petstore/python-tornado/test/test_has_only_read_only.py new file mode 100644 index 00000000000..af029f26814 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_has_only_read_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.has_only_read_only import HasOnlyReadOnly + + +class TestHasOnlyReadOnly(unittest.TestCase): + """ HasOnlyReadOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testHasOnlyReadOnly(self): + """ + Test HasOnlyReadOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_list.py b/samples/client/petstore/python-tornado/test/test_list.py new file mode 100644 index 00000000000..14400e35281 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_list.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.list import List + + +class TestList(unittest.TestCase): + """ List unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testList(self): + """ + Test List + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.list.List() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_map_test.py b/samples/client/petstore/python-tornado/test/test_map_test.py new file mode 100644 index 00000000000..c4b2092f0ce --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_map_test.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.map_test import MapTest + + +class TestMapTest(unittest.TestCase): + """ MapTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMapTest(self): + """ + Test MapTest + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.map_test.MapTest() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-tornado/test/test_mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..f614d36da8a --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_mixed_properties_and_additional_properties_class.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass + + +class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): + """ MixedPropertiesAndAdditionalPropertiesClass unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testMixedPropertiesAndAdditionalPropertiesClass(self): + """ + Test MixedPropertiesAndAdditionalPropertiesClass + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_model_200_response.py b/samples/client/petstore/python-tornado/test/test_model_200_response.py new file mode 100644 index 00000000000..f202a2d454f --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_model_200_response.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_200_response import Model200Response + + +class TestModel200Response(unittest.TestCase): + """ Model200Response unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """ + Test Model200Response + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.model_200_response.Model200Response() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_model_return.py b/samples/client/petstore/python-tornado/test/test_model_return.py new file mode 100644 index 00000000000..347c8e4d7cb --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_model_return.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.model_return import ModelReturn + + +class TestModelReturn(unittest.TestCase): + """ ModelReturn unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModelReturn(self): + """ + Test ModelReturn + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.model_return.ModelReturn() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_name.py b/samples/client/petstore/python-tornado/test/test_name.py new file mode 100644 index 00000000000..c06e35427f6 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.name import Name + + +class TestName(unittest.TestCase): + """ Name unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testName(self): + """ + Test Name + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.name.Name() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_number_only.py b/samples/client/petstore/python-tornado/test/test_number_only.py new file mode 100644 index 00000000000..db3197a9e5b --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_number_only.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.number_only import NumberOnly + + +class TestNumberOnly(unittest.TestCase): + """ NumberOnly unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testNumberOnly(self): + """ + Test NumberOnly + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.number_only.NumberOnly() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_order.py b/samples/client/petstore/python-tornado/test/test_order.py new file mode 100644 index 00000000000..d911487ce97 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_order.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.order import Order + + +class TestOrder(unittest.TestCase): + """ Order unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOrder(self): + """ + Test Order + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.order.Order() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_outer_boolean.py b/samples/client/petstore/python-tornado/test/test_outer_boolean.py new file mode 100644 index 00000000000..9474ab76968 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_outer_boolean.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_boolean import OuterBoolean + + +class TestOuterBoolean(unittest.TestCase): + """ OuterBoolean unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterBoolean(self): + """ + Test OuterBoolean + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_boolean.OuterBoolean() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_outer_composite.py b/samples/client/petstore/python-tornado/test/test_outer_composite.py new file mode 100644 index 00000000000..ebbd9d03e6f --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_outer_composite.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_composite import OuterComposite + + +class TestOuterComposite(unittest.TestCase): + """ OuterComposite unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterComposite(self): + """ + Test OuterComposite + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_composite.OuterComposite() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_outer_enum.py b/samples/client/petstore/python-tornado/test/test_outer_enum.py new file mode 100644 index 00000000000..c6e1f030ef1 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_outer_enum.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_enum import OuterEnum + + +class TestOuterEnum(unittest.TestCase): + """ OuterEnum unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnum(self): + """ + Test OuterEnum + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_enum.OuterEnum() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_outer_number.py b/samples/client/petstore/python-tornado/test/test_outer_number.py new file mode 100644 index 00000000000..9f97b407047 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_outer_number.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_number import OuterNumber + + +class TestOuterNumber(unittest.TestCase): + """ OuterNumber unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterNumber(self): + """ + Test OuterNumber + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_number.OuterNumber() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_outer_string.py b/samples/client/petstore/python-tornado/test/test_outer_string.py new file mode 100644 index 00000000000..b0ac85ed934 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_outer_string.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_string import OuterString + + +class TestOuterString(unittest.TestCase): + """ OuterString unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterString(self): + """ + Test OuterString + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.outer_string.OuterString() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_pet.py b/samples/client/petstore/python-tornado/test/test_pet.py new file mode 100644 index 00000000000..c3e8191bec3 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_pet.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.pet import Pet + + +class TestPet(unittest.TestCase): + """ Pet unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPet(self): + """ + Test Pet + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.pet.Pet() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_pet_api.py b/samples/client/petstore/python-tornado/test/test_pet_api.py new file mode 100644 index 00000000000..1eafc35b28c --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_pet_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.pet_api import PetApi + + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.pet_api.PetApi() + + def tearDown(self): + pass + + def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ + pass + + def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ + pass + + def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ + pass + + def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ + pass + + def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ + pass + + def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ + pass + + def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + pass + + def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_read_only_first.py b/samples/client/petstore/python-tornado/test/test_read_only_first.py new file mode 100644 index 00000000000..c89d5d3b6a1 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_read_only_first.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.read_only_first import ReadOnlyFirst + + +class TestReadOnlyFirst(unittest.TestCase): + """ ReadOnlyFirst unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testReadOnlyFirst(self): + """ + Test ReadOnlyFirst + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.read_only_first.ReadOnlyFirst() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_special_model_name.py b/samples/client/petstore/python-tornado/test/test_special_model_name.py new file mode 100644 index 00000000000..d9fa392c36b --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_special_model_name.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.special_model_name import SpecialModelName + + +class TestSpecialModelName(unittest.TestCase): + """ SpecialModelName unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSpecialModelName(self): + """ + Test SpecialModelName + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.special_model_name.SpecialModelName() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_store_api.py b/samples/client/petstore/python-tornado/test/test_store_api.py new file mode 100644 index 00000000000..f131b6068b2 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_store_api.py @@ -0,0 +1,68 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.store_api import StoreApi + + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.store_api.StoreApi() + + def tearDown(self): + pass + + def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ + pass + + def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ + pass + + def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ + pass + + def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_tag.py b/samples/client/petstore/python-tornado/test/test_tag.py new file mode 100644 index 00000000000..76f79932c96 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_tag.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.tag import Tag + + +class TestTag(unittest.TestCase): + """ Tag unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTag(self): + """ + Test Tag + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.tag.Tag() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_user.py b/samples/client/petstore/python-tornado/test/test_user.py new file mode 100644 index 00000000000..82f5d9058b0 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_user.py @@ -0,0 +1,44 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.user import User + + +class TestUser(unittest.TestCase): + """ User unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testUser(self): + """ + Test User + """ + # FIXME: construct object with mandatory attributes with example values + #model = petstore_api.models.user.User() + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_user_api.py b/samples/client/petstore/python-tornado/test/test_user_api.py new file mode 100644 index 00000000000..3e0be964a2d --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_user_api.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.user_api import UserApi + + +class TestUserApi(unittest.TestCase): + """ UserApi unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.user_api.UserApi() + + def tearDown(self): + pass + + def test_create_user(self): + """ + Test case for create_user + + Create user + """ + pass + + def test_create_users_with_array_input(self): + """ + Test case for create_users_with_array_input + + Creates list of users with given input array + """ + pass + + def test_create_users_with_list_input(self): + """ + Test case for create_users_with_list_input + + Creates list of users with given input array + """ + pass + + def test_delete_user(self): + """ + Test case for delete_user + + Delete user + """ + pass + + def test_get_user_by_name(self): + """ + Test case for get_user_by_name + + Get user by user name + """ + pass + + def test_login_user(self): + """ + Test case for login_user + + Logs user into the system + """ + pass + + def test_logout_user(self): + """ + Test case for logout_user + + Logs out current logged in user session + """ + pass + + def test_update_user(self): + """ + Test case for update_user + + Updated user + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/tox.ini b/samples/client/petstore/python-tornado/tox.ini new file mode 100644 index 00000000000..1cf0829dc93 --- /dev/null +++ b/samples/client/petstore/python-tornado/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py27, py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + nosetests \ + [] \ No newline at end of file diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index a5dea6bf6c5..ff29a063d8c 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -283,7 +283,7 @@ def call_api(self, resource_path, method, _request_timeout=None): """ Makes the HTTP request (synchronous) and return the deserialized data. - To make an async request, define a function for callback. + To make an async request, set the async parameter. :param resource_path: Path to method endpoint. :param method: Method to call. @@ -307,10 +307,10 @@ def call_api(self, resource_path, method, :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :return: - If provide parameter callback, + If async parameter is True, the request will be called asynchronously. The method will return the request thread. - If parameter callback is None, + If parameter async is False or missing, then the method will return the response directly. """ if not async: diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index eed041d0211..9e1fcf24089 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -15,8 +15,9 @@ import urllib3 -import sys import logging +import multiprocessing +import sys from six import iteritems from six.moves import http_client as httplib @@ -75,6 +76,16 @@ def __init__(self): self.cert_file = None # client key file self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # urllib3 connection pool's maximum number of connections saved + # per pool. urllib3 uses 1 connection as default value, but this is + # not the best value when you are making a lot of possibly parallel + # requests to the same host, which is often the case here. + # cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + # Proxy URL self.proxy = None diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index e7e38352886..c0807c2fb19 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -56,7 +56,7 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=4): + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 @@ -76,6 +76,16 @@ def __init__(self, configuration, pools_size=4, maxsize=4): # if not set certificate file, use Mozilla's root certificates. ca_certs = certifi.where() + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = config.assert_hostname + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + # https pool manager if configuration.proxy: self.pool_manager = urllib3.ProxyManager( @@ -85,7 +95,8 @@ def __init__(self, configuration, pools_size=4, maxsize=4): ca_certs=ca_certs, cert_file=configuration.cert_file, key_file=configuration.key_file, - proxy_url=configuration.proxy + proxy_url=configuration.proxy, + **addition_pool_args ) else: self.pool_manager = urllib3.PoolManager( @@ -94,7 +105,8 @@ def __init__(self, configuration, pools_size=4, maxsize=4): cert_reqs=cert_reqs, ca_certs=ca_certs, cert_file=configuration.cert_file, - key_file=configuration.key_file + key_file=configuration.key_file, + **addition_pool_args ) def request(self, method, url, query_params=None, headers=None,