[6313] Add imports to perl objects. (#6500)

This commit is contained in:
Larry Bordowitz 2017-09-18 19:11:38 -07:00 committed by wing328
parent 146b107774
commit 65d788396b
63 changed files with 777 additions and 196 deletions

View File

@ -19,6 +19,10 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
{{#imports}}
use {{moduleName}}::Object::{{.}};
{{/imports}}
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -88,37 +88,37 @@ you are accessing. Usually `prefix` and `in` will be determined by the code gene
the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `WWW::SwaggerClient::Configuration` namespace
The tokens will be placed in a L<WWW::SwaggerClient::Configuration> instance
as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::username`
- `$cfg->{username}`
String. The username for basic auth.
- `$WWW::SwaggerClient::Configuration::password`
- `$cfg->{password}`
String. The password for basic auth.
- `$WWW::SwaggerClient::Configuration::api_key`
- `$cfg->{api_key}`
Hashref. Keyed on the name of each key (there can be multiple tokens).
$WWW::SwaggerClient::Configuration::api_key = {
$cfg->{api_key} = {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
- `$WWW::SwaggerClient::Configuration::api_key_prefix`
- `$cfg->{api_key_prefix}`
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not
all api keys require a prefix.
$WWW::SwaggerClient::Configuration::api_key_prefix = {
$cfg->{api_key_prefix} = {
secretKey => 'string',
anotherKey => 'same or some other string',
};
- `$WWW::SwaggerClient::Configuration::access_token`
- `$cfg->{access_token}`
String. The OAuth access token.
@ -127,8 +127,7 @@ as follows, but you don't need to know about this.
## `base_url`
The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`.
returns the current value of `base_url`.
## `api_factory`
@ -247,10 +246,11 @@ use WWW::SwaggerClient::Object::ModelReturn;
# for displaying the API response data
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::;
my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $api_instance = WWW::SwaggerClient::->new(
);
my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval {

View File

@ -88,37 +88,37 @@ you are accessing. Usually `prefix` and `in` will be determined by the code gene
the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `Something::Deep::Configuration` namespace
The tokens will be placed in a L<Something::Deep::Configuration> instance
as follows, but you don't need to know about this.
- `$Something::Deep::Configuration::username`
- `$cfg->{username}`
String. The username for basic auth.
- `$Something::Deep::Configuration::password`
- `$cfg->{password}`
String. The password for basic auth.
- `$Something::Deep::Configuration::api_key`
- `$cfg->{api_key}`
Hashref. Keyed on the name of each key (there can be multiple tokens).
$Something::Deep::Configuration::api_key = {
$cfg->{api_key} = {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
- `$Something::Deep::Configuration::api_key_prefix`
- `$cfg->{api_key_prefix}`
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not
all api keys require a prefix.
$Something::Deep::Configuration::api_key_prefix = {
$cfg->{api_key_prefix} = {
secretKey => 'string',
anotherKey => 'same or some other string',
};
- `$Something::Deep::Configuration::access_token`
- `$cfg->{access_token}`
String. The OAuth access token.
@ -127,8 +127,7 @@ as follows, but you don't need to know about this.
## `base_url`
The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`.
returns the current value of `base_url`.
## `api_factory`
@ -247,10 +246,11 @@ use Something::Deep::Object::ModelReturn;
# for displaying the API response data
use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::;
my $api_instance = Something::Deep::FakeApi->new();
my $api_instance = Something::Deep::->new(
);
my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval {

View File

@ -20,10 +20,10 @@ To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example
```perl
use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::FakeApi;
my $api_instance = Something::Deep::FakeApi->new(
);
my $api_instance = Something::Deep::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval {

View File

@ -39,22 +39,25 @@ use Module::Runtime qw(use_module);
use Something::Deep::Configuration;
use base 'Class::Singleton';
sub _new_instance
{
sub new {
my $class = shift;
my $config;
if ( $_[0] && ref $_[0] && ref $_[0] eq 'Something::Deep::Configuration' ) {
$config = $_[0];
} else {
$config = Something::Deep::Configuration->new(@_);
}
my (%args) = (
'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_
'config' => $config,
);
return bless \%args, $class;
}
sub _cfg {'Something::Deep::Configuration'}
# Set the user agent of the API client
#
# @param string $user_agent The user agent of the API client
@ -91,7 +94,7 @@ sub call_api {
$self->update_params_for_auth($header_params, $query_params, $auth_settings);
my $_url = $self->{base_url} . $resource_path;
my $_url = $self->{config}{base_url} . $resource_path;
# build query
if (%$query_params) {
@ -138,8 +141,8 @@ sub call_api {
else {
}
$self->{ua}->timeout($self->{http_timeout} || $Something::Deep::Configuration::http_timeout);
$self->{ua}->agent($self->{http_user_agent} || $Something::Deep::Configuration::http_user_agent);
$self->{ua}->timeout($self->{http_timeout} || $self->{config}{http_timeout});
$self->{ua}->agent($self->{http_user_agent} || $self->{config}{http_user_agent});
$log->debugf("REQUEST: %s", $_request->as_string);
my $_response = $self->{ua}->request($_request);
@ -313,11 +316,11 @@ sub get_api_key_with_prefix
{
my ($self, $key_name) = @_;
my $api_key = $Something::Deep::Configuration::api_key->{$key_name};
my $api_key = $self->{config}{api_key}{$key_name};
return unless $api_key;
my $prefix = $Something::Deep::Configuration::api_key_prefix->{$key_name};
my $prefix = $self->{config}{api_key_prefix}{$key_name};
return $prefix ? "$prefix $api_key" : $api_key;
}
@ -347,8 +350,8 @@ sub update_params_for_auth {
}
elsif ($auth eq 'petstore_auth') {
if ($Something::Deep::Configuration::access_token) {
$header_params->{'Authorization'} = 'Bearer ' . $Something::Deep::Configuration::access_token;
if ($self->{config}{access_token}) {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
else {
@ -364,7 +367,7 @@ elsif ($auth eq 'petstore_auth') {
sub _global_auth_setup {
my ($self, $header_params, $query_params) = @_;
my $tokens = $self->_cfg->get_tokens;
my $tokens = $self->{config}->get_tokens;
return unless keys %$tokens;
# basic

View File

@ -62,19 +62,28 @@ my %_apis = map { $_ =~ /^Something::Deep::(.*)$/; $1 => $_ }
grep {$_ =~ /Api$/}
usesub 'Something::Deep';
=head1 new()
=head1 new($api_client)
create a new Something::Deep::ApiFactory instance with the given Something::Deep::ApiClient instance.
=head1 new(%paramters)
Any parameters are optional, and are passed to and stored on the api_client object.
base_url: (optional)
supply this to change the default base URL taken from the Swagger definition.
See L<Something::Deep::ApiClient> and L<Something::Deep::Configuration> for valid paramters
=cut
sub new {
my ($class, %p) = (shift, @_);
$p{api_client} = Something::Deep::ApiClient->instance(%p);
return bless \%p, $class;
my ($class) = shift;
my $api_client;
if ($_[0] && ref $_[0] && ref $_[0] eq 'Something::Deep::ApiClient' ) {
$api_client = $_[0];
} else {
$api_client = Something::Deep::ApiClient->new(@_);
}
bless { api_client => $api_client }, $class;
}
=head1 get_api($which)
@ -91,7 +100,7 @@ sub get_api {
my ($self, $which) = @_;
croak "API not specified" unless $which;
my $api_class = $_apis{"${which}Api"} || croak "No known API for '$which'";
return $api_class->new(api_client => $self->api_client);
return $api_class->new($self->api_client);
}
=head1 api_client()

View File

@ -28,71 +28,142 @@ use Carp;
use constant VERSION => '1.0.0';
# class/static variables
our $http_timeout = 180;
our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
=head1 Name
# authentication setting
our $api_key = {};
our $api_key_prefix = {};
our $api_key_in = {};
Something::Deep::Configuration - holds the configuration for all Something::Deep Modules
# username and password for HTTP basic authentication
our $username = '';
our $password = '';
=head1 new(%paramters)
=over 4
=item http_timeout: (optional)
Integer. timeout for HTTP requests in seconds
default: 180
=item http_user_agent: (optional)
String. custom UserAgent header
default: Swagger-Codegen/1.0.0/perl
=item api_key: (optional)
Hashref. Keyed on the name of each key (there can be multiple tokens).
api_key => {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
=item api_key_prefix: (optional)
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not all api keys require a prefix.
api_key_prefix => {
secretKey => 'string',
anotherKey => 'same or some other string',
};
=item api_key_in: (optional)
=item username: (optional)
String. The username for basic auth.
=item password: (optional)
String. The password for basic auth.
=item access_token: (optional)
String. The OAuth access token.
=item base_url: (optional)
String. The base URL of the API
default: https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r
=back
=cut
sub new {
my ($self, %p) = (shift,@_);
# class/static variables
$p{http_timeout} //= 180;
$p{http_user_agent} //= 'Swagger-Codegen/1.0.0/perl';
# authentication setting
$p{api_key} //= {};
$p{api_key_prefix} //= {};
$p{api_key_in} //= {};
# username and password for HTTP basic authentication
$p{username} //= '';
$p{password} //= '';
# access token for OAuth
$p{access_token} //= '';
# base_url
$p{base_url} //= 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r';
return bless \%p => $self;
}
# access token for OAuth
our $access_token = '';
sub get_tokens {
my $class = shift;
my $self = shift;
my $tokens = {};
$tokens->{username} = $username if $username;
$tokens->{password} = $password if $password;
$tokens->{access_token} = $access_token if $access_token;
$tokens->{username} = $self->{username} if $self->{username};
$tokens->{password} = $self->{password} if $self->{password};
$tokens->{access_token} = $self->{access_token} if $self->{access_token};
foreach my $token_name (keys %{ $api_key }) {
$tokens->{$token_name}->{token} = $api_key->{$token_name};
$tokens->{$token_name}->{prefix} = $api_key_prefix->{$token_name};
$tokens->{$token_name}->{in} = $api_key_in->{$token_name};
foreach my $token_name (keys %{ $self->{api_key} }) {
$tokens->{$token_name}->{token} = $self->{api_key}{$token_name};
$tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name};
$tokens->{$token_name}->{in} = $self->{api_key_in}{$token_name};
}
return $tokens;
}
sub clear_tokens {
my $class = shift;
my %tokens = %{$class->get_tokens}; # copy
my $self = shift;
my %tokens = %{$self->get_tokens}; # copy
$username = undef;
$password = undef;
$access_token = undef;
$self->{username} = '';
$self->{password} = '';
$self->{access_token} = '';
$api_key = {};
$api_key_prefix = {};
$api_key_in = {};
$self->{api_key} = {};
$self->{api_key_prefix} = {};
$self->{api_key_in} = {};
return \%tokens;
}
sub accept_tokens {
my ($class, $tokens) = @_;
my ($self, $tokens) = @_;
foreach my $known_name (qw(username password access_token)) {
next unless $tokens->{$known_name};
eval "\$$known_name = delete \$tokens->{\$known_name}";
die $@ if $@;
$self->{$known_name} = delete $tokens->{$known_name};
}
foreach my $token_name (keys %$tokens) {
$api_key->{$token_name} = $tokens->{$token_name}->{token};
if ($tokens->{$token_name}->{prefix}) {
$api_key_prefix->{$token_name} = $tokens->{$token_name}->{prefix};
$self->{api_key}{$token_name} = $tokens->{$token_name}{token};
if ($tokens->{$token_name}{prefix}) {
$self->{api_key_prefix}{$token_name} = $tokens->{$token_name}{prefix};
}
my $in = $tokens->{$token_name}->{in} || 'head';
croak "Tokens can only go in 'head' or 'query' (not in '$in')" unless $in =~ /^(?:head|query)$/;
$api_key_in->{$token_name} = $in;
$self->{api_key_in}{$token_name} = $in;
}
}

View File

@ -28,25 +28,22 @@ use Carp qw( croak );
use Log::Any qw($log);
use Something::Deep::ApiClient;
use Something::Deep::Configuration;
use base "Class::Data::Inheritable";
__PACKAGE__->mk_classdata('method_documentation' => {});
sub new {
my $class = shift;
my (%self) = (
'api_client' => Something::Deep::ApiClient->instance,
@_
);
my $class = shift;
my $api_client;
#my $self = {
# #api_client => $options->{api_client}
# api_client => $default_api_client
#};
if ($_[0] && ref $_[0] && ref $_[0] eq 'Something::Deep::ApiClient' ) {
$api_client = $_[0];
} else {
$api_client = Something::Deep::ApiClient->new(@_);
}
bless \%self, $class;
bless { api_client => $api_client }, $class;
}

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -47,8 +47,8 @@ has tokens => ( is => 'ro',
);
has _cfg => ( is => 'ro',
isa => 'Str',
default => 'Something::Deep::Configuration',
isa => 'Something::Deep::Configuration',
default => sub { Something::Deep::Configuration->new() },
);
has version_info => ( is => 'ro',
@ -201,39 +201,39 @@ you are accessing. Usually C<prefix> and C<in> will be determined by the code ge
the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<Something::Deep::Configuration> namespace
The tokens will be placed in a L<Something::Deep::Configuration> instance
as follows, but you don't need to know about this.
=over 4
=item C<$Something::Deep::Configuration::username>
=item C<$cfg-\>{username}>
String. The username for basic auth.
=item C<$Something::Deep::Configuration::password>
=item C<$cfg-\>{password}>
String. The password for basic auth.
=item C<$Something::Deep::Configuration::api_key>
=item C<$cfg-\>{api_key}>
Hashref. Keyed on the name of each key (there can be multiple tokens).
$Something::Deep::Configuration::api_key = {
$cfg->{api_key} = {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
=item C<$Something::Deep::Configuration::api_key_prefix>
=item C<$cfg->{api_key_prefix}>
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not
all api keys require a prefix.
$Something::Deep::Configuration::api_key_prefix = {
$cfg->{api_key_prefix} = {
secretKey => 'string',
anotherKey => 'same or some other string',
};
=item C<$Something::Deep::Configuration::access_token>
=item C<$config-\>{access_token}>
String. The OAuth access token.
@ -244,8 +244,7 @@ String. The OAuth access token.
=head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>.
returns the current value of C<base_url>.
=head2 C<api_factory>

View File

@ -20,10 +20,10 @@ To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example
```perl
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::FakeApi;
my $api_instance = WWW::SwaggerClient::FakeApi->new(
);
my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval {

View File

@ -39,22 +39,25 @@ use Module::Runtime qw(use_module);
use WWW::SwaggerClient::Configuration;
use base 'Class::Singleton';
sub _new_instance
{
sub new {
my $class = shift;
my $config;
if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::SwaggerClient::Configuration' ) {
$config = $_[0];
} else {
$config = WWW::SwaggerClient::Configuration->new(@_);
}
my (%args) = (
'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_
'config' => $config,
);
return bless \%args, $class;
}
sub _cfg {'WWW::SwaggerClient::Configuration'}
# Set the user agent of the API client
#
# @param string $user_agent The user agent of the API client
@ -91,7 +94,7 @@ sub call_api {
$self->update_params_for_auth($header_params, $query_params, $auth_settings);
my $_url = $self->{base_url} . $resource_path;
my $_url = $self->{config}{base_url} . $resource_path;
# build query
if (%$query_params) {
@ -138,8 +141,8 @@ sub call_api {
else {
}
$self->{ua}->timeout($self->{http_timeout} || $WWW::SwaggerClient::Configuration::http_timeout);
$self->{ua}->agent($self->{http_user_agent} || $WWW::SwaggerClient::Configuration::http_user_agent);
$self->{ua}->timeout($self->{http_timeout} || $self->{config}{http_timeout});
$self->{ua}->agent($self->{http_user_agent} || $self->{config}{http_user_agent});
$log->debugf("REQUEST: %s", $_request->as_string);
my $_response = $self->{ua}->request($_request);
@ -313,11 +316,11 @@ sub get_api_key_with_prefix
{
my ($self, $key_name) = @_;
my $api_key = $WWW::SwaggerClient::Configuration::api_key->{$key_name};
my $api_key = $self->{config}{api_key}{$key_name};
return unless $api_key;
my $prefix = $WWW::SwaggerClient::Configuration::api_key_prefix->{$key_name};
my $prefix = $self->{config}{api_key_prefix}{$key_name};
return $prefix ? "$prefix $api_key" : $api_key;
}
@ -347,8 +350,8 @@ sub update_params_for_auth {
}
elsif ($auth eq 'petstore_auth') {
if ($WWW::SwaggerClient::Configuration::access_token) {
$header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token;
if ($self->{config}{access_token}) {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
else {
@ -364,7 +367,7 @@ elsif ($auth eq 'petstore_auth') {
sub _global_auth_setup {
my ($self, $header_params, $query_params) = @_;
my $tokens = $self->_cfg->get_tokens;
my $tokens = $self->{config}->get_tokens;
return unless keys %$tokens;
# basic

View File

@ -62,19 +62,28 @@ my %_apis = map { $_ =~ /^WWW::SwaggerClient::(.*)$/; $1 => $_ }
grep {$_ =~ /Api$/}
usesub 'WWW::SwaggerClient';
=head1 new()
=head1 new($api_client)
create a new WWW::SwaggerClient::ApiFactory instance with the given WWW::SwaggerClient::ApiClient instance.
=head1 new(%paramters)
Any parameters are optional, and are passed to and stored on the api_client object.
base_url: (optional)
supply this to change the default base URL taken from the Swagger definition.
See L<WWW::SwaggerClient::ApiClient> and L<WWW::SwaggerClient::Configuration> for valid paramters
=cut
sub new {
my ($class, %p) = (shift, @_);
$p{api_client} = WWW::SwaggerClient::ApiClient->instance(%p);
return bless \%p, $class;
my ($class) = shift;
my $api_client;
if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::SwaggerClient::ApiClient' ) {
$api_client = $_[0];
} else {
$api_client = WWW::SwaggerClient::ApiClient->new(@_);
}
bless { api_client => $api_client }, $class;
}
=head1 get_api($which)
@ -91,7 +100,7 @@ sub get_api {
my ($self, $which) = @_;
croak "API not specified" unless $which;
my $api_class = $_apis{"${which}Api"} || croak "No known API for '$which'";
return $api_class->new(api_client => $self->api_client);
return $api_class->new($self->api_client);
}
=head1 api_client()

View File

@ -28,71 +28,142 @@ use Carp;
use constant VERSION => '1.0.0';
# class/static variables
our $http_timeout = 180;
our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
=head1 Name
# authentication setting
our $api_key = {};
our $api_key_prefix = {};
our $api_key_in = {};
WWW::SwaggerClient::Configuration - holds the configuration for all WWW::SwaggerClient Modules
# username and password for HTTP basic authentication
our $username = '';
our $password = '';
=head1 new(%paramters)
=over 4
=item http_timeout: (optional)
Integer. timeout for HTTP requests in seconds
default: 180
=item http_user_agent: (optional)
String. custom UserAgent header
default: Swagger-Codegen/1.0.0/perl
=item api_key: (optional)
Hashref. Keyed on the name of each key (there can be multiple tokens).
api_key => {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
=item api_key_prefix: (optional)
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not all api keys require a prefix.
api_key_prefix => {
secretKey => 'string',
anotherKey => 'same or some other string',
};
=item api_key_in: (optional)
=item username: (optional)
String. The username for basic auth.
=item password: (optional)
String. The password for basic auth.
=item access_token: (optional)
String. The OAuth access token.
=item base_url: (optional)
String. The base URL of the API
default: https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r
=back
=cut
sub new {
my ($self, %p) = (shift,@_);
# class/static variables
$p{http_timeout} //= 180;
$p{http_user_agent} //= 'Swagger-Codegen/1.0.0/perl';
# authentication setting
$p{api_key} //= {};
$p{api_key_prefix} //= {};
$p{api_key_in} //= {};
# username and password for HTTP basic authentication
$p{username} //= '';
$p{password} //= '';
# access token for OAuth
$p{access_token} //= '';
# base_url
$p{base_url} //= 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r';
return bless \%p => $self;
}
# access token for OAuth
our $access_token = '';
sub get_tokens {
my $class = shift;
my $self = shift;
my $tokens = {};
$tokens->{username} = $username if $username;
$tokens->{password} = $password if $password;
$tokens->{access_token} = $access_token if $access_token;
$tokens->{username} = $self->{username} if $self->{username};
$tokens->{password} = $self->{password} if $self->{password};
$tokens->{access_token} = $self->{access_token} if $self->{access_token};
foreach my $token_name (keys %{ $api_key }) {
$tokens->{$token_name}->{token} = $api_key->{$token_name};
$tokens->{$token_name}->{prefix} = $api_key_prefix->{$token_name};
$tokens->{$token_name}->{in} = $api_key_in->{$token_name};
foreach my $token_name (keys %{ $self->{api_key} }) {
$tokens->{$token_name}->{token} = $self->{api_key}{$token_name};
$tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name};
$tokens->{$token_name}->{in} = $self->{api_key_in}{$token_name};
}
return $tokens;
}
sub clear_tokens {
my $class = shift;
my %tokens = %{$class->get_tokens}; # copy
my $self = shift;
my %tokens = %{$self->get_tokens}; # copy
$username = undef;
$password = undef;
$access_token = undef;
$self->{username} = '';
$self->{password} = '';
$self->{access_token} = '';
$api_key = {};
$api_key_prefix = {};
$api_key_in = {};
$self->{api_key} = {};
$self->{api_key_prefix} = {};
$self->{api_key_in} = {};
return \%tokens;
}
sub accept_tokens {
my ($class, $tokens) = @_;
my ($self, $tokens) = @_;
foreach my $known_name (qw(username password access_token)) {
next unless $tokens->{$known_name};
eval "\$$known_name = delete \$tokens->{\$known_name}";
die $@ if $@;
$self->{$known_name} = delete $tokens->{$known_name};
}
foreach my $token_name (keys %$tokens) {
$api_key->{$token_name} = $tokens->{$token_name}->{token};
if ($tokens->{$token_name}->{prefix}) {
$api_key_prefix->{$token_name} = $tokens->{$token_name}->{prefix};
$self->{api_key}{$token_name} = $tokens->{$token_name}{token};
if ($tokens->{$token_name}{prefix}) {
$self->{api_key_prefix}{$token_name} = $tokens->{$token_name}{prefix};
}
my $in = $tokens->{$token_name}->{in} || 'head';
croak "Tokens can only go in 'head' or 'query' (not in '$in')" unless $in =~ /^(?:head|query)$/;
$api_key_in->{$token_name} = $in;
$self->{api_key_in}{$token_name} = $in;
}
}

View File

@ -28,25 +28,22 @@ use Carp qw( croak );
use Log::Any qw($log);
use WWW::SwaggerClient::ApiClient;
use WWW::SwaggerClient::Configuration;
use base "Class::Data::Inheritable";
__PACKAGE__->mk_classdata('method_documentation' => {});
sub new {
my $class = shift;
my (%self) = (
'api_client' => WWW::SwaggerClient::ApiClient->instance,
@_
);
my $class = shift;
my $api_client;
#my $self = {
# #api_client => $options->{api_client}
# api_client => $default_api_client
#};
if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::SwaggerClient::ApiClient' ) {
$api_client = $_[0];
} else {
$api_client = WWW::SwaggerClient::ApiClient->new(@_);
}
bless \%self, $class;
bless { api_client => $api_client }, $class;
}

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -47,8 +47,8 @@ has tokens => ( is => 'ro',
);
has _cfg => ( is => 'ro',
isa => 'Str',
default => 'WWW::SwaggerClient::Configuration',
isa => 'WWW::SwaggerClient::Configuration',
default => sub { WWW::SwaggerClient::Configuration->new() },
);
has version_info => ( is => 'ro',
@ -201,39 +201,39 @@ you are accessing. Usually C<prefix> and C<in> will be determined by the code ge
the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<WWW::SwaggerClient::Configuration> namespace
The tokens will be placed in a L<WWW::SwaggerClient::Configuration> instance
as follows, but you don't need to know about this.
=over 4
=item C<$WWW::SwaggerClient::Configuration::username>
=item C<$cfg-\>{username}>
String. The username for basic auth.
=item C<$WWW::SwaggerClient::Configuration::password>
=item C<$cfg-\>{password}>
String. The password for basic auth.
=item C<$WWW::SwaggerClient::Configuration::api_key>
=item C<$cfg-\>{api_key}>
Hashref. Keyed on the name of each key (there can be multiple tokens).
$WWW::SwaggerClient::Configuration::api_key = {
$cfg->{api_key} = {
secretKey => 'aaaabbbbccccdddd',
anotherKey => '1111222233334444',
};
=item C<$WWW::SwaggerClient::Configuration::api_key_prefix>
=item C<$cfg->{api_key_prefix}>
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not
all api keys require a prefix.
$WWW::SwaggerClient::Configuration::api_key_prefix = {
$cfg->{api_key_prefix} = {
secretKey => 'string',
anotherKey => 'same or some other string',
};
=item C<$WWW::SwaggerClient::Configuration::access_token>
=item C<$config-\>{access_token}>
String. The OAuth access token.
@ -244,8 +244,7 @@ String. The OAuth access token.
=head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>.
returns the current value of C<base_url>.
=head2 C<api_factory>

View File

@ -1 +1 @@
2.2.3-SNAPSHOT
2.3.0-SNAPSHOT

View File

@ -226,6 +226,7 @@ use WWW::SwaggerClient::FakeClassnameTags123Api;
use WWW::SwaggerClient::PetApi;
use WWW::SwaggerClient::StoreApi;
use WWW::SwaggerClient::UserApi;
use WWW::SwaggerClient::AnotherfakeApi;
```
@ -283,6 +284,7 @@ use WWW::SwaggerClient::FakeClassnameTags123Api;
use WWW::SwaggerClient::PetApi;
use WWW::SwaggerClient::StoreApi;
use WWW::SwaggerClient::UserApi;
use WWW::SwaggerClient::AnotherfakeApi;
# load the models
use WWW::SwaggerClient::Object::AdditionalPropertiesClass;
@ -354,6 +356,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
*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
@ -375,6 +378,7 @@ Class | Method | HTTP request | Description
*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user
*AnotherfakeApi* | [**test_special_tags**](docs/AnotherfakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
# DOCUMENTATION FOR MODELS
@ -424,6 +428,12 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header
## api_key_query
- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
## http_basic_test
- **Type**: HTTP basic authentication

View File

@ -0,0 +1,60 @@
# WWW::SwaggerClient::AnotherfakeApi
## Load the API package
```perl
use WWW::SwaggerClient::Object::AnotherfakeApi;
```
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_special_tags**](AnotherfakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
# **test_special_tags**
> Client test_special_tags(body => $body)
To test special tags
To test special tags
### Example
```perl
use Data::Dumper;
use WWW::SwaggerClient::AnotherfakeApi;
my $api_instance = WWW::SwaggerClient::AnotherfakeApi->new(
);
my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model
eval {
my $result = $api_instance->test_special_tags(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AnotherfakeApi->test_special_tags: $@\n";
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **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)

View File

@ -16,6 +16,7 @@ Method | HTTP request | Description
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
# **fake_outer_boolean_serialize**
@ -269,7 +270,7 @@ my $api_instance = WWW::SwaggerClient::FakeApi->new(
my $number = 3.4; # Number | None
my $double = 1.2; # double | None
my $pattern_without_delimiter = 'pattern_without_delimiter_example'; # string | None
my $byte = 'B'; # string | None
my $byte = 'byte_example'; # string | None
my $integer = 56; # int | None
my $int32 = 56; # int | None
my $int64 = 789; # int | None
@ -382,3 +383,50 @@ 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_json_form_data**
> test_json_form_data(param => $param, param2 => $param2)
test json serialization of form data
### Example
```perl
use Data::Dumper;
use WWW::SwaggerClient::FakeApi;
my $api_instance = WWW::SwaggerClient::FakeApi->new(
);
my $param = 'param_example'; # string | field1
my $param2 = 'param2_example'; # string | field2
eval {
$api_instance->test_json_form_data(param => $param, param2 => $param2);
};
if ($@) {
warn "Exception when calling FakeApi->test_json_form_data: $@\n";
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **string**| field1 |
**param2** | **string**| field2 |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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)

View File

@ -22,6 +22,11 @@ To test class name in snake case
use Data::Dumper;
use WWW::SwaggerClient::FakeClassnameTags123Api;
my $api_instance = WWW::SwaggerClient::FakeClassnameTags123Api->new(
# Configure API key authorization: api_key_query
api_key => {'api_key_query' => 'YOUR_API_KEY'},
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#api_key_prefix => {'api_key_query' => 'Bearer'},
);
my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model
@ -47,7 +52,7 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[api_key_query](../README.md#api_key_query)
### HTTP request headers

View File

@ -0,0 +1,116 @@
=begin comment
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
package WWW::SwaggerClient::AnotherfakeApi;
require 5.6.0;
use strict;
use warnings;
use utf8;
use Exporter;
use Carp qw( croak );
use Log::Any qw($log);
use WWW::SwaggerClient::ApiClient;
use base "Class::Data::Inheritable";
__PACKAGE__->mk_classdata('method_documentation' => {});
sub new {
my $class = shift;
my $api_client;
if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::SwaggerClient::ApiClient' ) {
$api_client = $_[0];
} else {
$api_client = WWW::SwaggerClient::ApiClient->new(@_);
}
bless { api_client => $api_client }, $class;
}
#
# test_special_tags
#
# To test special tags
#
# @param Client $body client model (required)
{
my $params = {
'body' => {
data_type => 'Client',
description => 'client model',
required => '1',
},
};
__PACKAGE__->method_documentation->{ 'test_special_tags' } = {
summary => 'To test special tags',
params => $params,
returns => 'Client',
};
}
# @return Client
#
sub test_special_tags {
my ($self, %args) = @_;
# verify the required parameter 'body' is set
unless (exists $args{'body'}) {
croak("Missing the required parameter 'body' when calling test_special_tags");
}
# parse inputs
my $_resource_path = '/another-fake/dummy';
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');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
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
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
my $_response_object = $self->{api_client}->deserialize('Client', $response);
return $_response_object;
}
1;

View File

@ -348,6 +348,13 @@ sub update_params_for_auth {
$header_params->{'api_key'} = $api_key;
}
}
elsif ($auth eq 'api_key_query') {
my $api_key = $self->get_api_key_with_prefix('api_key_query');
if ($api_key) {
$query_params->{'api_key_query'} = $api_key;
}
}
elsif ($auth eq 'http_basic_test') {
if ($self->{config}{username} || $self->{config}{password}) {

View File

@ -705,4 +705,81 @@ sub test_enum_parameters {
return;
}
#
# test_json_form_data
#
# test json serialization of form data
#
# @param string $param field1 (required)
# @param string $param2 field2 (required)
{
my $params = {
'param' => {
data_type => 'string',
description => 'field1',
required => '1',
},
'param2' => {
data_type => 'string',
description => 'field2',
required => '1',
},
};
__PACKAGE__->method_documentation->{ 'test_json_form_data' } = {
summary => 'test json serialization of form data',
params => $params,
returns => undef,
};
}
# @return void
#
sub test_json_form_data {
my ($self, %args) = @_;
# verify the required parameter 'param' is set
unless (exists $args{'param'}) {
croak("Missing the required parameter 'param' when calling test_json_form_data");
}
# verify the required parameter 'param2' is set
unless (exists $args{'param2'}) {
croak("Missing the required parameter 'param2' when calling test_json_form_data");
}
# parse inputs
my $_resource_path = '/fake/jsonFormData';
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept();
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
# form params
if ( exists $args{'param'} ) {
$form_params->{'param'} = $self->{api_client}->to_form_value($args{'param'});
}
# form params
if ( exists $args{'param2'} ) {
$form_params->{'param2'} = $self->{api_client}->to_form_value($args{'param2'});
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw()];
# make the API Call
$self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
return;
}
1;

View File

@ -100,7 +100,7 @@ sub test_classname {
}
# authentication setting, if any
my $auth_settings = [qw()];
my $auth_settings = [qw(api_key_query )];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Animal;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Number;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Number;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::ReadOnlyFirst;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Animal;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Animal;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::OuterEnum;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,9 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Number;
use WWW::SwaggerClient::Object::UUID;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,9 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Animal;
use WWW::SwaggerClient::Object::UUID;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,8 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Number;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,10 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::OuterBoolean;
use WWW::SwaggerClient::Object::OuterNumber;
use WWW::SwaggerClient::Object::OuterString;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,9 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::Tag;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -30,6 +30,7 @@ use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");

View File

@ -0,0 +1,41 @@
=begin comment
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test cases below to test the API endpoints.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::AnotherfakeApi');
my $api = WWW::SwaggerClient::AnotherfakeApi->new();
isa_ok($api, 'WWW::SwaggerClient::AnotherfakeApi');
#
# test_special_tags test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->test_special_tags(body => $body);
}
1;