update doc for python, add new files

This commit is contained in:
wing328 2016-03-30 17:50:38 +08:00
parent 142a3bab72
commit ba74c69fdb
15 changed files with 974 additions and 470 deletions

View File

@ -42,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");
@ -434,11 +435,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
type = p.dataType; type = p.dataType;
} }
if ("String".equalsIgnoreCase(type)) { if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) {
if (example == null) { if (example == null) {
example = p.paramName + "_example"; example = p.paramName + "_example";
} }
example = "\"" + escapeText(example) + "\""; example = "'" + escapeText(example) + "'";
} else if ("Integer".equals(type) || "int".equals(type)) { } else if ("Integer".equals(type) || "int".equals(type)) {
if (example == null) { if (example == null) {
example = "56"; example = "56";
@ -451,24 +452,24 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
if (example == null) { if (example == null) {
example = "True"; example = "True";
} }
} else if ("\\SplFileObject".equalsIgnoreCase(type)) { } else if ("file".equalsIgnoreCase(type)) {
if (example == null) { if (example == null) {
example = "/path/to/file"; example = "/path/to/file";
} }
example = "\"" + escapeText(example) + "\""; example = "'" + escapeText(example) + "'";
} else if ("Date".equalsIgnoreCase(type)) { } else if ("Date".equalsIgnoreCase(type)) {
if (example == null) { if (example == null) {
example = "2013-10-20"; example = "2013-10-20";
} }
example = "new \\DateTime(\"" + escapeText(example) + "\")"; example = "'" + escapeText(example) + "'";
} else if ("DateTime".equalsIgnoreCase(type)) { } else if ("DateTime".equalsIgnoreCase(type)) {
if (example == null) { if (example == null) {
example = "2013-10-20T19:20:30+01:00"; example = "2013-10-20T19:20:30+01:00";
} }
example = "new \\DateTime(\"" + escapeText(example) + "\")"; example = "'" + escapeText(example) + "'";
} else if (!languageSpecificPrimitives.contains(type)) { } else if (!languageSpecificPrimitives.contains(type)) {
// type is a model class, e.g. User // type is a model class, e.g. User
example = "new " + type + "()"; example = this.packageName + "." + type + "()";
} else { } else {
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue"); LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
} }
@ -476,9 +477,9 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
if (example == null) { if (example == null) {
example = "NULL"; example = "NULL";
} else if (Boolean.TRUE.equals(p.isListContainer)) { } else if (Boolean.TRUE.equals(p.isListContainer)) {
example = "array(" + example + ")"; example = "[" + example + "]";
} else if (Boolean.TRUE.equals(p.isMapContainer)) { } else if (Boolean.TRUE.equals(p.isMapContainer)) {
example = "array('key' => " + example + ")"; example = "{'key': " + example + "}";
} }
p.example = example; p.example = example;

View File

@ -6,7 +6,7 @@
{{/appDescription}} {{/appDescription}}
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}} - API version: {{appVersion}}
- Package version: {{projectVersion}} - Package version: {{projectVersion}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}

View File

@ -8,7 +8,7 @@
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}} - API version: {{appVersion}}
- Package version: {{moduleVersion}} - Package version: {{moduleVersion}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}

View File

@ -5,7 +5,7 @@
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}} - API version: {{appVersion}}
- Package version: {{artifactVersion}} - Package version: {{artifactVersion}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}

View File

@ -1,12 +1,12 @@
# {{packagePath}} # {{packageName}}
{{#appDescription}} {{#appDescription}}
{{{appDescription}}} {{{appDescription}}}
{{/appDescription}} {{/appDescription}}
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}} - API version: {{appVersion}}
- Package version: {{artifactVersion}} - Package version: {{packageVersion}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}
{{#infoUrl}} {{#infoUrl}}
@ -14,33 +14,44 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}} {{/infoUrl}}
## Requirements. ## Requirements.
Python 2.7 and 3.4+ Python 2.7 and 3.4+
## Installation & Usage ## Installation & Usage
### Setuptools ### pip install
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh If the python package is hosted on Github, you can install directly from Github
python setup.py install
```
Or you can install from Github via pip:
```sh ```sh
pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git
``` ```
(you may need to run the command with root permission: `sudo pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
Finally import the pacakge: Import the pacakge:
```python ```python
import swagger_client import {{{packageName}}}
```
### 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)
Import the pacakge:
```python
import {{{packageName}}}
``` ```
### Manual Installation ### Manual Installation
Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
Download the latest release to the project folder (e.g. ./path/to/{{{packageName}}}) and import the package:
```python ```python
import path.to.swagger_client import path.to.{{{packageName}}}
``` ```
## Getting Started ## Getting Started
@ -48,37 +59,35 @@ import path.to.swagger_client
Please follow the [installation procedure](#installation--usage) and then run the following: Please follow the [installation procedure](#installation--usage) and then run the following:
```python ```python
require_once(__DIR__ . '/vendor/autoload.php'); import time
import {{{packageName}}}
from {{{packageName}}}.rest import ApiException
from pprint import pprint
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}} # Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME'); {{{packageName}}}.configuration.username = 'YOUR_USERNAME'
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} {{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}} # Configure API key authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); {{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed # Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} # {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}} # Configure OAuth2 access token for authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} {{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}} {{/hasAuthMethods}}
# create an instance of the API class
$api_instance = new {{invokerPackage}}\Api\{{classname}}(); api_instance = {{{packageName}}}.{{{classname}}}
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}} {{/allParams}}
try { try:
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} {{#summary}} # {{{.}}}
print_r($result);{{/returnType}} {{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
} catch (Exception $e) { pprint(api_response){{/returnType}}
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), "\n"; except ApiException as e:
} print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
?>
``` ```
## Documentation
TODO
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *{{basePath}}* All URIs are relative to *{{basePath}}*

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

@ -8,7 +8,7 @@
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}} - API version: {{appVersion}}
- Package version: {{gemVersion}} - Package version: {{gemVersion}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}

View File

@ -1,37 +1,48 @@
# # 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 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: This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: 1.0.0 - API verion: 1.0.0
- Package version: - Package version:
- Build date: 2016-03-30T15:12:57.913+08:00 - Build date: 2016-03-30T17:18:44.943+08:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen - Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.
Python 2.7 and 3.4+ Python 2.7 and 3.4+
## Installation & Usage ## Installation & Usage
### Setuptools ### pip install
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh If the python package is hosted on Github, you can install directly from Github
python setup.py install
```
Or you can install from Github via pip:
```sh ```sh
pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git 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`)
Finally import the pacakge: Import the pacakge:
```python
import swagger_client
```
### 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)
Import the pacakge:
```python ```python
import swagger_client import swagger_client
``` ```
### Manual Installation ### Manual Installation
Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package: Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
```python ```python
@ -43,27 +54,25 @@ import path.to.swagger_client
Please follow the [installation procedure](#installation--usage) and then run the following: Please follow the [installation procedure](#installation--usage) and then run the following:
```python ```python
require_once(__DIR__ . '/vendor/autoload.php'); import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
// Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); 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)
$api_instance = new \Api\PetApi(); try:
$body = new Pet(); // Pet | Pet object that needs to be added to the store # 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
try {
$api_instance->add_pet($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->add_pet: ', $e->getMessage(), "\n";
}
?>
``` ```
## Documentation
TODO
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*

View File

@ -5,7 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**tags** | [**list[Tag]**](Tag.md) | | [optional] **tags** | [**list[Tag]**](Tag.md) | | [optional]
**id** | **int** | | **id** | **int** | |
**category** | [**object**](object.md) | | [optional] **category** | **object** | | [optional]
**status** | **str** | pet status in the store | [optional] **status** | **str** | pet status in the store | [optional]
**name** | **str** | | [optional] **name** | **str** | | [optional]
**photo_urls** | **list[str]** | | [optional] **photo_urls** | **list[str]** | | [optional]

View File

@ -1,4 +1,4 @@
# \PetApi # swagger_client\PetApi
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*
@ -18,29 +18,32 @@ Method | HTTP request | Description
# **add_pet** # **add_pet**
> add_pet($body) > add_pet(body=body)
Add a new pet to the store Add a new pet to the store
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$body = new Pet(); // Pet | Pet object that needs to be added to the store swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
try { # create an instance of the API class
$api_instance->add_pet($body); api_instance = swagger_client.PetApi()
} catch (Exception $e) { body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
echo 'Exception when calling PetApi->add_pet: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -65,29 +68,32 @@ void (empty response body)
[[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) [[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**
> add_pet_using_byte_array($body) > add_pet_using_byte_array(body=body)
Fake endpoint to test byte array in body parameter for adding a new pet to the store Fake endpoint to test byte array in body parameter for adding a new pet to the store
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$body = B; // str | Pet object in the form of byte array swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
try { # create an instance of the API class
$api_instance->add_pet_using_byte_array($body); api_instance = swagger_client.PetApi()
} catch (Exception $e) { body = 'B' # str | Pet object in the form of byte array (optional)
echo 'Exception when calling PetApi->add_pet_using_byte_array: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -112,30 +118,33 @@ void (empty response body)
[[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) [[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**
> delete_pet($pet_id, $api_key) > delete_pet(pet_id, api_key=api_key)
Deletes a pet Deletes a pet
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$pet_id = 789; // int | Pet id to delete swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
$api_key = api_key_example; // str |
try { # create an instance of the API class
$api_instance->delete_pet($pet_id, $api_key); api_instance = swagger_client.PetApi()
} catch (Exception $e) { pet_id = 789 # int | Pet id to delete
echo 'Exception when calling PetApi->delete_pet: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -161,30 +170,33 @@ void (empty response body)
[[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) [[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** # **find_pets_by_status**
> list[Pet] find_pets_by_status($status) > list[Pet] find_pets_by_status(status=status)
Finds Pets by status Finds Pets by status
Multiple status values can be provided with comma separated strings Multiple status values can be provided with comma separated strings
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$status = array(available); // list[str] | Status values that need to be considered for query swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
try { # create an instance of the API class
$result = $api_instance->find_pets_by_status($status); api_instance = swagger_client.PetApi()
print_r($result); status = ['available'] # list[str] | Status values that need to be considered for query (optional) (default to available)
} catch (Exception $e) {
echo 'Exception when calling PetApi->find_pets_by_status: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -209,30 +221,33 @@ Name | Type | Description | Notes
[[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) [[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** # **find_pets_by_tags**
> list[Pet] find_pets_by_tags($tags) > list[Pet] find_pets_by_tags(tags=tags)
Finds Pets by tags Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$tags = NULL; // list[str] | Tags to filter by swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
try { # create an instance of the API class
$result = $api_instance->find_pets_by_tags($tags); api_instance = swagger_client.PetApi()
print_r($result); tags = ['tags_example'] # list[str] | Tags to filter by (optional)
} catch (Exception $e) {
echo 'Exception when calling PetApi->find_pets_by_tags: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -257,34 +272,37 @@ Name | Type | Description | Notes
[[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) [[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** # **get_pet_by_id**
> Pet get_pet_by_id($pet_id) > Pet get_pet_by_id(pet_id)
Find pet by ID Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: api_key
\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure API key authorization: api_key
$pet_id = 789; // int | ID of pet that needs to be fetched 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'
try { # create an instance of the API class
$result = $api_instance->get_pet_by_id($pet_id); api_instance = swagger_client.PetApi()
print_r($result); pet_id = 789 # int | ID of pet that needs to be fetched
} catch (Exception $e) {
echo 'Exception when calling PetApi->get_pet_by_id: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -309,34 +327,37 @@ Name | Type | Description | Notes
[[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) [[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** # **get_pet_by_id_in_object**
> InlineResponse200 get_pet_by_id_in_object($pet_id) > InlineResponse200 get_pet_by_id_in_object(pet_id)
Fake endpoint to test inline arbitrary object return by 'Find pet by 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 Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: api_key
\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure API key authorization: api_key
$pet_id = 789; // int | ID of pet that needs to be fetched 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'
try { # create an instance of the API class
$result = $api_instance->get_pet_by_id_in_object($pet_id); api_instance = swagger_client.PetApi()
print_r($result); pet_id = 789 # int | ID of pet that needs to be fetched
} catch (Exception $e) {
echo 'Exception when calling PetApi->get_pet_by_id_in_object: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -361,34 +382,37 @@ Name | Type | Description | Notes
[[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) [[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** # **pet_pet_idtesting_byte_arraytrue_get**
> str pet_pet_idtesting_byte_arraytrue_get($pet_id) > str pet_pet_idtesting_byte_arraytrue_get(pet_id)
Fake endpoint to test byte array return by 'Find pet by 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 Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: api_key
\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure API key authorization: api_key
$pet_id = 789; // int | ID of pet that needs to be fetched 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'
try { # create an instance of the API class
$result = $api_instance->pet_pet_idtesting_byte_arraytrue_get($pet_id); api_instance = swagger_client.PetApi()
print_r($result); pet_id = 789 # int | ID of pet that needs to be fetched
} catch (Exception $e) {
echo 'Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -413,29 +437,32 @@ Name | Type | Description | Notes
[[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) [[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**
> update_pet($body) > update_pet(body=body)
Update an existing pet Update an existing pet
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$body = new Pet(); // Pet | Pet object that needs to be added to the store swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
try { # create an instance of the API class
$api_instance->update_pet($body); api_instance = swagger_client.PetApi()
} catch (Exception $e) { body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
echo 'Exception when calling PetApi->update_pet: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -460,31 +487,34 @@ void (empty response body)
[[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) [[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**
> update_pet_with_form($pet_id, $name, $status) > update_pet_with_form(pet_id, name=name, status=status)
Updates a pet in the store with form data Updates a pet in the store with form data
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$pet_id = pet_id_example; // str | ID of pet that needs to be updated swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
$name = name_example; // str | Updated name of the pet
$status = status_example; // str | Updated status of the pet
try { # create an instance of the API class
$api_instance->update_pet_with_form($pet_id, $name, $status); api_instance = swagger_client.PetApi()
} catch (Exception $e) { pet_id = 'pet_id_example' # str | ID of pet that needs to be updated
echo 'Exception when calling PetApi->update_pet_with_form: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -511,31 +541,34 @@ void (empty response body)
[[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) [[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**
> upload_file($pet_id, $additional_metadata, $file) > upload_file(pet_id, additional_metadata=additional_metadata, file=file)
uploads an image uploads an image
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi(); # Configure OAuth2 access token for authorization: petstore_auth
$pet_id = 789; // int | ID of pet to update swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
$additional_metadata = additional_metadata_example; // str | Additional data to pass to server
$file = new file(); // file | file to upload
try { # create an instance of the API class
$api_instance->upload_file($pet_id, $additional_metadata, $file); api_instance = swagger_client.PetApi()
} catch (Exception $e) { pet_id = 789 # int | ID of pet to update
echo 'Exception when calling PetApi->upload_file: ', $e->getMessage(), "\n"; 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 ### Parameters

View File

@ -1,4 +1,4 @@
# \StoreApi # swagger_client\StoreApi
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*
@ -13,26 +13,29 @@ Method | HTTP request | Description
# **delete_order** # **delete_order**
> delete_order($order_id) > delete_order(order_id)
Delete purchase order by ID Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\StoreApi();
$order_id = order_id_example; // str | ID of the order that needs to be deleted
try { # create an instance of the API class
$api_instance->delete_order($order_id); api_instance = swagger_client.StoreApi()
} catch (Exception $e) { order_id = 'order_id_example' # str | ID of the order that needs to be deleted
echo 'Exception when calling StoreApi->delete_order: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -57,36 +60,39 @@ No authorization required
[[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) [[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** # **find_orders_by_status**
> list[Order] find_orders_by_status($status) > list[Order] find_orders_by_status(status=status)
Finds orders by status Finds orders by status
A single status value can be provided as a string A single status value can be provided as a string
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: test_api_client_id
\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER');
// Configure API key authorization: test_api_client_secret
\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER');
$api_instance = new \Api\StoreApi(); # Configure API key authorization: test_api_client_id
$status = placed; // str | Status value that needs to be considered for query 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'
try { # create an instance of the API class
$result = $api_instance->find_orders_by_status($status); api_instance = swagger_client.StoreApi()
print_r($result); status = 'placed' # str | Status value that needs to be considered for query (optional) (default to placed)
} catch (Exception $e) {
echo 'Exception when calling StoreApi->find_orders_by_status: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -118,24 +124,27 @@ Returns pet inventories by status
Returns a map of status codes to quantities Returns a map of status codes to quantities
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: api_key
\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
$api_instance = new \Api\StoreApi(); # 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'
try { # create an instance of the API class
$result = $api_instance->get_inventory(); api_instance = swagger_client.StoreApi()
print_r($result);
} catch (Exception $e) { try:
echo 'Exception when calling StoreApi->get_inventory: ', $e->getMessage(), "\n"; # 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 ### Parameters
@ -164,24 +173,27 @@ Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually a map of status codes to quantities Returns an arbitrary object which is actually a map of status codes to quantities
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: api_key
\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER');
$api_instance = new \Api\StoreApi(); # 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'
try { # create an instance of the API class
$result = $api_instance->get_inventory_in_object(); api_instance = swagger_client.StoreApi()
print_r($result);
} catch (Exception $e) { try:
echo 'Exception when calling StoreApi->get_inventory_in_object: ', $e->getMessage(), "\n"; # 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 ### Parameters
@ -189,7 +201,7 @@ This endpoint does not need any parameter.
### Return type ### Return type
[**object**](object.md) **object**
### Authorization ### Authorization
@ -203,36 +215,39 @@ This endpoint does not need any parameter.
[[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) [[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** # **get_order_by_id**
> Order get_order_by_id($order_id) > Order get_order_by_id(order_id)
Find purchase order by ID Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: test_api_key_header
\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_header', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER');
// Configure API key authorization: test_api_key_query
\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER');
$api_instance = new \Api\StoreApi(); # Configure API key authorization: test_api_key_header
$order_id = order_id_example; // str | ID of pet that needs to be fetched 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'
try { # create an instance of the API class
$result = $api_instance->get_order_by_id($order_id); api_instance = swagger_client.StoreApi()
print_r($result); order_id = 'order_id_example' # str | ID of pet that needs to be fetched
} catch (Exception $e) {
echo 'Exception when calling StoreApi->get_order_by_id: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -257,36 +272,39 @@ Name | Type | Description | Notes
[[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) [[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** # **place_order**
> Order place_order($body) > Order place_order(body=body)
Place an order for a pet Place an order for a pet
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure API key authorization: test_api_client_id
\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_id', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER');
// Configure API key authorization: test_api_client_secret
\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// \Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER');
$api_instance = new \Api\StoreApi(); # Configure API key authorization: test_api_client_id
$body = new Order(); // Order | order placed for purchasing the pet 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'
try { # create an instance of the API class
$result = $api_instance->place_order($body); api_instance = swagger_client.StoreApi()
print_r($result); body = swagger_client.Order() # Order | order placed for purchasing the pet (optional)
} catch (Exception $e) {
echo 'Exception when calling StoreApi->place_order: ', $e->getMessage(), "\n"; 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 ### Parameters

View File

@ -1,4 +1,4 @@
# \UserApi # swagger_client\UserApi
All URIs are relative to *http://petstore.swagger.io/v2* All URIs are relative to *http://petstore.swagger.io/v2*
@ -15,26 +15,29 @@ Method | HTTP request | Description
# **create_user** # **create_user**
> create_user($body) > create_user(body=body)
Create user Create user
This can only be done by the logged in user. This can only be done by the logged in user.
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$body = new User(); // User | Created user object
try { # create an instance of the API class
$api_instance->create_user($body); api_instance = swagger_client.UserApi()
} catch (Exception $e) { body = swagger_client.User() # User | Created user object (optional)
echo 'Exception when calling UserApi->create_user: ', $e->getMessage(), "\n";
} try:
?> # Create user
api_instance.create_user(body=body);
except ApiException as e:
print "Exception when calling UserApi->create_user: %s\n" % e
``` ```
### Parameters ### Parameters
@ -59,26 +62,29 @@ No authorization required
[[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) [[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**
> create_users_with_array_input($body) > create_users_with_array_input(body=body)
Creates list of users with given input array Creates list of users with given input array
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$body = array(new User()); // list[User] | List of user object
try { # create an instance of the API class
$api_instance->create_users_with_array_input($body); api_instance = swagger_client.UserApi()
} catch (Exception $e) { body = [swagger_client.User()] # list[User] | List of user object (optional)
echo 'Exception when calling UserApi->create_users_with_array_input: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -103,26 +109,29 @@ No authorization required
[[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) [[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**
> create_users_with_list_input($body) > create_users_with_list_input(body=body)
Creates list of users with given input array Creates list of users with given input array
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$body = array(new User()); // list[User] | List of user object
try { # create an instance of the API class
$api_instance->create_users_with_list_input($body); api_instance = swagger_client.UserApi()
} catch (Exception $e) { body = [swagger_client.User()] # list[User] | List of user object (optional)
echo 'Exception when calling UserApi->create_users_with_list_input: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -147,30 +156,33 @@ No authorization required
[[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) [[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**
> delete_user($username) > delete_user(username)
Delete user Delete user
This can only be done by the logged in user. This can only be done by the logged in user.
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
// Configure HTTP basic authorization: test_http_basic
\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$api_instance = new \Api\UserApi(); # Configure HTTP basic authorization: test_http_basic
$username = username_example; // str | The name that needs to be deleted swagger_client.configuration.username = 'YOUR_USERNAME'
swagger_client.configuration.password = 'YOUR_PASSWORD'
try { # create an instance of the API class
$api_instance->delete_user($username); api_instance = swagger_client.UserApi()
} catch (Exception $e) { username = 'username_example' # str | The name that needs to be deleted
echo 'Exception when calling UserApi->delete_user: ', $e->getMessage(), "\n";
} try:
?> # Delete user
api_instance.delete_user(username);
except ApiException as e:
print "Exception when calling UserApi->delete_user: %s\n" % e
``` ```
### Parameters ### Parameters
@ -195,27 +207,30 @@ void (empty response body)
[[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) [[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** # **get_user_by_name**
> User get_user_by_name($username) > User get_user_by_name(username)
Get user by user name Get user by user name
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$username = username_example; // str | The name that needs to be fetched. Use user1 for testing.
try { # create an instance of the API class
$result = $api_instance->get_user_by_name($username); api_instance = swagger_client.UserApi()
print_r($result); username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
} catch (Exception $e) {
echo 'Exception when calling UserApi->get_user_by_name: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -240,28 +255,31 @@ No authorization required
[[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) [[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** # **login_user**
> str login_user($username, $password) > str login_user(username=username, password=password)
Logs user into the system Logs user into the system
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$username = username_example; // str | The user name for login
$password = password_example; // str | The password for login in clear text
try { # create an instance of the API class
$result = $api_instance->login_user($username, $password); api_instance = swagger_client.UserApi()
print_r($result); username = 'username_example' # str | The user name for login (optional)
} catch (Exception $e) { password = 'password_example' # str | The password for login in clear text (optional)
echo 'Exception when calling UserApi->login_user: ', $e->getMessage(), "\n";
} 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 ### Parameters
@ -294,18 +312,21 @@ Logs out current logged in user session
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
try { # create an instance of the API class
$api_instance->logout_user(); api_instance = swagger_client.UserApi()
} catch (Exception $e) {
echo 'Exception when calling UserApi->logout_user: ', $e->getMessage(), "\n"; 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 ### Parameters
@ -327,27 +348,30 @@ No authorization required
[[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) [[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**
> update_user($username, $body) > update_user(username, body=body)
Updated user Updated user
This can only be done by the logged in user. This can only be done by the logged in user.
### Example ### Example
```php ```python
<?php import swagger_client
require_once(__DIR__ . '/vendor/autoload.php'); from swagger_client.rest import ApiException
from pprint import pprint
import time
$api_instance = new \Api\UserApi();
$username = username_example; // str | name that need to be deleted
$body = new User(); // User | Updated user object
try { # create an instance of the API class
$api_instance->update_user($username, $body); api_instance = swagger_client.UserApi()
} catch (Exception $e) { username = 'username_example' # str | name that need to be deleted
echo 'Exception when calling UserApi->update_user: ', $e->getMessage(), "\n"; 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 ### Parameters

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