From 72d0cd7eb4bb58033d2da18df917732be6dd27d1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 28 Aug 2016 15:57:50 +0800 Subject: [PATCH] update petl sample --- samples/client/petstore/perl/README.md | 28 +++- .../client/petstore/perl/docs/ArrayTest.md | 1 - samples/client/petstore/perl/docs/FakeApi.md | 67 +++++--- samples/client/petstore/perl/docs/PetApi.md | 20 ++- samples/client/petstore/perl/docs/StoreApi.md | 8 + samples/client/petstore/perl/docs/UserApi.md | 20 ++- .../perl/lib/WWW/SwaggerClient/ApiClient.pm | 6 + .../perl/lib/WWW/SwaggerClient/FakeApi.pm | 145 +++++++++++++----- .../lib/WWW/SwaggerClient/Object/ArrayTest.pm | 13 +- .../perl/lib/WWW/SwaggerClient/Role.pm | 4 +- 10 files changed, 231 insertions(+), 81 deletions(-) diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 3c7a28082e..18df4f126f 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -10,7 +10,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-06-28T16:35:21.686+08:00 +- Build date: 2016-08-28T15:57:37.016+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen ## A note on Moose @@ -241,11 +241,14 @@ use WWW::SwaggerClient::Object::ArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; +use WWW::SwaggerClient::Object::Client; use WWW::SwaggerClient::Object::Dog; +use WWW::SwaggerClient::Object::EnumArrays; use WWW::SwaggerClient::Object::EnumClass; use WWW::SwaggerClient::Object::EnumTest; use WWW::SwaggerClient::Object::FormatTest; use WWW::SwaggerClient::Object::HasOnlyReadOnly; +use WWW::SwaggerClient::Object::List; use WWW::SwaggerClient::Object::MapTest; use WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::SwaggerClient::Object::Model200Response; @@ -284,11 +287,14 @@ use WWW::SwaggerClient::Object::ArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; +use WWW::SwaggerClient::Object::Client; use WWW::SwaggerClient::Object::Dog; +use WWW::SwaggerClient::Object::EnumArrays; use WWW::SwaggerClient::Object::EnumClass; use WWW::SwaggerClient::Object::EnumTest; use WWW::SwaggerClient::Object::FormatTest; use WWW::SwaggerClient::Object::HasOnlyReadOnly; +use WWW::SwaggerClient::Object::List; use WWW::SwaggerClient::Object::MapTest; use WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::SwaggerClient::Object::Model200Response; @@ -304,15 +310,18 @@ use WWW::SwaggerClient::Object::User; # for displaying the API response data use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::; my $api_instance = WWW::SwaggerClient::FakeApi->new(); -my $test code inject */ =end = 'test code inject */ =end_example'; # string | To test code injection */ +my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model eval { - $api_instance->test_code_inject__end(test code inject */ =end => $test code inject */ =end); + my $result = $api_instance->test_client_model(body => $body); + print Dumper($result); }; if ($@) { - warn "Exception when calling FakeApi->test_code_inject__end: $@\n"; + warn "Exception when calling FakeApi->test_client_model: $@\n"; } ``` @@ -323,9 +332,9 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*FakeApi* | [**test_code_inject__end**](docs/FakeApi.md#test_code_inject__end) | **PUT** /fake | To test code injection */ +*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**test_enum_query_parameters**](docs/FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters +*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add 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 @@ -358,11 +367,14 @@ Class | Method | HTTP request | Description - [WWW::SwaggerClient::Object::ArrayTest](docs/ArrayTest.md) - [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md) + - [WWW::SwaggerClient::Object::Client](docs/Client.md) - [WWW::SwaggerClient::Object::Dog](docs/Dog.md) + - [WWW::SwaggerClient::Object::EnumArrays](docs/EnumArrays.md) - [WWW::SwaggerClient::Object::EnumClass](docs/EnumClass.md) - [WWW::SwaggerClient::Object::EnumTest](docs/EnumTest.md) - [WWW::SwaggerClient::Object::FormatTest](docs/FormatTest.md) - [WWW::SwaggerClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [WWW::SwaggerClient::Object::List](docs/List.md) - [WWW::SwaggerClient::Object::MapTest](docs/MapTest.md) - [WWW::SwaggerClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md) @@ -394,5 +406,9 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## http_basic_test + +- **Type**: HTTP basic authentication + diff --git a/samples/client/petstore/perl/docs/ArrayTest.md b/samples/client/petstore/perl/docs/ArrayTest.md index e6495d4da5..635c26a893 100644 --- a/samples/client/petstore/perl/docs/ArrayTest.md +++ b/samples/client/petstore/perl/docs/ArrayTest.md @@ -11,7 +11,6 @@ Name | Type | Description | Notes **array_of_string** | **ARRAY[string]** | | [optional] **array_array_of_integer** | **ARRAY[ARRAY[int]]** | | [optional] **array_array_of_model** | **ARRAY[ARRAY[ReadOnlyFirst]]** | | [optional] -**array_of_enum** | **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/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 1207308ca2..985b78596e 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -9,28 +9,31 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_code_inject__end**](FakeApi.md#test_code_inject__end) | **PUT** /fake | To test code injection */ +[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**test_enum_query_parameters**](FakeApi.md#test_enum_query_parameters) | **GET** /fake | To test enum query parameters +[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters -# **test_code_inject__end** -> test_code_inject__end(test code inject */ =end => $test code inject */ =end) +# **test_client_model** +> Client test_client_model(body => $body) -To test code injection */ +To test \"client\" model ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; my $api_instance = WWW::SwaggerClient::FakeApi->new(); -my $test code inject */ =end = 'test code inject */ =end_example'; # string | To test code injection */ +my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model eval { - $api_instance->test_code_inject__end(test code inject */ =end => $test code inject */ =end); + my $result = $api_instance->test_client_model(body => $body); + print Dumper($result); }; if ($@) { - warn "Exception when calling FakeApi->test_code_inject__end: $@\n"; + warn "Exception when calling FakeApi->test_client_model: $@\n"; } ``` @@ -38,11 +41,11 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **test code inject */ =end** | **string**| To test code injection */ | [optional] + **body** | [**Client**](Client.md)| client model | ### Return type -void (empty response body) +[**Client**](Client.md) ### Authorization @@ -50,13 +53,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json, */ =end));(phpinfo( - - **Accept**: application/json, */ end + - **Content-Type**: application/json + - **Accept**: application/json [[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) # **test_endpoint_parameters** -> test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password) +> test_endpoint_parameters(number => $number, double => $double, pattern_without_delimiter => $pattern_without_delimiter, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, string => $string, binary => $binary, date => $date, date_time => $date_time, password => $password) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -65,23 +68,30 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; + +# Configure HTTP basic authorization: http_basic_test +$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME'; +$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD'; my $api_instance = WWW::SwaggerClient::FakeApi->new(); my $number = 3.4; # Number | None my $double = 1.2; # double | None -my $string = 'string_example'; # string | None +my $pattern_without_delimiter = 'pattern_without_delimiter_example'; # string | None my $byte = 'B'; # string | None my $integer = 56; # int | None my $int32 = 56; # int | None my $int64 = 789; # int | None my $float = 3.4; # double | None +my $string = 'string_example'; # string | None my $binary = 'B'; # string | None my $date = DateTime->from_epoch(epoch => str2time('2013-10-20')); # DateTime | None my $date_time = DateTime->from_epoch(epoch => str2time('2013-10-20T19:20:30+01:00')); # DateTime | None my $password = 'password_example'; # string | None eval { - $api_instance->test_endpoint_parameters(number => $number, double => $double, string => $string, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, binary => $binary, date => $date, date_time => $date_time, password => $password); + $api_instance->test_endpoint_parameters(number => $number, double => $double, pattern_without_delimiter => $pattern_without_delimiter, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, string => $string, binary => $binary, date => $date, date_time => $date_time, password => $password); }; if ($@) { warn "Exception when calling FakeApi->test_endpoint_parameters: $@\n"; @@ -94,12 +104,13 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **number** | **Number**| None | **double** | **double**| None | - **string** | **string**| None | + **pattern_without_delimiter** | **string**| None | **byte** | **string**| None | **integer** | **int**| None | [optional] **int32** | **int**| None | [optional] **int64** | **int**| None | [optional] **float** | **double**| None | [optional] + **string** | **string**| None | [optional] **binary** | **string**| None | [optional] **date** | **DateTime**| None | [optional] **date_time** | **DateTime**| None | [optional] @@ -111,7 +122,7 @@ void (empty response body) ### Authorization -No authorization required +[http_basic_test](../README.md#http_basic_test) ### HTTP request headers @@ -120,25 +131,32 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **test_enum_query_parameters** -> test_enum_query_parameters(enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double) +# **test_enum_parameters** +> test_enum_parameters(enum_form_string_array => $enum_form_string_array, enum_form_string => $enum_form_string, enum_header_string_array => $enum_header_string_array, enum_header_string => $enum_header_string, enum_query_string_array => $enum_query_string_array, enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double) -To test enum query parameters +To test enum parameters ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $enum_form_string_array = []; # ARRAY[string] | Form parameter enum test (string array) +my $enum_form_string = 'enum_form_string_example'; # string | Form parameter enum test (string) +my $enum_header_string_array = []; # ARRAY[string] | Header parameter enum test (string array) +my $enum_header_string = 'enum_header_string_example'; # string | Header parameter enum test (string) +my $enum_query_string_array = []; # ARRAY[string] | Query parameter enum test (string array) my $enum_query_string = 'enum_query_string_example'; # string | Query parameter enum test (string) my $enum_query_integer = 3.4; # Number | Query parameter enum test (double) my $enum_query_double = 1.2; # double | Query parameter enum test (double) eval { - $api_instance->test_enum_query_parameters(enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double); + $api_instance->test_enum_parameters(enum_form_string_array => $enum_form_string_array, enum_form_string => $enum_form_string, enum_header_string_array => $enum_header_string_array, enum_header_string => $enum_header_string, enum_query_string_array => $enum_query_string_array, enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double); }; if ($@) { - warn "Exception when calling FakeApi->test_enum_query_parameters: $@\n"; + warn "Exception when calling FakeApi->test_enum_parameters: $@\n"; } ``` @@ -146,6 +164,11 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **enum_form_string_array** | [**ARRAY[string]**](string.md)| Form parameter enum test (string array) | [optional] + **enum_form_string** | **string**| Form parameter enum test (string) | [optional] [default to -efg] + **enum_header_string_array** | [**ARRAY[string]**](string.md)| Header parameter enum test (string array) | [optional] + **enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg] + **enum_query_string_array** | [**ARRAY[string]**](string.md)| Query parameter enum test (string array) | [optional] **enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enum_query_integer** | **Number**| Query parameter enum test (double) | [optional] **enum_query_double** | **double**| Query parameter enum test (double) | [optional] diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index c2f4e2ce4e..ab07b6413a 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -29,6 +29,8 @@ Add a new pet to the store ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -75,6 +77,8 @@ Deletes a pet ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -123,12 +127,14 @@ Multiple status values can be provided with comma separated strings ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $status = (); # ARRAY[string] | Status values that need to be considered for filter +my $status = []; # ARRAY[string] | Status values that need to be considered for filter eval { my $result = $api_instance->find_pets_by_status(status => $status); @@ -170,12 +176,14 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $tags = (); # ARRAY[string] | Tags to filter by +my $tags = []; # ARRAY[string] | Tags to filter by eval { my $result = $api_instance->find_pets_by_tags(tags => $tags); @@ -217,6 +225,8 @@ Returns a single pet ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; @@ -266,6 +276,8 @@ Update an existing pet ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -312,6 +324,8 @@ Updates a pet in the store with form data ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; @@ -362,6 +376,8 @@ uploads an image ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::PetApi; # Configure OAuth2 access token for authorization: petstore_auth $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index f0681b4716..d57b4121cc 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -25,6 +25,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::StoreApi; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $order_id = 'order_id_example'; # string | ID of the order that needs to be deleted @@ -68,6 +70,8 @@ Returns a map of status codes to quantities ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::StoreApi; # Configure API key authorization: api_key $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; @@ -113,6 +117,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::StoreApi; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $order_id = 789; # int | ID of pet that needs to be fetched @@ -157,6 +163,8 @@ Place an order for a pet ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::StoreApi; my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $body = WWW::SwaggerClient::Object::Order->new(); # Order | order placed for purchasing the pet diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index faa4c79973..081f0dc1d5 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -29,6 +29,8 @@ This can only be done by the logged in user. ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); my $body = WWW::SwaggerClient::Object::User->new(); # User | Created user object @@ -72,9 +74,11 @@ Creates list of users with given input array ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); -my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # ARRAY[User] | List of user object +my $body = [WWW::SwaggerClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object eval { $api_instance->create_users_with_array_input(body => $body); @@ -115,9 +119,11 @@ Creates list of users with given input array ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); -my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # ARRAY[User] | List of user object +my $body = [WWW::SwaggerClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object eval { $api_instance->create_users_with_list_input(body => $body); @@ -158,6 +164,8 @@ This can only be done by the logged in user. ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The name that needs to be deleted @@ -201,6 +209,8 @@ Get user by user name ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The name that needs to be fetched. Use user1 for testing. @@ -245,6 +255,8 @@ Logs user into the system ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The user name for login @@ -291,6 +303,8 @@ Logs out current logged in user session ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); @@ -330,6 +344,8 @@ This can only be done by the logged in user. ### Example ```perl use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::UserApi; my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | name that need to be deleted diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm index 92228e6c74..ad679c64cb 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm @@ -363,6 +363,12 @@ elsif ($auth eq 'petstore_auth') { $header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token; } } +elsif ($auth eq 'http_basic_test') { + + if ($WWW::SwaggerClient::Configuration::username || $WWW::SwaggerClient::Configuration::password) { + $header_params->{'Authorization'} = 'Basic ' . encode_base64($WWW::SwaggerClient::Configuration::username . ":" . $WWW::SwaggerClient::Configuration::password); + } + } else { # TODO show warning about security definition not found } diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm index eefd264128..ef2ba24f88 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm @@ -64,60 +64,69 @@ sub new { # -# test_code_inject__end +# test_client_model # -# To test code injection */ +# To test \"client\" model # -# @param string $test code inject */ =end To test code injection */ (optional) +# @param Client $body client model (required) { my $params = { - 'test code inject */ =end' => { - data_type => 'string', - description => 'To test code injection */ ', - required => '0', + 'body' => { + data_type => 'Client', + description => 'client model', + required => '1', }, }; - __PACKAGE__->method_documentation->{ 'test_code_inject__end' } = { - summary => 'To test code injection */ ', + __PACKAGE__->method_documentation->{ 'test_client_model' } = { + summary => 'To test \"client\" model', params => $params, - returns => undef, + returns => 'Client', }; } -# @return void +# @return Client # -sub test_code_inject__end { +sub test_client_model { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling test_client_model"); + } + # parse inputs my $_resource_path = '/fake'; $_resource_path =~ s/{format}/json/; # default format to json - my $_method = 'PUT'; + my $_method = 'PATCH'; my $query_params = {}; my $header_params = {}; my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ end'); + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ =end));(phpinfo('); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); - # form params - if ( exists $args{'test code inject */ =end'} ) { - $form_params->{'test code inject */ =end'} = $self->{api_client}->to_form_value($args{'test code inject */ =end'}); - } - my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, + my $response = $self->{api_client}->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); - return; + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('Client', $response); + return $_response_object; } # @@ -127,12 +136,13 @@ sub test_code_inject__end { # # @param Number $number None (required) # @param double $double None (required) -# @param string $string None (required) +# @param string $pattern_without_delimiter None (required) # @param string $byte None (required) # @param int $integer None (optional) # @param int $int32 None (optional) # @param int $int64 None (optional) # @param double $float None (optional) +# @param string $string None (optional) # @param string $binary None (optional) # @param DateTime $date None (optional) # @param DateTime $date_time None (optional) @@ -149,7 +159,7 @@ sub test_code_inject__end { description => 'None', required => '1', }, - 'string' => { + 'pattern_without_delimiter' => { data_type => 'string', description => 'None', required => '1', @@ -179,6 +189,11 @@ sub test_code_inject__end { description => 'None', required => '0', }, + 'string' => { + data_type => 'string', + description => 'None', + required => '0', + }, 'binary' => { data_type => 'string', description => 'None', @@ -221,9 +236,9 @@ sub test_endpoint_parameters { croak("Missing the required parameter 'double' when calling test_endpoint_parameters"); } - # verify the required parameter 'string' is set - unless (exists $args{'string'}) { - croak("Missing the required parameter 'string' when calling test_endpoint_parameters"); + # verify the required parameter 'pattern_without_delimiter' is set + unless (exists $args{'pattern_without_delimiter'}) { + croak("Missing the required parameter 'pattern_without_delimiter' when calling test_endpoint_parameters"); } # verify the required parameter 'byte' is set @@ -282,6 +297,11 @@ sub test_endpoint_parameters { $form_params->{'string'} = $self->{api_client}->to_form_value($args{'string'}); } + # form params + if ( exists $args{'pattern_without_delimiter'} ) { + $form_params->{'pattern_without_delimiter'} = $self->{api_client}->to_form_value($args{'pattern_without_delimiter'}); + } + # form params if ( exists $args{'byte'} ) { $form_params->{'byte'} = $self->{api_client}->to_form_value($args{'byte'}); @@ -309,7 +329,7 @@ sub test_endpoint_parameters { my $_body_data; # authentication setting, if any - my $auth_settings = [qw()]; + my $auth_settings = [qw(http_basic_test )]; # make the API Call $self->{api_client}->call_api($_resource_path, $_method, @@ -319,15 +339,45 @@ sub test_endpoint_parameters { } # -# test_enum_query_parameters +# test_enum_parameters # -# To test enum query parameters +# To test enum parameters # +# @param ARRAY[string] $enum_form_string_array Form parameter enum test (string array) (optional) +# @param string $enum_form_string Form parameter enum test (string) (optional, default to -efg) +# @param ARRAY[string] $enum_header_string_array Header parameter enum test (string array) (optional) +# @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg) +# @param ARRAY[string] $enum_query_string_array Query parameter enum test (string array) (optional) # @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) # @param Number $enum_query_integer Query parameter enum test (double) (optional) # @param double $enum_query_double Query parameter enum test (double) (optional) { my $params = { + 'enum_form_string_array' => { + data_type => 'ARRAY[string]', + description => 'Form parameter enum test (string array)', + required => '0', + }, + 'enum_form_string' => { + data_type => 'string', + description => 'Form parameter enum test (string)', + required => '0', + }, + 'enum_header_string_array' => { + data_type => 'ARRAY[string]', + description => 'Header parameter enum test (string array)', + required => '0', + }, + 'enum_header_string' => { + data_type => 'string', + description => 'Header parameter enum test (string)', + required => '0', + }, + 'enum_query_string_array' => { + data_type => 'ARRAY[string]', + description => 'Query parameter enum test (string array)', + required => '0', + }, 'enum_query_string' => { data_type => 'string', description => 'Query parameter enum test (string)', @@ -344,15 +394,15 @@ sub test_endpoint_parameters { required => '0', }, }; - __PACKAGE__->method_documentation->{ 'test_enum_query_parameters' } = { - summary => 'To test enum query parameters', + __PACKAGE__->method_documentation->{ 'test_enum_parameters' } = { + summary => 'To test enum parameters', params => $params, returns => undef, }; } # @return void # -sub test_enum_query_parameters { +sub test_enum_parameters { my ($self, %args) = @_; # parse inputs @@ -371,14 +421,39 @@ sub test_enum_query_parameters { } $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + # query params + if ( exists $args{'enum_query_string_array'}) { + $query_params->{'enum_query_string_array'} = $self->{api_client}->to_query_value($args{'enum_query_string_array'}); + } + + # query params + if ( exists $args{'enum_query_string'}) { + $query_params->{'enum_query_string'} = $self->{api_client}->to_query_value($args{'enum_query_string'}); + } + # query params if ( exists $args{'enum_query_integer'}) { $query_params->{'enum_query_integer'} = $self->{api_client}->to_query_value($args{'enum_query_integer'}); } + # header params + if ( exists $args{'enum_header_string_array'}) { + $header_params->{'enum_header_string_array'} = $self->{api_client}->to_header_value($args{'enum_header_string_array'}); + } + + # header params + if ( exists $args{'enum_header_string'}) { + $header_params->{'enum_header_string'} = $self->{api_client}->to_header_value($args{'enum_header_string'}); + } + # form params - if ( exists $args{'enum_query_string'} ) { - $form_params->{'enum_query_string'} = $self->{api_client}->to_form_value($args{'enum_query_string'}); + if ( exists $args{'enum_form_string_array'} ) { + $form_params->{'enum_form_string_array'} = $self->{api_client}->to_form_value($args{'enum_form_string_array'}); + } + + # form params + if ( exists $args{'enum_form_string'} ) { + $form_params->{'enum_form_string'} = $self->{api_client}->to_form_value($args{'enum_form_string'}); } # form params diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm index a0b3cdada0..17200d857f 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/ArrayTest.pm @@ -187,27 +187,18 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, - 'array_of_enum' => { - datatype => 'ARRAY[string]', - base_name => 'array_of_enum', - description => '', - format => '', - read_only => '', - }, }); __PACKAGE__->swagger_types( { 'array_of_string' => 'ARRAY[string]', 'array_array_of_integer' => 'ARRAY[ARRAY[int]]', - 'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]', - 'array_of_enum' => 'ARRAY[string]' + 'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]' } ); __PACKAGE__->attribute_map( { 'array_of_string' => 'array_of_string', 'array_array_of_integer' => 'array_array_of_integer', - 'array_array_of_model' => 'array_array_of_model', - 'array_of_enum' => 'array_of_enum' + 'array_array_of_model' => 'array_array_of_model' } ); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 4e4fadcbb0..6c1058b7e5 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -68,7 +68,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-06-28T16:35:21.686+08:00', + generated_date => '2016-08-28T15:57:37.016+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -134,7 +134,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-06-28T16:35:21.686+08:00 +=item Build date: 2016-08-28T15:57:37.016+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen