forked from loafle/openapi-generator-original
rpelace api with api_instance
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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 ($@) {
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user