Merge pull request #2472 from wing328/python_auto_doc

[Python] automatically generate documentation (markdown) for Python API client
This commit is contained in:
wing328 2016-04-09 18:41:14 +08:00
commit b08fb4e2f2
28 changed files with 2363 additions and 106 deletions

View File

@ -3,6 +3,7 @@ package io.swagger.codegen.languages;
import io.swagger.codegen.CliOption; import io.swagger.codegen.CliOption;
import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants; import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.CodegenParameter;
import io.swagger.codegen.CodegenType; import io.swagger.codegen.CodegenType;
import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.DefaultCodegen;
import io.swagger.codegen.SupportingFile; import io.swagger.codegen.SupportingFile;
@ -17,6 +18,8 @@ import org.apache.commons.lang.StringUtils;
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig { public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String packageName; protected String packageName;
protected String packageVersion; protected String packageVersion;
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public PythonClientCodegen() { public PythonClientCodegen() {
super(); super();
@ -28,6 +31,9 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
apiTemplateFiles.put("api.mustache", ".py"); apiTemplateFiles.put("api.mustache", ".py");
embeddedTemplateDir = templateDir = "python"; embeddedTemplateDir = templateDir = "python";
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
languageSpecificPrimitives.clear(); languageSpecificPrimitives.clear();
languageSpecificPrimitives.add("int"); languageSpecificPrimitives.add("int");
languageSpecificPrimitives.add("float"); languageSpecificPrimitives.add("float");
@ -36,6 +42,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
languageSpecificPrimitives.add("str"); languageSpecificPrimitives.add("str");
languageSpecificPrimitives.add("datetime"); languageSpecificPrimitives.add("datetime");
languageSpecificPrimitives.add("date"); languageSpecificPrimitives.add("date");
languageSpecificPrimitives.add("object");
typeMapping.clear(); typeMapping.clear();
typeMapping.put("integer", "int"); typeMapping.put("integer", "int");
@ -97,6 +104,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
// make api and model doc path available in mustache template
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
String swaggerFolder = packageName; String swaggerFolder = packageName;
modelPackage = swaggerFolder + File.separatorChar + "models"; modelPackage = swaggerFolder + File.separatorChar + "models";
@ -138,6 +149,27 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
return "_" + name; return "_" + name;
} }
@Override
public String apiDocFileFolder() {
return (outputFolder + "/" + apiDocPath);
}
@Override
public String modelDocFileFolder() {
return (outputFolder + "/" + modelDocPath);
}
@Override
public String toModelDocFilename(String name) {
return toModelName(name);
}
@Override
public String toApiDocFilename(String name) {
return toApiName(name);
}
@Override @Override
public String apiFileFolder() { public String apiFileFolder() {
return outputFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar); return outputFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar);
@ -388,4 +420,70 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
return null; return null;
} }
@Override
public void setParameterExampleValue(CodegenParameter p) {
String example;
if (p.defaultValue == null) {
example = p.example;
} else {
example = p.defaultValue;
}
String type = p.baseType;
if (type == null) {
type = p.dataType;
}
if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) {
if (example == null) {
example = p.paramName + "_example";
}
example = "'" + escapeText(example) + "'";
} else if ("Integer".equals(type) || "int".equals(type)) {
if (example == null) {
example = "56";
}
} else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) {
if (example == null) {
example = "3.4";
}
} else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) {
if (example == null) {
example = "True";
}
} else if ("file".equalsIgnoreCase(type)) {
if (example == null) {
example = "/path/to/file";
}
example = "'" + escapeText(example) + "'";
} else if ("Date".equalsIgnoreCase(type)) {
if (example == null) {
example = "2013-10-20";
}
example = "'" + escapeText(example) + "'";
} else if ("DateTime".equalsIgnoreCase(type)) {
if (example == null) {
example = "2013-10-20T19:20:30+01:00";
}
example = "'" + escapeText(example) + "'";
} else if (!languageSpecificPrimitives.contains(type)) {
// type is a model class, e.g. User
example = this.packageName + "." + type + "()";
} else {
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
}
if (example == null) {
example = "NULL";
} else if (Boolean.TRUE.equals(p.isListContainer)) {
example = "[" + example + "]";
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
example = "{'key': " + example + "}";
}
p.example = example;
}
} }

View File

@ -1,73 +1,122 @@
# {{packageName}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: {{appVersion}}
- Package version: {{packageVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Requirements. ## Requirements.
Python 2.7 and later.
## Setuptools Python 2.7 and 3.4+
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
## Installation & Usage
### pip install
If the python package is hosted on Github, you can install directly from Github
```sh ```sh
python setup.py install pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
Then import the package:
```python
import {{{packageName}}}
``` ```
Or you can install from Github via pip: ### Setuptools
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh ```sh
pip install git+https://github.com/geekerzp/swagger_client.git python setup.py install --user
``` ```
(or `sudo python setup.py install` to install the package for all users)
To use the bindings, import the pacakge: Then import the package:
```python ```python
import swagger_client import {{{packageName}}}
```
## Manual Installation
If you do not wish to use setuptools, you can download the latest release.
Then, to use the bindings, import the package:
```python
import path.to.swagger_client
``` ```
## Getting Started ## Getting Started
TODO Please follow the [installation procedure](#installation--usage) and then run the following:
## Documentation ```python
import time
import {{{packageName}}}
from {{{packageName}}}.rest import ApiException
from pprint import pprint
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}}
{{{packageName}}}.configuration.username = 'YOUR_USERNAME'
{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
# Configure API key authorization: {{{name}}}
{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
# create an instance of the API class
api_instance = {{{packageName}}}.{{{classname}}}
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
TODO try:
{{#summary}} # {{{.}}}
## Tests {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
pprint(api_response){{/returnType}}
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed) except ApiException as e:
print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e
Execute the following command to run the tests in the current Python (v2 or v3) environment: {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```sh
$ make test
[... magically installs dependencies and runs tests on your virtualenv]
Ran 7 tests in 19.289s
OK
``` ```
or
``` ## Documentation for API Endpoints
$ mvn integration-test -rf :PythonPetstoreClientTests
Using 2195432783 as seed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.594 s
[INFO] Finished at: 2015-05-16T18:00:35+08:00
[INFO] Final Memory: 11M/156M
[INFO] ------------------------------------------------------------------------
```
If you want to run the tests in all the python platforms:
```sh All URIs are relative to *{{basePath}}*
$ make test-all
[... tox creates a virtualenv for every platform and runs tests inside of each] Class | Method | HTTP request | Description
py27: commands succeeded ------------ | ------------- | ------------- | -------------
py34: commands succeeded {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
congratulations :) {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
```
## Documentation For Models
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
## Documentation For Authorization
{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorizatoin URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Author
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}

View File

@ -47,7 +47,7 @@ class {{classname}}(object):
self.api_client = config.api_client self.api_client = config.api_client
{{#operation}} {{#operation}}
def {{nickname}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): def {{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs):
""" """
{{{summary}}} {{{summary}}}
{{{notes}}} {{{notes}}}
@ -59,10 +59,10 @@ class {{classname}}(object):
>>> pprint(response) >>> pprint(response)
>>> >>>
{{#sortParamsByRequiredFlag}} {{#sortParamsByRequiredFlag}}
>>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function) >>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function)
{{/sortParamsByRequiredFlag}} {{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}} {{^sortParamsByRequiredFlag}}
>>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function) >>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function)
{{/sortParamsByRequiredFlag}} {{/sortParamsByRequiredFlag}}
:param callback function: The callback function :param callback function: The callback function
@ -83,7 +83,7 @@ class {{classname}}(object):
if key not in all_params: if key not in all_params:
raise TypeError( raise TypeError(
"Got an unexpected keyword argument '%s'" "Got an unexpected keyword argument '%s'"
" to method {{nickname}}" % key " to method {{operationId}}" % key
) )
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
@ -92,7 +92,7 @@ class {{classname}}(object):
{{#required}} {{#required}}
# verify the required parameter '{{paramName}}' is set # verify the required parameter '{{paramName}}' is set
if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None): if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None):
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{nickname}}`") raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`")
{{/required}} {{/required}}
{{/allParams}} {{/allParams}}

View File

@ -0,0 +1,74 @@
# {{packageName}}.{{classname}}{{#description}}
{{description}}{{/description}}
All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
# **{{{operationId}}}**
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{{{summary}}}{{#notes}}
{{{notes}}}{{/notes}}
### Example
```python
import time
import {{{packageName}}}
from {{{packageName}}}.rest import ApiException
from pprint import pprint
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}}
{{{packageName}}}.configuration.username = 'YOUR_USERNAME'
{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
# Configure API key authorization: {{{name}}}
{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
# create an instance of the API class
api_instance = {{{packageName}}}.{{{classname}}}()
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
try:
{{#summary}} # {{{.}}}
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
pprint(api_response){{/returnType}}
except ApiException as e:
print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e
```
### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP reuqest headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
[[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)
{{/operation}}
{{/operations}}

View File

@ -0,0 +1,11 @@
{{#models}}{{#model}}# {{classname}}
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{{/model}}{{/models}}

View File

@ -1,28 +1,49 @@
# swagger_client
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: 1.0.0
- Package version:
- Build date: 2016-03-30T17:18:44.943+08:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.
Python 2.7 and later.
## Setuptools Python 2.7 and 3.4+
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
## Installation & Usage
### pip install
If the python package is hosted on Github, you can install directly from Github
```sh ```sh
python setup.py install pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git
```
(you may need to run the command with root permission: `sudo pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git`)
Import the pacakge:
```python
import swagger_client
``` ```
Or you can install from Github via pip: ### Setuptools
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh ```sh
pip install git+https://github.com/geekerzp/swagger_client.git python setup.py install --user
``` ```
(or `sudo python setup.py install` to install the package for all users)
To use the bindings, import the pacakge: Import the pacakge:
```python ```python
import swagger_client import swagger_client
``` ```
## Manual Installation ### Manual Installation
If you do not wish to use setuptools, you can download the latest release.
Then, to use the bindings, import the package: Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
```python ```python
import path.to.swagger_client import path.to.swagger_client
@ -30,44 +51,126 @@ import path.to.swagger_client
## Getting Started ## Getting Started
TODO Please follow the [installation procedure](#installation--usage) and then run the following:
## Documentation ```python
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
TODO # Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
## Tests try:
# Add a new pet to the store
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed) api_instance.add_pet(body=body);
except ApiException as e:
Execute the following command to run the tests in the current Python (v2 or v3) environment: print "Exception when calling PetApi->add_pet: %s\n" % e
```sh
$ make test
[... magically installs dependencies and runs tests on your virtualenv]
Ran 7 tests in 19.289s
OK
```
or
``` ```
$ mvn integration-test -rf :PythonPetstoreClientTests
Using 2195432783 as seed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.594 s
[INFO] Finished at: 2015-05-16T18:00:35+08:00
[INFO] Final Memory: 11M/156M
[INFO] ------------------------------------------------------------------------
```
If you want to run the tests in all the python platforms:
```sh ## Documentation for API Endpoints
$ make test-all
[... tox creates a virtualenv for every platform and runs tests inside of each] All URIs are relative to *http://petstore.swagger.io/v2*
py27: commands succeeded
py34: commands succeeded Class | Method | HTTP request | Description
congratulations :) ------------ | ------------- | ------------- | -------------
``` *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding 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* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
*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/{orderId} | Delete purchase order by ID
*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | 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
- [Animal](docs/Animal.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [Dog](docs/Dog.md)
- [InlineResponse200](docs/InlineResponse200.md)
- [Model200Response](docs/Model200Response.md)
- [ModelReturn](docs/ModelReturn.md)
- [Name](docs/Name.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)
## Documentation For Authorization
## test_api_key_header
- **Type**: API key
- **API key parameter name**: test_api_key_header
- **Location**: HTTP header
## api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## test_http_basic
- **Type**: HTTP basic authentication
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header
## test_api_client_id
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
## test_api_key_query
- **Type**: API key
- **API key parameter name**: test_api_key_query
- **Location**: URL query string
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin 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

View File

@ -0,0 +1,10 @@
# Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **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)

View File

@ -0,0 +1,11 @@
# Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**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)

View File

@ -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)

View File

@ -0,0 +1,11 @@
# Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**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)

View File

@ -0,0 +1,15 @@
# InlineResponse200
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tags** | [**list[Tag]**](Tag.md) | | [optional]
**id** | **int** | |
**category** | **object** | | [optional]
**status** | **str** | pet status in the store | [optional]
**name** | **str** | | [optional]
**photo_urls** | **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)

View File

@ -0,0 +1,10 @@
# Model200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**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)

View File

@ -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)

View File

@ -0,0 +1,11 @@
# Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | | [optional]
**snake_case** | **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)

View File

@ -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]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -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)

View File

@ -0,0 +1,596 @@
# swagger_client\PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding 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
[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
[**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=body)
Add a new pet to the store
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Add a new pet to the store
api_instance.add_pet(body=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 | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[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)
# **add_pet_using_byte_array**
> add_pet_using_byte_array(body=body)
Fake endpoint to test byte array in body parameter for adding a new pet to the store
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
body = 'B' # str | Pet object in the form of byte array (optional)
try:
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
api_instance.add_pet_using_byte_array(body=body);
except ApiException as e:
print "Exception when calling PetApi->add_pet_using_byte_array: %s\n" % e
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **str**| Pet object in the form of byte array | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
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 reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
status = ['available'] # list[str] | Status values that need to be considered for query (optional) (default to available)
try:
# Finds Pets by status
api_response = api_instance.find_pets_by_status(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 query | [optional] [default to available]
### Return type
[**list[Pet]**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=tags)
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
tags = ['tags_example'] # list[str] | Tags to filter by (optional)
try:
# Finds Pets by tags
api_response = api_instance.find_pets_by_tags(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 | [optional]
### Return type
[**list[Pet]**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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 pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
pet_id = 789 # int | ID of pet that needs to be fetched
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 that needs to be fetched |
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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_in_object**
> InlineResponse200 get_pet_by_id_in_object(pet_id)
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
pet_id = 789 # int | ID of pet that needs to be fetched
try:
# Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
api_response = api_instance.get_pet_by_id_in_object(pet_id);
pprint(api_response)
except ApiException as e:
print "Exception when calling PetApi->get_pet_by_id_in_object: %s\n" % e
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet_id** | **int**| ID of pet that needs to be fetched |
### Return type
[**InlineResponse200**](InlineResponse200.md)
### Authorization
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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)
# **pet_pet_idtesting_byte_arraytrue_get**
> str pet_pet_idtesting_byte_arraytrue_get(pet_id)
Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
pet_id = 789 # int | ID of pet that needs to be fetched
try:
# Fake endpoint to test byte array return by 'Find pet by ID'
api_response = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id);
pprint(api_response)
except ApiException as e:
print "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: %s\n" % e
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet_id** | **int**| ID of pet that needs to be fetched |
### Return type
**str**
### Authorization
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=body)
Update an existing pet
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
try:
# Update an existing pet
api_instance.update_pet(body=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 | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
pet_id = 'pet_id_example' # str | 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** | **str**| 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 reuqest headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/json, application/xml
[[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**
> upload_file(pet_id, additional_metadata=additional_metadata, file=file)
uploads an image
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
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_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file);
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
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json, application/xml
[[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)

View File

@ -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)

View File

@ -0,0 +1,330 @@
# swagger_client\StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | 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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.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 reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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_orders_by_status**
> list[Order] find_orders_by_status(status=status)
Finds orders by status
A single status value can be provided as a string
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: test_api_client_id
swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER'
# Configure API key authorization: test_api_client_secret
swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
status = 'placed' # str | Status value that needs to be considered for query (optional) (default to placed)
try:
# Finds orders by status
api_response = api_instance.find_orders_by_status(status=status);
pprint(api_response)
except ApiException as e:
print "Exception when calling StoreApi->find_orders_by_status: %s\n" % e
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | **str**| Status value that needs to be considered for query | [optional] [default to placed]
### Return type
[**list[Order]**](Order.md)
### Authorization
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
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)**](dict.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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_in_object**
> object get_inventory_in_object()
Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually a map of status codes to quantities
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
try:
# Fake endpoint to test arbitrary object return by 'Get inventory'
api_response = api_instance.get_inventory_in_object();
pprint(api_response)
except ApiException as e:
print "Exception when calling StoreApi->get_inventory_in_object: %s\n" % e
```
### Parameters
This endpoint does not need any parameter.
### Return type
**object**
### Authorization
[api_key](../README.md#api_key)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: test_api_key_header
swagger_client.configuration.api_key['test_api_key_header'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['test_api_key_header'] = 'BEARER'
# Configure API key authorization: test_api_key_query
swagger_client.configuration.api_key['test_api_key_query'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['test_api_key_query'] = 'BEARER'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
order_id = 'order_id_example' # str | 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** | **str**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=body)
Place an order for a pet
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure API key authorization: test_api_client_id
swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER'
# Configure API key authorization: test_api_client_secret
swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY';
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
body = swagger_client.Order() # Order | order placed for purchasing the pet (optional)
try:
# Place an order for a pet
api_response = api_instance.place_order(body=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 | [optional]
### Return type
[**Order**](Order.md)
### Authorization
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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)

View File

@ -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)

View File

@ -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)

View File

@ -0,0 +1,398 @@
# swagger_client\UserApi
All URIs are relative to *http://petstore.swagger.io/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=body)
Create user
This can only be done by the logged in user.
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = swagger_client.User() # User | Created user object (optional)
try:
# Create user
api_instance.create_user(body=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 | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=body)
Creates list of users with given input array
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = [swagger_client.User()] # list[User] | List of user object (optional)
try:
# Creates list of users with given input array
api_instance.create_users_with_array_input(body=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 | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=body)
Creates list of users with given input array
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = [swagger_client.User()] # list[User] | List of user object (optional)
try:
# Creates list of users with given input array
api_instance.create_users_with_list_input(body=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 | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# Configure HTTP basic authorization: test_http_basic
swagger_client.configuration.username = 'YOUR_USERNAME'
swagger_client.configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = swagger_client.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
[test_http_basic](../README.md#test_http_basic)
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.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 reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=username, password=password)
Logs user into the system
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.UserApi()
username = 'username_example' # str | The user name for login (optional)
password = 'password_example' # str | The password for login in clear text (optional)
try:
# Logs user into the system
api_response = api_instance.login_user(username=username, password=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 | [optional]
**password** | **str**| The password for login in clear text | [optional]
### Return type
**str**
### Authorization
No authorization required
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.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 reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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=body)
Updated user
This can only be done by the logged in user.
### Example
```python
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
import time
# create an instance of the API class
api_instance = swagger_client.UserApi()
username = 'username_example' # str | name that need to be deleted
body = swagger_client.User() # User | Updated user object (optional)
try:
# Updated user
api_instance.update_user(username, body=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 | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP reuqest headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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