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

@@ -1,4 +1,4 @@
# \StoreApi
# swagger_client\StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
@@ -13,26 +13,29 @@ Method | HTTP request | Description
# **delete_order**
> delete_order($order_id)
> 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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 {
$api_instance->delete_order($order_id);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->delete_order: ', $e->getMessage(), "\n";
}
?>
# 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
@@ -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)
# **find_orders_by_status**
> list[Order] find_orders_by_status($status)
> list[Order] find_orders_by_status(status=status)
Finds orders by status
A single status value can be provided as a string
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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();
$status = placed; // str | Status value that needs to be considered for query
# 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'
try {
$result = $api_instance->find_orders_by_status($status);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->find_orders_by_status: ', $e->getMessage(), "\n";
}
?>
# 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
@@ -118,24 +124,27 @@ Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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 {
$result = $api_instance->get_inventory();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->get_inventory: ', $e->getMessage(), "\n";
}
?>
# 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
@@ -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
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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 {
$result = $api_instance->get_inventory_in_object();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->get_inventory_in_object: ', $e->getMessage(), "\n";
}
?>
# 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
@@ -189,7 +201,7 @@ This endpoint does not need any parameter.
### Return type
[**object**](object.md)
**object**
### 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)
# **get_order_by_id**
> Order get_order_by_id($order_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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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();
$order_id = order_id_example; // str | ID of pet that needs to be fetched
# 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'
try {
$result = $api_instance->get_order_by_id($order_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->get_order_by_id: ', $e->getMessage(), "\n";
}
?>
# 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
@@ -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)
# **place_order**
> Order place_order($body)
> Order place_order(body=body)
Place an order for a pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
```python
import swagger_client
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();
$body = new Order(); // Order | order placed for purchasing the pet
# 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'
try {
$result = $api_instance->place_order($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->place_order: ', $e->getMessage(), "\n";
}
?>
# 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