From db4218a06f4cca03f4c17f3c20f6f7da9aa20db5 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 17 Mar 2016 15:44:07 +0800 Subject: [PATCH] rpelace api with api_instance --- .../src/main/resources/perl/README.mustache | 6 +-- .../src/main/resources/perl/api_doc.mustache | 4 +- samples/client/petstore/perl/README.md | 6 +-- samples/client/petstore/perl/docs/PetApi.md | 44 +++++++++---------- samples/client/petstore/perl/docs/StoreApi.md | 24 +++++----- samples/client/petstore/perl/docs/UserApi.md | 32 +++++++------- .../perl/lib/WWW/SwaggerClient/Role.pm | 4 +- 7 files changed, 60 insertions(+), 60 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index 18249c73350..e4271d94936 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -254,17 +254,17 @@ use Data::Dumper; # 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}} +#{{{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(); +my $api_instance = {{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}} + {{#returnType}}my $result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}{{paramName}} => ${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} print Dumper($result);{{/returnType}} }; if ($@) { 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 b9846c09c41..35ab8253532 100644 --- a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache @@ -37,12 +37,12 @@ use Data::Dumper; {{{moduleName}}}::Configuration::access_token = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} {{/hasAuthMethods}} -my $api = {{moduleName}}::{{classname}}->new(); +my $api_instance = {{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}} + {{#returnType}}my $result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}{{paramName}} => ${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} print Dumper($result);{{/returnType}} }; if ($@) { diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index e44730c5b0d..c240e99a10d 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-17T15:04:43.719+08:00 +- Build date: 2016-03-17T15:41:15.325+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen - Codegen version: @@ -273,11 +273,11 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $body = WWW::SwaggerClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { - $api->add_pet(body => $body); + $api_instance->add_pet(body => $body); }; if ($@) { warn "Exception when calling PetApi->add_pet: $@\n"; diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 514ec55449d..608af63073d 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -36,11 +36,11 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $body = WWW::SwaggerClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { - $api->add_pet(body => $body); + $api_instance->add_pet(body => $body); }; if ($@) { warn "Exception when calling PetApi->add_pet: $@\n"; @@ -82,11 +82,11 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $body = WWW::SwaggerClient::Object::string->new(); # string | Pet object in the form of byte array eval { - $api->add_pet_using_byte_array(body => $body); + $api_instance->add_pet_using_byte_array(body => $body); }; if ($@) { warn "Exception when calling PetApi->add_pet_using_byte_array: $@\n"; @@ -128,12 +128,12 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $pet_id = 789; # int | Pet id to delete my $api_key = 'api_key_example'; # string | eval { - $api->delete_pet(pet_id => $pet_id, api_key => $api_key); + $api_instance->delete_pet(pet_id => $pet_id, api_key => $api_key); }; if ($@) { warn "Exception when calling PetApi->delete_pet: $@\n"; @@ -176,11 +176,11 @@ 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 $api_instance = 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); + my $result = $api_instance->find_pets_by_status(status => $status); print Dumper($result); }; if ($@) { @@ -223,11 +223,11 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $tags = (); # ARRAY[string] | Tags to filter by eval { - my $result = $api->find_pets_by_tags(tags => $tags); + my $result = $api_instance->find_pets_by_tags(tags => $tags); print Dumper($result); }; if ($@) { @@ -274,11 +274,11 @@ WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # Configure OAuth2 access token for authorization: petstore_auth WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; -my $api = WWW::SwaggerClient::PetApi->new(); +my $api_instance = 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); + my $result = $api_instance->get_pet_by_id(pet_id => $pet_id); print Dumper($result); }; if ($@) { @@ -325,11 +325,11 @@ WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # Configure OAuth2 access token for authorization: petstore_auth WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; -my $api = WWW::SwaggerClient::PetApi->new(); +my $api_instance = 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); + my $result = $api_instance->get_pet_by_id_in_object(pet_id => $pet_id); print Dumper($result); }; if ($@) { @@ -376,11 +376,11 @@ WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # Configure OAuth2 access token for authorization: petstore_auth WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; -my $api = WWW::SwaggerClient::PetApi->new(); +my $api_instance = 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); + my $result = $api_instance->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); print Dumper($result); }; if ($@) { @@ -423,11 +423,11 @@ 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 $api_instance = WWW::SwaggerClient::PetApi->new(); my $body = WWW::SwaggerClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { - $api->update_pet(body => $body); + $api_instance->update_pet(body => $body); }; if ($@) { warn "Exception when calling PetApi->update_pet: $@\n"; @@ -469,13 +469,13 @@ 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 $api_instance = 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 my $status = 'status_example'; # string | Updated status of the pet eval { - $api->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status); + $api_instance->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status); }; if ($@) { warn "Exception when calling PetApi->update_pet_with_form: $@\n"; @@ -519,13 +519,13 @@ 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 $api_instance = 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 my $file = '/path/to/file.txt'; # File | file to upload eval { - $api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); + $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); }; if ($@) { warn "Exception when calling PetApi->upload_file: $@\n"; diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index 7d229b1f040..9364b725364 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -28,11 +28,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::StoreApi->new(); +my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $order_id = 'order_id_example'; # string | ID of the order that needs to be deleted eval { - $api->delete_order(order_id => $order_id); + $api_instance->delete_order(order_id => $order_id); }; if ($@) { warn "Exception when calling StoreApi->delete_order: $@\n"; @@ -80,11 +80,11 @@ WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR # 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 $api_instance = 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); + my $result = $api_instance->find_orders_by_status(status => $status); print Dumper($result); }; if ($@) { @@ -129,10 +129,10 @@ 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(); +my $api_instance = WWW::SwaggerClient::StoreApi->new(); eval { - my $result = $api->get_inventory(); + my $result = $api_instance->get_inventory(); print Dumper($result); }; if ($@) { @@ -174,10 +174,10 @@ 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(); +my $api_instance = WWW::SwaggerClient::StoreApi->new(); eval { - my $result = $api->get_inventory_in_object(); + my $result = $api_instance->get_inventory_in_object(); print Dumper($result); }; if ($@) { @@ -223,11 +223,11 @@ WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_K # 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 $api_instance = 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); + my $result = $api_instance->get_order_by_id(order_id => $order_id); print Dumper($result); }; if ($@) { @@ -276,11 +276,11 @@ WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR # 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 $api_instance = 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); + my $result = $api_instance->place_order(body => $body); print Dumper($result); }; if ($@) { diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index 0dc949f2bae..204b42d9cb3 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -30,11 +30,11 @@ This can only be done by the logged in user. ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = WWW::SwaggerClient::UserApi->new(); my $body = WWW::SwaggerClient::Object::User->new(); # User | Created user object eval { - $api->create_user(body => $body); + $api_instance->create_user(body => $body); }; if ($@) { warn "Exception when calling UserApi->create_user: $@\n"; @@ -73,11 +73,11 @@ Creates list of users with given input array ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = WWW::SwaggerClient::UserApi->new(); my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # ARRAY[User] | List of user object eval { - $api->create_users_with_array_input(body => $body); + $api_instance->create_users_with_array_input(body => $body); }; if ($@) { warn "Exception when calling UserApi->create_users_with_array_input: $@\n"; @@ -116,11 +116,11 @@ Creates list of users with given input array ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = WWW::SwaggerClient::UserApi->new(); my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # ARRAY[User] | List of user object eval { - $api->create_users_with_list_input(body => $body); + $api_instance->create_users_with_list_input(body => $body); }; if ($@) { warn "Exception when calling UserApi->create_users_with_list_input: $@\n"; @@ -163,11 +163,11 @@ use Data::Dumper; WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME'; WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD'; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The name that needs to be deleted eval { - $api->delete_user(username => $username); + $api_instance->delete_user(username => $username); }; if ($@) { warn "Exception when calling UserApi->delete_user: $@\n"; @@ -206,11 +206,11 @@ Get user by user name ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = 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); + my $result = $api_instance->get_user_by_name(username => $username); print Dumper($result); }; if ($@) { @@ -250,12 +250,12 @@ Logs user into the system ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = 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); + my $result = $api_instance->login_user(username => $username, password => $password); print Dumper($result); }; if ($@) { @@ -296,10 +296,10 @@ Logs out current logged in user session ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = WWW::SwaggerClient::UserApi->new(); eval { - $api->logout_user(); + $api_instance->logout_user(); }; if ($@) { warn "Exception when calling UserApi->logout_user: $@\n"; @@ -335,12 +335,12 @@ This can only be done by the logged in user. ```perl use Data::Dumper; -my $api = WWW::SwaggerClient::UserApi->new(); +my $api_instance = 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 eval { - $api->update_user(username => $username, body => $body); + $api_instance->update_user(username => $username, body => $body); }; if ($@) { warn "Exception when calling UserApi->update_user: $@\n"; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index bd62705ca7e..3f09db6f1d5 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-17T15:04:43.719+08:00', + generated_date => '2016-03-17T15:41:15.325+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-17T15:04:43.719+08:00 +=item Build date: 2016-03-17T15:41:15.325+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen