diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index eaecc78e02a5..c2a0f8f3f2b5 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -216,7 +216,21 @@ spec. If so, this is available via the `class_documentation()` and my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; -Each of these calls returns a hashref with various useful pieces of information. +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 @@ -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}} diff --git a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache index ca9dee7aaf46..6b8ff2a4dd33 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache @@ -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}} diff --git a/modules/swagger-codegen/src/main/resources/perl/object_doc.mustache b/modules/swagger-codegen/src/main/resources/perl/object_doc.mustache index 4dd769c32d8c..b76874f90502 100644 --- a/modules/swagger-codegen/src/main/resources/perl/object_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/object_doc.mustache @@ -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}} diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 9abd60d84fdc..3758d282ddd4 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -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: @@ -216,7 +216,31 @@ spec. If so, this is available via the `class_documentation()` and my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; -Each of these calls returns a hashref with various useful pieces of information. +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 @@ -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 diff --git a/samples/client/petstore/perl/docs/Category.md b/samples/client/petstore/perl/docs/Category.md index ff26d61c18b3..aa69032fc1cf 100644 --- a/samples/client/petstore/perl/docs/Category.md +++ b/samples/client/petstore/perl/docs/Category.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/InlineResponse200.md b/samples/client/petstore/perl/docs/InlineResponse200.md index a97179f7ddd2..96d4ec3ff79d 100644 --- a/samples/client/petstore/perl/docs/InlineResponse200.md +++ b/samples/client/petstore/perl/docs/InlineResponse200.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/ModelReturn.md b/samples/client/petstore/perl/docs/ModelReturn.md index b91cac26d8f9..57afb49ae532 100644 --- a/samples/client/petstore/perl/docs/ModelReturn.md +++ b/samples/client/petstore/perl/docs/ModelReturn.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/Name.md b/samples/client/petstore/perl/docs/Name.md index 9521c57ccc63..91d0a056ab8c 100644 --- a/samples/client/petstore/perl/docs/Name.md +++ b/samples/client/petstore/perl/docs/Name.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/Order.md b/samples/client/petstore/perl/docs/Order.md index 3f519eabc948..542a3a91240d 100644 --- a/samples/client/petstore/perl/docs/Order.md +++ b/samples/client/petstore/perl/docs/Order.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/Pet.md b/samples/client/petstore/perl/docs/Pet.md index bc143f0cc262..5931f6bd5f39 100644 --- a/samples/client/petstore/perl/docs/Pet.md +++ b/samples/client/petstore/perl/docs/Pet.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 57296809313f..59211b4795ca 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -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) diff --git a/samples/client/petstore/perl/docs/SpecialModelName.md b/samples/client/petstore/perl/docs/SpecialModelName.md index 13ac1ac2c984..cab9c8ccef64 100644 --- a/samples/client/petstore/perl/docs/SpecialModelName.md +++ b/samples/client/petstore/perl/docs/SpecialModelName.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index b93896b770c1..a118da69a47a 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -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) diff --git a/samples/client/petstore/perl/docs/Tag.md b/samples/client/petstore/perl/docs/Tag.md index b97e36a7ca42..961035e41a47 100644 --- a/samples/client/petstore/perl/docs/Tag.md +++ b/samples/client/petstore/perl/docs/Tag.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/User.md b/samples/client/petstore/perl/docs/User.md index 35c5c4ef91db..b0335312e6a3 100644 --- a/samples/client/petstore/perl/docs/User.md +++ b/samples/client/petstore/perl/docs/User.md @@ -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) + diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index dc2981a1cd07..c1ddeedabb31 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -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) diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm index 3ec073358944..86dba7e1bcd6 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm @@ -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'); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 2147903053c2..ab84d287c406 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -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 diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm index 87fbacfebb79..e86cc571a709 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm @@ -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