add auth sample code to perl, add links to readme, etc

This commit is contained in:
wing328
2016-03-13 22:43:46 +08:00
parent 4a53db839d
commit 7f6069f255
19 changed files with 323 additions and 73 deletions

View File

@@ -218,6 +218,20 @@ spec. If so, this is available via the `class_documentation()` and
Each of these calls returns a hashref with various useful pieces of information.
# LOAD THE MODULES
To load the API packages:
```perl
{{#apiInfo}}{{#apis}}use {{moduleName}}::{{classname}};
{{/apis}}{{/apiInfo}}
```
To load the models:
```perl
{{#models}}{{#model}}use {{moduleName}}::Object::{{classname}};
{{/model}}{{/models}}
````
# DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *{{basePath}}*
@@ -246,7 +260,7 @@ Class | Method | HTTP request | Description
- **Flow**: {{{flow}}}
- **Authorizatoin URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}-- {{{scope}}}: {{{description}}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}

View File

@@ -1,6 +1,11 @@
# {{moduleName}}::{{classname}}{{#description}}
{{description}}{{/description}}
## Load the API package
```perl
use {{moduleName}}::Object::{{classname}};
```
All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
@@ -19,15 +24,29 @@ Method | HTTP request | Description
### Example
```perl
use Data::Dumper;
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}}
{{{moduleName}}}::Configuration::username = 'YOUR_USERNAME';
{{{moduleName}}}::Configuration::password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}}
# Configure API key authorization: {{{name}}}
{{{moduleName}}}::Configuration::api_key->{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#{{{moduleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = "BEARER";{{/isApiKey}}{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
{{{moduleName}}}::Configuration::access_token = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
my $api = {{moduleName}}::{{classname}}->new();
{{#allParams}}my ${{paramName}} = {{#isListContainer}}({{/isListContainer}}{{#isBodyParam}}{{{moduleName}}}::Object::{{dataType}}->new(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}){{/isListContainer}}; # [{{{dataType}}}] {{description}}
{{/allParams}}
eval {
{{#returnType}}my $result = {{/returnType}}$api->{{{operationId}}}({{#allParams}}{{paramName}} => ${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{#returnType}}my $result = {{/returnType}}$api->{{{operationId}}}({{#allParams}}{{paramName}} => ${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
print Dumper($result);{{/returnType}}
};
if ($@) {
warn "Exception when calling {{operationId}}: $@\n";
warn "Exception when calling {{classname}}->{{operationId}}: $@\n";
}
```
@@ -51,7 +70,7 @@ Name | Type | Description | Notes
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
{{/operation}}
{{/operations}}

View File

@@ -1,6 +1,6 @@
{{#models}}{{#model}}# {{moduleName}}::Object::{{classname}}
## Import the module
## Load the model package
```perl
use {{moduleName}}::Object::{{classname}};
```
@@ -11,4 +11,6 @@ Name | Type | Description | Notes
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{{/model}}{{/models}}

View File

@@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
Automatically generated by the Perl Swagger Codegen project:
- Build date: 2016-03-12T17:06:52.449+08:00
- Build date: 2016-03-13T22:43:11.863+08:00
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
- Codegen version:
@@ -218,6 +218,30 @@ spec. If so, this is available via the `class_documentation()` and
Each of these calls returns a hashref with various useful pieces of information.
# LOAD THE MODULES
To load the API packages:
```perl
use WWW::SwaggerClient::PetApi;
use WWW::SwaggerClient::StoreApi;
use WWW::SwaggerClient::UserApi;
```
To load the models:
```perl
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::InlineResponse200;
use WWW::SwaggerClient::Object::ModelReturn;
use WWW::SwaggerClient::Object::Name;
use WWW::SwaggerClient::Object::Order;
use WWW::SwaggerClient::Object::Pet;
use WWW::SwaggerClient::Object::SpecialModelName;
use WWW::SwaggerClient::Object::Tag;
use WWW::SwaggerClient::Object::User;
````
# DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *http://petstore.swagger.io/v2*
@@ -277,6 +301,10 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header
## test_http_basic
- **Type**: HTTP basic authentication
## test_api_client_secret
- **Type**: API key
@@ -301,8 +329,8 @@ Class | Method | HTTP request | Description
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
-- write:pets: modify pets in your account
-- read:pets: read your pets
- **write:pets**: modify pets in your account
- **read:pets**: read your pets

View File

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::Category
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::Category;
```
@@ -11,4 +11,6 @@ Name | Type | Description | Notes
**id** | **int** | | [optional]
**name** | **string** | | [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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::InlineResponse200
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::InlineResponse200;
```
@@ -15,4 +15,6 @@ Name | Type | Description | Notes
**name** | **string** | | [optional]
**photo_urls** | **ARRAY[string]** | | [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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::ModelReturn
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::ModelReturn;
```
@@ -10,4 +10,6 @@ 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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::Name
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::Name;
```
@@ -10,4 +10,6 @@ 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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::Order
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::Order;
```
@@ -15,4 +15,6 @@ Name | Type | Description | Notes
**status** | **string** | Order Status | [optional]
**complete** | **boolean** | | [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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::Pet
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::Pet;
```
@@ -15,4 +15,6 @@ Name | Type | Description | Notes
**tags** | [**ARRAY[Tag]**](Tag.md) | | [optional]
**status** | **string** | 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

@@ -1,5 +1,10 @@
# WWW::SwaggerClient::PetApi
## Load the API package
```perl
use WWW::SwaggerClient::Object::PetApi;
```
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
@@ -26,6 +31,11 @@ Add a new pet to the store
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $body = WWW::SwaggerClient::Object::Pet->new(); # [Pet] Pet object that needs to be added to the store
@@ -33,7 +43,7 @@ eval {
$api->add_pet(body => $body);
};
if ($@) {
warn "Exception when calling add_pet: $@\n";
warn "Exception when calling PetApi->add_pet: $@\n";
}
```
@@ -56,7 +66,7 @@ void (empty response body)
- **Content-Type**: application/json, application/xml
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **add_pet_using_byte_array**
> add_pet_using_byte_array(body => $body)
@@ -67,6 +77,11 @@ Fake endpoint to test byte array in body parameter for adding a new pet to the s
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $body = WWW::SwaggerClient::Object::string->new(); # [string] Pet object in the form of byte array
@@ -74,7 +89,7 @@ eval {
$api->add_pet_using_byte_array(body => $body);
};
if ($@) {
warn "Exception when calling add_pet_using_byte_array: $@\n";
warn "Exception when calling PetApi->add_pet_using_byte_array: $@\n";
}
```
@@ -97,7 +112,7 @@ void (empty response body)
- **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 => $pet_id, api_key => $api_key)
@@ -108,6 +123,11 @@ Deletes a pet
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 789; # [int] Pet id to delete
my $api_key = 'api_key_example'; # [string]
@@ -116,7 +136,7 @@ eval {
$api->delete_pet(pet_id => $pet_id, api_key => $api_key);
};
if ($@) {
warn "Exception when calling delete_pet: $@\n";
warn "Exception when calling PetApi->delete_pet: $@\n";
}
```
@@ -140,7 +160,7 @@ void (empty response body)
- **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**
> ARRAY[Pet] find_pets_by_status(status => $status)
@@ -151,14 +171,20 @@ Multiple status values can be provided with comma separated strings
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $status = (); # [ARRAY[string]] Status values that need to be considered for query
eval {
my $result = $api->find_pets_by_status(status => $status);
print Dumper($result);
};
if ($@) {
warn "Exception when calling find_pets_by_status: $@\n";
warn "Exception when calling PetApi->find_pets_by_status: $@\n";
}
```
@@ -181,7 +207,7 @@ Name | Type | Description | Notes
- **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**
> ARRAY[Pet] find_pets_by_tags(tags => $tags)
@@ -192,14 +218,20 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $tags = (); # [ARRAY[string]] Tags to filter by
eval {
my $result = $api->find_pets_by_tags(tags => $tags);
print Dumper($result);
};
if ($@) {
warn "Exception when calling find_pets_by_tags: $@\n";
warn "Exception when calling PetApi->find_pets_by_tags: $@\n";
}
```
@@ -222,7 +254,7 @@ Name | Type | Description | Notes
- **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 => $pet_id)
@@ -233,14 +265,24 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
### Example
```perl
use Data::Dumper;
# Configure API key authorization: api_key
WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER";
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 789; # [int] ID of pet that needs to be fetched
eval {
my $result = $api->get_pet_by_id(pet_id => $pet_id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_pet_by_id: $@\n";
warn "Exception when calling PetApi->get_pet_by_id: $@\n";
}
```
@@ -263,7 +305,7 @@ Name | Type | Description | Notes
- **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 => $pet_id)
@@ -274,14 +316,24 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
### Example
```perl
use Data::Dumper;
# Configure API key authorization: api_key
WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER";
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 789; # [int] ID of pet that needs to be fetched
eval {
my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_pet_by_id_in_object: $@\n";
warn "Exception when calling PetApi->get_pet_by_id_in_object: $@\n";
}
```
@@ -304,7 +356,7 @@ Name | Type | Description | Notes
- **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**
> string pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id)
@@ -315,14 +367,24 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
### Example
```perl
use Data::Dumper;
# Configure API key authorization: api_key
WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER";
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 789; # [int] ID of pet that needs to be fetched
eval {
my $result = $api->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling pet_pet_idtesting_byte_arraytrue_get: $@\n";
warn "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: $@\n";
}
```
@@ -345,7 +407,7 @@ Name | Type | Description | Notes
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_pet**
> update_pet(body => $body)
@@ -356,6 +418,11 @@ Update an existing pet
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $body = WWW::SwaggerClient::Object::Pet->new(); # [Pet] Pet object that needs to be added to the store
@@ -363,7 +430,7 @@ eval {
$api->update_pet(body => $body);
};
if ($@) {
warn "Exception when calling update_pet: $@\n";
warn "Exception when calling PetApi->update_pet: $@\n";
}
```
@@ -386,7 +453,7 @@ void (empty response body)
- **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 => $pet_id, name => $name, status => $status)
@@ -397,6 +464,11 @@ Updates a pet in the store with form data
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 'pet_id_example'; # [string] ID of pet that needs to be updated
my $name = 'name_example'; # [string] Updated name of the pet
@@ -406,7 +478,7 @@ eval {
$api->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status);
};
if ($@) {
warn "Exception when calling update_pet_with_form: $@\n";
warn "Exception when calling PetApi->update_pet_with_form: $@\n";
}
```
@@ -431,7 +503,7 @@ void (empty response body)
- **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 => $pet_id, additional_metadata => $additional_metadata, file => $file)
@@ -442,6 +514,11 @@ uploads an image
### Example
```perl
use Data::Dumper;
# Configure OAuth2 access token for authorization: petstore_auth
WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
my $api = WWW::SwaggerClient::PetApi->new();
my $pet_id = 789; # [int] ID of pet to update
my $additional_metadata = 'additional_metadata_example'; # [string] Additional data to pass to server
@@ -451,7 +528,7 @@ eval {
$api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file);
};
if ($@) {
warn "Exception when calling upload_file: $@\n";
warn "Exception when calling PetApi->upload_file: $@\n";
}
```
@@ -476,5 +553,5 @@ void (empty response body)
- **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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::SpecialModelName
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::SpecialModelName;
```
@@ -10,4 +10,6 @@ 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

@@ -1,5 +1,10 @@
# WWW::SwaggerClient::StoreApi
## Load the API package
```perl
use WWW::SwaggerClient::Object::StoreApi;
```
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
@@ -21,6 +26,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::StoreApi->new();
my $order_id = 'order_id_example'; # [string] ID of the order that needs to be deleted
@@ -28,7 +35,7 @@ eval {
$api->delete_order(order_id => $order_id);
};
if ($@) {
warn "Exception when calling delete_order: $@\n";
warn "Exception when calling StoreApi->delete_order: $@\n";
}
```
@@ -51,7 +58,7 @@ No authorization required
- **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**
> ARRAY[Order] find_orders_by_status(status => $status)
@@ -62,14 +69,26 @@ A single status value can be provided as a string
### Example
```perl
use Data::Dumper;
# Configure API key authorization: test_api_client_id
WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER";
# Configure API key authorization: test_api_client_secret
WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER";
my $api = WWW::SwaggerClient::StoreApi->new();
my $status = 'status_example'; # [string] Status value that needs to be considered for query
eval {
my $result = $api->find_orders_by_status(status => $status);
print Dumper($result);
};
if ($@) {
warn "Exception when calling find_orders_by_status: $@\n";
warn "Exception when calling StoreApi->find_orders_by_status: $@\n";
}
```
@@ -92,7 +111,7 @@ Name | Type | Description | Notes
- **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**
> HASH[string,int] get_inventory()
@@ -103,13 +122,21 @@ Returns a map of status codes to quantities
### Example
```perl
use Data::Dumper;
# Configure API key authorization: api_key
WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER";
my $api = WWW::SwaggerClient::StoreApi->new();
eval {
my $result = $api->get_inventory();
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_inventory: $@\n";
warn "Exception when calling StoreApi->get_inventory: $@\n";
}
```
@@ -129,7 +156,7 @@ This endpoint does not need any parameter.
- **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()
@@ -140,13 +167,21 @@ Returns an arbitrary object which is actually a map of status codes to quantitie
### Example
```perl
use Data::Dumper;
# Configure API key authorization: api_key
WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER";
my $api = WWW::SwaggerClient::StoreApi->new();
eval {
my $result = $api->get_inventory_in_object();
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_inventory_in_object: $@\n";
warn "Exception when calling StoreApi->get_inventory_in_object: $@\n";
}
```
@@ -166,7 +201,7 @@ This endpoint does not need any parameter.
- **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 => $order_id)
@@ -177,14 +212,26 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
### Example
```perl
use Data::Dumper;
# Configure API key authorization: test_api_key_header
WWW::SwaggerClient::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER";
# Configure API key authorization: test_api_key_query
WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER";
my $api = WWW::SwaggerClient::StoreApi->new();
my $order_id = 'order_id_example'; # [string] ID of pet that needs to be fetched
eval {
my $result = $api->get_order_by_id(order_id => $order_id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_order_by_id: $@\n";
warn "Exception when calling StoreApi->get_order_by_id: $@\n";
}
```
@@ -207,7 +254,7 @@ Name | Type | Description | Notes
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **place_order**
> Order place_order(body => $body)
@@ -218,14 +265,26 @@ Place an order for a pet
### Example
```perl
use Data::Dumper;
# Configure API key authorization: test_api_client_id
WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER";
# Configure API key authorization: test_api_client_secret
WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. BEARER) for API key, if needed
#WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER";
my $api = WWW::SwaggerClient::StoreApi->new();
my $body = WWW::SwaggerClient::Object::Order->new(); # [Order] order placed for purchasing the pet
eval {
my $result = $api->place_order(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling place_order: $@\n";
warn "Exception when calling StoreApi->place_order: $@\n";
}
```
@@ -248,5 +307,5 @@ Name | Type | Description | Notes
- **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,6 +1,6 @@
# WWW::SwaggerClient::Object::Tag
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::Tag;
```
@@ -11,4 +11,6 @@ Name | Type | Description | Notes
**id** | **int** | | [optional]
**name** | **string** | | [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

@@ -1,6 +1,6 @@
# WWW::SwaggerClient::Object::User
## Import the module
## Load the model package
```perl
use WWW::SwaggerClient::Object::User;
```
@@ -17,4 +17,6 @@ Name | Type | Description | Notes
**phone** | **string** | | [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

@@ -1,5 +1,10 @@
# WWW::SwaggerClient::UserApi
## Load the API package
```perl
use WWW::SwaggerClient::Object::UserApi;
```
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
@@ -23,6 +28,8 @@ This can only be done by the logged in user.
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $body = WWW::SwaggerClient::Object::User->new(); # [User] Created user object
@@ -30,7 +37,7 @@ eval {
$api->create_user(body => $body);
};
if ($@) {
warn "Exception when calling create_user: $@\n";
warn "Exception when calling UserApi->create_user: $@\n";
}
```
@@ -53,7 +60,7 @@ No authorization required
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_array_input**
> create_users_with_array_input(body => $body)
@@ -64,6 +71,8 @@ Creates list of users with given input array
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # [ARRAY[User]] List of user object
@@ -71,7 +80,7 @@ eval {
$api->create_users_with_array_input(body => $body);
};
if ($@) {
warn "Exception when calling create_users_with_array_input: $@\n";
warn "Exception when calling UserApi->create_users_with_array_input: $@\n";
}
```
@@ -94,7 +103,7 @@ No authorization required
- **Content-Type**: Not defined
- **Accept**: application/json, application/xml
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_list_input**
> create_users_with_list_input(body => $body)
@@ -105,6 +114,8 @@ Creates list of users with given input array
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # [ARRAY[User]] List of user object
@@ -112,7 +123,7 @@ eval {
$api->create_users_with_list_input(body => $body);
};
if ($@) {
warn "Exception when calling create_users_with_list_input: $@\n";
warn "Exception when calling UserApi->create_users_with_list_input: $@\n";
}
```
@@ -135,7 +146,7 @@ No authorization required
- **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 => $username)
@@ -146,6 +157,12 @@ This can only be done by the logged in user.
### Example
```perl
use Data::Dumper;
# Configure HTTP basic authorization: test_http_basic
WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME';
WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD';
my $api = WWW::SwaggerClient::UserApi->new();
my $username = 'username_example'; # [string] The name that needs to be deleted
@@ -153,7 +170,7 @@ eval {
$api->delete_user(username => $username);
};
if ($@) {
warn "Exception when calling delete_user: $@\n";
warn "Exception when calling UserApi->delete_user: $@\n";
}
```
@@ -169,14 +186,14 @@ void (empty response body)
### Authorization
No authorization required
[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 => $username)
@@ -187,14 +204,17 @@ Get user by user name
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $username = 'username_example'; # [string] The name that needs to be fetched. Use user1 for testing.
eval {
my $result = $api->get_user_by_name(username => $username);
print Dumper($result);
};
if ($@) {
warn "Exception when calling get_user_by_name: $@\n";
warn "Exception when calling UserApi->get_user_by_name: $@\n";
}
```
@@ -217,7 +237,7 @@ No authorization required
- **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**
> string login_user(username => $username, password => $password)
@@ -228,15 +248,18 @@ Logs user into the system
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $username = 'username_example'; # [string] The user name for login
my $password = 'password_example'; # [string] The password for login in clear text
eval {
my $result = $api->login_user(username => $username, password => $password);
print Dumper($result);
};
if ($@) {
warn "Exception when calling login_user: $@\n";
warn "Exception when calling UserApi->login_user: $@\n";
}
```
@@ -260,7 +283,7 @@ No authorization required
- **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()
@@ -271,13 +294,15 @@ Logs out current logged in user session
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
eval {
$api->logout_user();
};
if ($@) {
warn "Exception when calling logout_user: $@\n";
warn "Exception when calling UserApi->logout_user: $@\n";
}
```
@@ -297,7 +322,7 @@ No authorization required
- **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 => $username, body => $body)
@@ -308,6 +333,8 @@ This can only be done by the logged in user.
### Example
```perl
use Data::Dumper;
my $api = WWW::SwaggerClient::UserApi->new();
my $username = 'username_example'; # [string] name that need to be deleted
my $body = WWW::SwaggerClient::Object::User->new(); # [User] Updated user object
@@ -316,7 +343,7 @@ eval {
$api->update_user(username => $username, body => $body);
};
if ($@) {
warn "Exception when calling update_user: $@\n";
warn "Exception when calling UserApi->update_user: $@\n";
}
```
@@ -340,5 +367,5 @@ No authorization required
- **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

@@ -333,6 +333,12 @@ sub update_params_for_auth {
$header_params->{'api_key'} = $api_key;
}
}
elsif ($auth eq 'test_http_basic') {
if ($WWW::SwaggerClient::Configuration::username || $WWW::SwaggerClient::Configuration::password) {
$header_params->{'Authorization'} = 'Basic ' . encode_base64($WWW::SwaggerClient::Configuration::username . ":" . $WWW::SwaggerClient::Configuration::password);
}
}
elsif ($auth eq 'test_api_client_secret') {
my $api_key = $self->get_api_key_with_prefix('x-test_api_client_secret');

View File

@@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => 'Swagger Petstore',
app_version => '1.0.0',
generated_date => '2016-03-12T17:06:52.449+08:00',
generated_date => '2016-03-13T22:43:11.863+08:00',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} },
documentation => 'Information about the application version and the codegen codebase version'
@@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
=over 4
=item Build date: 2016-03-12T17:06:52.449+08:00
=item Build date: 2016-03-13T22:43:11.863+08:00
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen

View File

@@ -307,7 +307,7 @@ sub delete_user {
# authentication setting, if any
my $auth_settings = [qw()];
my $auth_settings = [qw(test_http_basic )];
# make the API Call