generate doc for python api and doc

This commit is contained in:
wing328 2016-03-30 15:14:58 +08:00
parent f0c3870386
commit 142a3bab72
22 changed files with 1754 additions and 78 deletions

View File

@ -3,6 +3,7 @@ package io.swagger.codegen.languages;
import io.swagger.codegen.CliOption;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.CodegenParameter;
import io.swagger.codegen.CodegenType;
import io.swagger.codegen.DefaultCodegen;
import io.swagger.codegen.SupportingFile;
@ -17,6 +18,8 @@ import org.apache.commons.lang.StringUtils;
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String packageName;
protected String packageVersion;
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public PythonClientCodegen() {
super();
@ -28,6 +31,9 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
apiTemplateFiles.put("api.mustache", ".py");
embeddedTemplateDir = templateDir = "python";
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
languageSpecificPrimitives.clear();
languageSpecificPrimitives.add("int");
languageSpecificPrimitives.add("float");
@ -97,6 +103,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
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;
modelPackage = swaggerFolder + File.separatorChar + "models";
@ -138,6 +148,27 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
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
public String apiFileFolder() {
return outputFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar);
@ -388,4 +419,70 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
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)) {
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 ("\\SplFileObject".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 = "new \\DateTime(\"" + escapeText(example) + "\")";
} else if ("DateTime".equalsIgnoreCase(type)) {
if (example == null) {
example = "2013-10-20T19:20:30+01:00";
}
example = "new \\DateTime(\"" + escapeText(example) + "\")";
} else if (!languageSpecificPrimitives.contains(type)) {
// type is a model class, e.g. User
example = "new " + type + "()";
} else {
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
}
if (example == null) {
example = "NULL";
} else if (Boolean.TRUE.equals(p.isListContainer)) {
example = "array(" + example + ")";
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
example = "array('key' => " + example + ")";
}
p.example = example;
}
}

View File

@ -1,7 +1,23 @@
## Requirements.
Python 2.7 and later.
# {{packagePath}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
## Setuptools
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API verion: {{appVersion}}
- Package version: {{artifactVersion}}
- Build date: {{generatedDate}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Requirements.
Python 2.7 and 3.4+
## Installation & Usage
### Setuptools
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
@ -11,18 +27,17 @@ python setup.py install
Or you can install from Github via pip:
```sh
pip install git+https://github.com/geekerzp/swagger_client.git
pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git
```
To use the bindings, import the pacakge:
Finally import the pacakge:
```python
import swagger_client
```
## Manual Installation
If you do not wish to use setuptools, you can download the latest release.
Then, to use the bindings, import the package:
### Manual Installation
Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
```python
import path.to.swagger_client
@ -30,44 +45,77 @@ import path.to.swagger_client
## Getting Started
TODO
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
require_once(__DIR__ . '/vendor/autoload.php');
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
$api_instance = new {{invokerPackage}}\Api\{{classname}}();
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try {
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
print_r($result);{{/returnType}}
} catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), "\n";
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
?>
```
## Documentation
TODO
## Tests
## Documentation for API Endpoints
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed)
All URIs are relative to *{{basePath}}*
Execute the following command to run the tests in the current Python (v2 or v3) environment:
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
```sh
$ make test
[... magically installs dependencies and runs tests on your virtualenv]
Ran 7 tests in 19.289s
## Documentation For Models
OK
```
or
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
```
$ 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:
## Documentation For Authorization
```sh
$ make test-all
[... tox creates a virtualenv for every platform and runs tests inside of each]
py27: commands succeeded
py34: commands succeeded
congratulations :)
```
{{^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

@ -1,7 +1,18 @@
## Requirements.
Python 2.7 and later.
#
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
## Setuptools
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-30T15:12:57.913+08:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements.
Python 2.7 and 3.4+
## Installation & Usage
### Setuptools
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
@ -11,18 +22,17 @@ python setup.py install
Or you can install from Github via pip:
```sh
pip install git+https://github.com/geekerzp/swagger_client.git
pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git
```
To use the bindings, import the pacakge:
Finally import the pacakge:
```python
import swagger_client
```
## Manual Installation
If you do not wish to use setuptools, you can download the latest release.
Then, to use the bindings, import the package:
### Manual Installation
Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
```python
import path.to.swagger_client
@ -30,44 +40,128 @@ import path.to.swagger_client
## Getting Started
TODO
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
$api_instance->add_pet($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->add_pet: ', $e->getMessage(), "\n";
}
?>
```
## Documentation
TODO
## Tests
## Documentation for API Endpoints
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed)
All URIs are relative to *http://petstore.swagger.io/v2*
Execute the following command to run the tests in the current Python (v2 or v3) environment:
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*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
```sh
$ make test
[... magically installs dependencies and runs tests on your virtualenv]
Ran 7 tests in 19.289s
OK
```
or
## Documentation For Models
```
$ 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:
- [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
```sh
$ make test-all
[... tox creates a virtualenv for every platform and runs tests inside of each]
py27: commands succeeded
py34: commands succeeded
congratulations :)
```

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**](object.md) | | [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,563 @@
# \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)
Add a new pet to the store
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
$api_instance->add_pet($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->add_pet: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Fake endpoint to test byte array in body parameter for adding a new pet to the store
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$body = B; // str | Pet object in the form of byte array
try {
$api_instance->add_pet_using_byte_array($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->add_pet_using_byte_array: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Deletes a pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$pet_id = 789; // int | Pet id to delete
$api_key = api_key_example; // str |
try {
$api_instance->delete_pet($pet_id, $api_key);
} catch (Exception $e) {
echo 'Exception when calling PetApi->delete_pet: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$status = array(available); // list[str] | Status values that need to be considered for query
try {
$result = $api_instance->find_pets_by_status($status);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->find_pets_by_status: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$tags = NULL; // list[str] | Tags to filter by
try {
$result = $api_instance->find_pets_by_tags($tags);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->find_pets_by_tags: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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();
$pet_id = 789; // int | ID of pet that needs to be fetched
try {
$result = $api_instance->get_pet_by_id($pet_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->get_pet_by_id: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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();
$pet_id = 789; // int | ID of pet that needs to be fetched
try {
$result = $api_instance->get_pet_by_id_in_object($pet_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->get_pet_by_id_in_object: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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();
$pet_id = 789; // int | ID of pet that needs to be fetched
try {
$result = $api_instance->pet_pet_idtesting_byte_arraytrue_get($pet_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Update an existing pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
$api_instance->update_pet($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->update_pet: ', $e->getMessage(), "\n";
}
?>
```
### 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, $status)
Updates a pet in the store with form data
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$pet_id = pet_id_example; // str | ID of pet that needs to be updated
$name = name_example; // str | Updated name of the pet
$status = status_example; // str | Updated status of the pet
try {
$api_instance->update_pet_with_form($pet_id, $name, $status);
} catch (Exception $e) {
echo 'Exception when calling PetApi->update_pet_with_form: ', $e->getMessage(), "\n";
}
?>
```
### 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, $file)
uploads an image
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new \Api\PetApi();
$pet_id = 789; // int | ID of pet to update
$additional_metadata = additional_metadata_example; // str | Additional data to pass to server
$file = new file(); // file | file to upload
try {
$api_instance->upload_file($pet_id, $additional_metadata, $file);
} catch (Exception $e) {
echo 'Exception when calling PetApi->upload_file: ', $e->getMessage(), "\n";
}
?>
```
### 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,312 @@
# \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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$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";
}
?>
```
### 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)
Finds orders by status
A single status value can be provided as a string
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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
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";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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();
try {
$result = $api_instance->get_inventory();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->get_inventory: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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();
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";
}
?>
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**object**](object.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_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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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
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";
}
?>
```
### 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)
Place an order for a pet
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// 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
try {
$result = $api_instance->place_order($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->place_order: ', $e->getMessage(), "\n";
}
?>
```
### 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,374 @@
# \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)
Create user
This can only be done by the logged in user.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
$body = new User(); // User | Created user object
try {
$api_instance->create_user($body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->create_user: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Creates list of users with given input array
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
$body = array(new User()); // list[User] | List of user object
try {
$api_instance->create_users_with_array_input($body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->create_users_with_array_input: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Creates list of users with given input array
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
$body = array(new User()); // list[User] | List of user object
try {
$api_instance->create_users_with_list_input($body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->create_users_with_list_input: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: test_http_basic
\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$api_instance = new \Api\UserApi();
$username = username_example; // str | The name that needs to be deleted
try {
$api_instance->delete_user($username);
} catch (Exception $e) {
echo 'Exception when calling UserApi->delete_user: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
$username = username_example; // str | The name that needs to be fetched. Use user1 for testing.
try {
$result = $api_instance->get_user_by_name($username);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->get_user_by_name: ', $e->getMessage(), "\n";
}
?>
```
### 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, $password)
Logs user into the system
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$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 {
$result = $api_instance->login_user($username, $password);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->login_user: ', $e->getMessage(), "\n";
}
?>
```
### 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
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
try {
$api_instance->logout_user();
} catch (Exception $e) {
echo 'Exception when calling UserApi->logout_user: ', $e->getMessage(), "\n";
}
?>
```
### 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)
Updated user
This can only be done by the logged in user.
### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new \Api\UserApi();
$username = username_example; // str | name that need to be deleted
$body = new User(); // User | Updated user object
try {
$api_instance->update_user($username, $body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->update_user: ', $e->getMessage(), "\n";
}
?>
```
### 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
# import models into sdk package
from .models.animal import Animal
from .models.cat import Cat
from .models.category import Category
from .models.dog import Dog
from .models.inline_response_200 import InlineResponse200
from .models.model_200_response import Model200Response
from .models.model_return import ModelReturn

View File

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

View File

@ -37,14 +37,17 @@ class Name(object):
and the value is json key in definition.
"""
self.swagger_types = {
'name': 'int'
'name': 'int',
'snake_case': 'int'
}
self.attribute_map = {
'name': 'name'
'name': 'name',
'snake_case': 'snake_case'
}
self._name = None
self._snake_case = None
@property
def name(self):
@ -68,6 +71,28 @@ class Name(object):
"""
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):
"""
Returns the model properties as a dict