forked from loafle/openapi-generator-original
update subroutine argument
This commit is contained in:
parent
c03250132d
commit
1d4735f76d
@ -43,21 +43,17 @@ our @EXPORT_OK = qw(
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $default_api_client = WWW::{{invokerPackage}}::APIClient->new;
|
||||
#TODO fix default
|
||||
#my (%arg) = (
|
||||
# 'api_client' => $default_api_client,
|
||||
# @_
|
||||
#);
|
||||
my (%self) = (
|
||||
'api_client' => $default_api_client,
|
||||
@_
|
||||
);
|
||||
|
||||
#croak("You must supply an API client")
|
||||
# unless $options->{api_client};
|
||||
#my $self = {
|
||||
# #api_client => $options->{api_client}
|
||||
# api_client => $default_api_client
|
||||
#};
|
||||
|
||||
my $self = {
|
||||
#api_client => $options->{api_client}
|
||||
api_client => $default_api_client
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
bless \%self, $class;
|
||||
|
||||
}
|
||||
|
||||
@ -71,11 +67,11 @@ sub new {
|
||||
{{/allParams}} # @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||
#
|
||||
sub {{nickname}} {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
{{#allParams}}{{#required}}
|
||||
# verify the required parameter '{{paramName}}' is set
|
||||
unless (exists $args->{'{{paramName}}'}) {
|
||||
unless (exists $args{'{{paramName}}'}) {
|
||||
croak("Missing the required parameter '{{paramName}}' when calling {{nickname}}");
|
||||
}
|
||||
{{/required}}{{/allParams}}
|
||||
@ -97,31 +93,31 @@ sub new {
|
||||
$header_params->{'Content-Type'} = scalar(@_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
{{#queryParams}} # query params
|
||||
if ( exists $args->{'{{paramName}}'}) {
|
||||
$query_params->{'{{baseName}}'} = WWW::{{invokerPacakge}}::APIClient::to_query_value($args->{'{{paramName}}'});
|
||||
if ( exists $args{'{{paramName}}'}) {
|
||||
$query_params->{'{{baseName}}'} = WWW::{{invokerPacakge}}::APIClient::to_query_value($args{'{{paramName}}'});
|
||||
}{{/queryParams}}
|
||||
{{#headerParams}} # header params
|
||||
if ( exists $args->{'{{paramName}}'}) {
|
||||
$header_params->{'{{baseName}}'} = WWW::{{invokerPackage}}::APIClient::to_header_value($args->{'{{paramName}}'});
|
||||
if ( exists $args{'{{paramName}}'}) {
|
||||
$header_params->{'{{baseName}}'} = WWW::{{invokerPackage}}::APIClient::to_header_value($args{'{{paramName}}'});
|
||||
}{{/headerParams}}
|
||||
{{#pathParams}} # path params
|
||||
if ( exists $args->{'{{paramName}}'}) {
|
||||
if ( exists $args{'{{paramName}}'}) {
|
||||
my $_base_variable = "{" . "{{baseName}}" . "}";
|
||||
my $_base_value = WWW::{{invokerPackage}}::APIClient::to_path_value($args->{'{{paramName}}'});
|
||||
my $_base_value = WWW::{{invokerPackage}}::APIClient::to_path_value($args{'{{paramName}}'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}{{/pathParams}}
|
||||
{{#formParams}} # form params
|
||||
if ( exists $args->{'{{paramName}}'} ) {
|
||||
if ( exists $args{'{{paramName}}'} ) {
|
||||
{{#isFile}}$form_params->{'{{baseName}}'} = [] unless defined $form_params->{'{{baseName}}'};
|
||||
push $form_params->{'{{baseName}}'}, $args->{'{{paramName}}'};
|
||||
push $form_params->{'{{baseName}}'}, $args{'{{paramName}}'};
|
||||
{{/isFile}}
|
||||
{{^isFile}}$form_params->{'{{baseName}}'} = WWW::{{invokerPackage}}::APIClient::to_form_value($args->{'{{paramName}}'});
|
||||
{{^isFile}}$form_params->{'{{baseName}}'} = WWW::{{invokerPackage}}::APIClient::to_form_value($args{'{{paramName}}'});
|
||||
{{/isFile}}
|
||||
}{{/formParams}}
|
||||
my $_body_data;
|
||||
{{#bodyParams}} # body params
|
||||
if ( exists $args->{'{{paramName}}'}) {
|
||||
$_body_data = $args->{'{{paramName}}'};
|
||||
if ( exists $args{'{{paramName}}'}) {
|
||||
$_body_data = $args{'{{paramName}}'};
|
||||
}{{/bodyParams}}
|
||||
|
||||
# for HTTP post (form)
|
||||
|
@ -33,10 +33,10 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
{{#vars}}#{{#description}}{{{description}}}{{/description}}
|
||||
'{{name}}' => $args->{'{{baseName}}'}{{#hasMore}},
|
||||
'{{name}}' => $args{'{{baseName}}'}{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
};
|
||||
|
||||
|
@ -31,12 +31,12 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
#
|
||||
'id' => $args->{'id'},
|
||||
'id' => $args{'id'},
|
||||
#
|
||||
'name' => $args->{'name'}
|
||||
'name' => $args{'name'}
|
||||
};
|
||||
|
||||
return bless $self, $class;
|
||||
|
@ -39,20 +39,20 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
#
|
||||
'id' => $args->{'id'},
|
||||
'id' => $args{'id'},
|
||||
#
|
||||
'pet_id' => $args->{'petId'},
|
||||
'pet_id' => $args{'petId'},
|
||||
#
|
||||
'quantity' => $args->{'quantity'},
|
||||
'quantity' => $args{'quantity'},
|
||||
#
|
||||
'ship_date' => $args->{'shipDate'},
|
||||
'ship_date' => $args{'shipDate'},
|
||||
#Order Status
|
||||
'status' => $args->{'status'},
|
||||
'status' => $args{'status'},
|
||||
#
|
||||
'complete' => $args->{'complete'}
|
||||
'complete' => $args{'complete'}
|
||||
};
|
||||
|
||||
return bless $self, $class;
|
||||
|
@ -39,20 +39,20 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
#
|
||||
'id' => $args->{'id'},
|
||||
'id' => $args{'id'},
|
||||
#
|
||||
'category' => $args->{'category'},
|
||||
'category' => $args{'category'},
|
||||
#
|
||||
'name' => $args->{'name'},
|
||||
'name' => $args{'name'},
|
||||
#
|
||||
'photo_urls' => $args->{'photoUrls'},
|
||||
'photo_urls' => $args{'photoUrls'},
|
||||
#
|
||||
'tags' => $args->{'tags'},
|
||||
'tags' => $args{'tags'},
|
||||
#pet status in the store
|
||||
'status' => $args->{'status'}
|
||||
'status' => $args{'status'}
|
||||
};
|
||||
|
||||
return bless $self, $class;
|
||||
|
@ -31,12 +31,12 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
#
|
||||
'id' => $args->{'id'},
|
||||
'id' => $args{'id'},
|
||||
#
|
||||
'name' => $args->{'name'}
|
||||
'name' => $args{'name'}
|
||||
};
|
||||
|
||||
return bless $self, $class;
|
||||
|
@ -43,24 +43,24 @@ my $attribute_map = {
|
||||
|
||||
# new object
|
||||
sub new {
|
||||
my ($class, $args) = @_;
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
#
|
||||
'id' => $args->{'id'},
|
||||
'id' => $args{'id'},
|
||||
#
|
||||
'username' => $args->{'username'},
|
||||
'username' => $args{'username'},
|
||||
#
|
||||
'first_name' => $args->{'firstName'},
|
||||
'first_name' => $args{'firstName'},
|
||||
#
|
||||
'last_name' => $args->{'lastName'},
|
||||
'last_name' => $args{'lastName'},
|
||||
#
|
||||
'email' => $args->{'email'},
|
||||
'email' => $args{'email'},
|
||||
#
|
||||
'password' => $args->{'password'},
|
||||
'password' => $args{'password'},
|
||||
#
|
||||
'phone' => $args->{'phone'},
|
||||
'phone' => $args{'phone'},
|
||||
#User Status
|
||||
'user_status' => $args->{'userStatus'}
|
||||
'user_status' => $args{'userStatus'}
|
||||
};
|
||||
|
||||
return bless $self, $class;
|
||||
|
@ -49,21 +49,17 @@ our @EXPORT_OK = qw(
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $default_api_client = WWW::SwaggerClient::APIClient->new;
|
||||
#TODO fix default
|
||||
#my (%arg) = (
|
||||
# 'api_client' => $default_api_client,
|
||||
# @_
|
||||
#);
|
||||
my (%self) = (
|
||||
'api_client' => $default_api_client,
|
||||
@_
|
||||
);
|
||||
|
||||
#croak("You must supply an API client")
|
||||
# unless $options->{api_client};
|
||||
#my $self = {
|
||||
# #api_client => $options->{api_client}
|
||||
# api_client => $default_api_client
|
||||
#};
|
||||
|
||||
my $self = {
|
||||
#api_client => $options->{api_client}
|
||||
api_client => $default_api_client
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
bless \%self, $class;
|
||||
|
||||
}
|
||||
|
||||
@ -77,7 +73,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub update_pet {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -103,8 +99,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -128,7 +124,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub add_pet {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -154,8 +150,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -179,7 +175,7 @@ sub new {
|
||||
# @return array[Pet]
|
||||
#
|
||||
sub find_pets_by_status {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -200,8 +196,8 @@ sub new {
|
||||
$header_params->{'Content-Type'} = scalar(@_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
# query params
|
||||
if ( exists $args->{'status'}) {
|
||||
$query_params->{'status'} = WWW::::APIClient::to_query_value($args->{'status'});
|
||||
if ( exists $args{'status'}) {
|
||||
$query_params->{'status'} = WWW::::APIClient::to_query_value($args{'status'});
|
||||
}
|
||||
|
||||
|
||||
@ -233,7 +229,7 @@ sub new {
|
||||
# @return array[Pet]
|
||||
#
|
||||
sub find_pets_by_tags {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -254,8 +250,8 @@ sub new {
|
||||
$header_params->{'Content-Type'} = scalar(@_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
# query params
|
||||
if ( exists $args->{'tags'}) {
|
||||
$query_params->{'tags'} = WWW::::APIClient::to_query_value($args->{'tags'});
|
||||
if ( exists $args{'tags'}) {
|
||||
$query_params->{'tags'} = WWW::::APIClient::to_query_value($args{'tags'});
|
||||
}
|
||||
|
||||
|
||||
@ -287,11 +283,11 @@ sub new {
|
||||
# @return Pet
|
||||
#
|
||||
sub get_pet_by_id {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
unless (exists $args->{'pet_id'}) {
|
||||
unless (exists $args{'pet_id'}) {
|
||||
croak("Missing the required parameter 'pet_id' when calling get_pet_by_id");
|
||||
}
|
||||
|
||||
@ -315,9 +311,9 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'pet_id'}) {
|
||||
if ( exists $args{'pet_id'}) {
|
||||
my $_base_variable = "{" . "petId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'pet_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'pet_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
@ -350,11 +346,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub update_pet_with_form {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
unless (exists $args->{'pet_id'}) {
|
||||
unless (exists $args{'pet_id'}) {
|
||||
croak("Missing the required parameter 'pet_id' when calling update_pet_with_form");
|
||||
}
|
||||
|
||||
@ -378,20 +374,20 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'pet_id'}) {
|
||||
if ( exists $args{'pet_id'}) {
|
||||
my $_base_variable = "{" . "petId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'pet_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'pet_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
# form params
|
||||
if ( exists $args->{'name'} ) {
|
||||
if ( exists $args{'name'} ) {
|
||||
|
||||
$form_params->{'name'} = WWW::SwaggerClient::APIClient::to_form_value($args->{'name'});
|
||||
$form_params->{'name'} = WWW::SwaggerClient::APIClient::to_form_value($args{'name'});
|
||||
|
||||
} # form params
|
||||
if ( exists $args->{'status'} ) {
|
||||
if ( exists $args{'status'} ) {
|
||||
|
||||
$form_params->{'status'} = WWW::SwaggerClient::APIClient::to_form_value($args->{'status'});
|
||||
$form_params->{'status'} = WWW::SwaggerClient::APIClient::to_form_value($args{'status'});
|
||||
|
||||
}
|
||||
my $_body_data;
|
||||
@ -419,11 +415,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub delete_pet {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
unless (exists $args->{'pet_id'}) {
|
||||
unless (exists $args{'pet_id'}) {
|
||||
croak("Missing the required parameter 'pet_id' when calling delete_pet");
|
||||
}
|
||||
|
||||
@ -446,13 +442,13 @@ sub new {
|
||||
|
||||
|
||||
# header params
|
||||
if ( exists $args->{'api_key'}) {
|
||||
$header_params->{'api_key'} = WWW::SwaggerClient::APIClient::to_header_value($args->{'api_key'});
|
||||
if ( exists $args{'api_key'}) {
|
||||
$header_params->{'api_key'} = WWW::SwaggerClient::APIClient::to_header_value($args{'api_key'});
|
||||
}
|
||||
# path params
|
||||
if ( exists $args->{'pet_id'}) {
|
||||
if ( exists $args{'pet_id'}) {
|
||||
my $_base_variable = "{" . "petId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'pet_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'pet_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
@ -482,11 +478,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub upload_file {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
unless (exists $args->{'pet_id'}) {
|
||||
unless (exists $args{'pet_id'}) {
|
||||
croak("Missing the required parameter 'pet_id' when calling upload_file");
|
||||
}
|
||||
|
||||
@ -510,20 +506,20 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'pet_id'}) {
|
||||
if ( exists $args{'pet_id'}) {
|
||||
my $_base_variable = "{" . "petId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'pet_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'pet_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
# form params
|
||||
if ( exists $args->{'additional_metadata'} ) {
|
||||
if ( exists $args{'additional_metadata'} ) {
|
||||
|
||||
$form_params->{'additionalMetadata'} = WWW::SwaggerClient::APIClient::to_form_value($args->{'additional_metadata'});
|
||||
$form_params->{'additionalMetadata'} = WWW::SwaggerClient::APIClient::to_form_value($args{'additional_metadata'});
|
||||
|
||||
} # form params
|
||||
if ( exists $args->{'file'} ) {
|
||||
if ( exists $args{'file'} ) {
|
||||
$form_params->{'file'} = [] unless defined $form_params->{'file'};
|
||||
push $form_params->{'file'}, $args->{'file'};
|
||||
push $form_params->{'file'}, $args{'file'};
|
||||
|
||||
|
||||
}
|
||||
|
@ -45,21 +45,17 @@ our @EXPORT_OK = qw(
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $default_api_client = WWW::SwaggerClient::APIClient->new;
|
||||
#TODO fix default
|
||||
#my (%arg) = (
|
||||
# 'api_client' => $default_api_client,
|
||||
# @_
|
||||
#);
|
||||
my (%self) = (
|
||||
'api_client' => $default_api_client,
|
||||
@_
|
||||
);
|
||||
|
||||
#croak("You must supply an API client")
|
||||
# unless $options->{api_client};
|
||||
#my $self = {
|
||||
# #api_client => $options->{api_client}
|
||||
# api_client => $default_api_client
|
||||
#};
|
||||
|
||||
my $self = {
|
||||
#api_client => $options->{api_client}
|
||||
api_client => $default_api_client
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
bless \%self, $class;
|
||||
|
||||
}
|
||||
|
||||
@ -72,7 +68,7 @@ sub new {
|
||||
# @return map[string,int]
|
||||
#
|
||||
sub get_inventory {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -123,7 +119,7 @@ sub new {
|
||||
# @return Order
|
||||
#
|
||||
sub place_order {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -149,8 +145,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -177,11 +173,11 @@ sub new {
|
||||
# @return Order
|
||||
#
|
||||
sub get_order_by_id {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'order_id' is set
|
||||
unless (exists $args->{'order_id'}) {
|
||||
unless (exists $args{'order_id'}) {
|
||||
croak("Missing the required parameter 'order_id' when calling get_order_by_id");
|
||||
}
|
||||
|
||||
@ -205,9 +201,9 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'order_id'}) {
|
||||
if ( exists $args{'order_id'}) {
|
||||
my $_base_variable = "{" . "orderId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'order_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'order_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
@ -238,11 +234,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub delete_order {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'order_id' is set
|
||||
unless (exists $args->{'order_id'}) {
|
||||
unless (exists $args{'order_id'}) {
|
||||
croak("Missing the required parameter 'order_id' when calling delete_order");
|
||||
}
|
||||
|
||||
@ -266,9 +262,9 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'order_id'}) {
|
||||
if ( exists $args{'order_id'}) {
|
||||
my $_base_variable = "{" . "orderId" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'order_id'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'order_id'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
|
@ -49,21 +49,17 @@ our @EXPORT_OK = qw(
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $default_api_client = WWW::SwaggerClient::APIClient->new;
|
||||
#TODO fix default
|
||||
#my (%arg) = (
|
||||
# 'api_client' => $default_api_client,
|
||||
# @_
|
||||
#);
|
||||
my (%self) = (
|
||||
'api_client' => $default_api_client,
|
||||
@_
|
||||
);
|
||||
|
||||
#croak("You must supply an API client")
|
||||
# unless $options->{api_client};
|
||||
#my $self = {
|
||||
# #api_client => $options->{api_client}
|
||||
# api_client => $default_api_client
|
||||
#};
|
||||
|
||||
my $self = {
|
||||
#api_client => $options->{api_client}
|
||||
api_client => $default_api_client
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
bless \%self, $class;
|
||||
|
||||
}
|
||||
|
||||
@ -77,7 +73,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub create_user {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -103,8 +99,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -128,7 +124,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub create_users_with_array_input {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -154,8 +150,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -179,7 +175,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub create_users_with_list_input {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -205,8 +201,8 @@ sub new {
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -231,7 +227,7 @@ sub new {
|
||||
# @return string
|
||||
#
|
||||
sub login_user {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -252,11 +248,11 @@ sub new {
|
||||
$header_params->{'Content-Type'} = scalar(@_header_content_type) > 0 ? $_header_content_type[0] : 'application/json';
|
||||
|
||||
# query params
|
||||
if ( exists $args->{'username'}) {
|
||||
$query_params->{'username'} = WWW::::APIClient::to_query_value($args->{'username'});
|
||||
if ( exists $args{'username'}) {
|
||||
$query_params->{'username'} = WWW::::APIClient::to_query_value($args{'username'});
|
||||
} # query params
|
||||
if ( exists $args->{'password'}) {
|
||||
$query_params->{'password'} = WWW::::APIClient::to_query_value($args->{'password'});
|
||||
if ( exists $args{'password'}) {
|
||||
$query_params->{'password'} = WWW::::APIClient::to_query_value($args{'password'});
|
||||
}
|
||||
|
||||
|
||||
@ -287,7 +283,7 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub logout_user {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
|
||||
@ -335,11 +331,11 @@ sub new {
|
||||
# @return User
|
||||
#
|
||||
sub get_user_by_name {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
unless (exists $args->{'username'}) {
|
||||
unless (exists $args{'username'}) {
|
||||
croak("Missing the required parameter 'username' when calling get_user_by_name");
|
||||
}
|
||||
|
||||
@ -363,9 +359,9 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'username'}) {
|
||||
if ( exists $args{'username'}) {
|
||||
my $_base_variable = "{" . "username" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'username'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'username'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
@ -397,11 +393,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub update_user {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
unless (exists $args->{'username'}) {
|
||||
unless (exists $args{'username'}) {
|
||||
croak("Missing the required parameter 'username' when calling update_user");
|
||||
}
|
||||
|
||||
@ -425,16 +421,16 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'username'}) {
|
||||
if ( exists $args{'username'}) {
|
||||
my $_base_variable = "{" . "username" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'username'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'username'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
my $_body_data;
|
||||
# body params
|
||||
if ( exists $args->{'body'}) {
|
||||
$_body_data = $args->{'body'};
|
||||
if ( exists $args{'body'}) {
|
||||
$_body_data = $args{'body'};
|
||||
}
|
||||
|
||||
# for HTTP post (form)
|
||||
@ -458,11 +454,11 @@ sub new {
|
||||
# @return void
|
||||
#
|
||||
sub delete_user {
|
||||
my ($self, $args) = @_;
|
||||
my ($self, %args) = @_;
|
||||
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
unless (exists $args->{'username'}) {
|
||||
unless (exists $args{'username'}) {
|
||||
croak("Missing the required parameter 'username' when calling delete_user");
|
||||
}
|
||||
|
||||
@ -486,9 +482,9 @@ sub new {
|
||||
|
||||
|
||||
# path params
|
||||
if ( exists $args->{'username'}) {
|
||||
if ( exists $args{'username'}) {
|
||||
my $_base_variable = "{" . "username" . "}";
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args->{'username'});
|
||||
my $_base_value = WWW::SwaggerClient::APIClient::to_path_value($args{'username'});
|
||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||
}
|
||||
|
||||
|
18
samples/client/petstore/perl/test.pl
Normal file → Executable file
18
samples/client/petstore/perl/test.pl
Normal file → Executable file
@ -17,10 +17,10 @@ my $api = WWW::SwaggerClient::PetApi->new();
|
||||
|
||||
my $pet_id = 88;
|
||||
|
||||
my $category = WWW::SwaggerClient::Object::Category->new({'id' => '2', 'name' => 'perl'});
|
||||
my $tag = WWW::SwaggerClient::Object::Tag->new({'id' => '1', 'name' => 'just kidding'});
|
||||
my $pet = WWW::SwaggerClient::Object::Pet->new({'id' => $pet_id, 'name' => 'perl test',
|
||||
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category});
|
||||
my $category = WWW::SwaggerClient::Object::Category->new('id' => '2', 'name' => 'perl');
|
||||
my $tag = WWW::SwaggerClient::Object::Tag->new('id' => '1', 'name' => 'just kidding');
|
||||
my $pet = WWW::SwaggerClient::Object::Pet->new('id' => $pet_id, 'name' => 'perl test',
|
||||
"photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category);
|
||||
|
||||
print "\npet(object)=".Dumper $pet;
|
||||
my $json = JSON->new->convert_blessed;
|
||||
@ -30,11 +30,11 @@ $new_pet = $new_pet->from_hash($pet->to_hash);
|
||||
print "new_pet(hash):".Dumper($new_pet->to_hash);
|
||||
|
||||
print "\nTest Petstore endpoints\n";
|
||||
#print "\nupload_file:".Dumper $api->upload_file({pet_id => $pet_id, additional_metadata => 'testabc', file => '/var/tmp/f5.jpg'});
|
||||
print "\nadd_pet:".Dumper $api->add_pet({body => $pet});
|
||||
print "\nget_pet_by_id:".Dumper $api->get_pet_by_id({pet_id => $pet_id});
|
||||
print "\nupdate_pet_with_form:".Dumper $api->update_pet_with_form({pet_id => $pet_id, name => 'test_name', status => 'test status'});
|
||||
print "\ndelete_pet:".Dumper $api->delete_pet({pet_id => $pet_id});
|
||||
print "\nupload_file:".Dumper $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => '/var/tmp/f5.jpg');
|
||||
print "\nadd_pet:".Dumper $api->add_pet(body => $pet);
|
||||
print "\nget_pet_by_id:".Dumper $api->get_pet_by_id(pet_id => $pet_id);
|
||||
print "\nupdate_pet_with_form:".Dumper $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'test status');
|
||||
print "\ndelete_pet:".Dumper $api->delete_pet(pet_id => $pet_id);
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user