hide generation timestamp for perl (#4614)

This commit is contained in:
wing328 2017-01-21 19:12:51 +08:00 committed by GitHub
parent 1f0ecb5180
commit 4d19fb6b2f
33 changed files with 1598 additions and 281 deletions

View File

@ -27,7 +27,7 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
# complex module name used for testing # complex module name used for testing
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl" ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -148,7 +148,7 @@ public class CodegenConstants {
public static final String GENERATE_MODEL_TESTS_DESC = "Specifies that model tests are to be generated."; public static final String GENERATE_MODEL_TESTS_DESC = "Specifies that model tests are to be generated.";
public static final String HIDE_GENERATION_TIMESTAMP = "hideGenerationTimestamp"; public static final String HIDE_GENERATION_TIMESTAMP = "hideGenerationTimestamp";
public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp."; public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp when files are generated.";
public static final String GENERATE_PROPERTY_CHANGED = "generatePropertyChanged"; public static final String GENERATE_PROPERTY_CHANGED = "generatePropertyChanged";
public static final String GENERATE_PROPERTY_CHANGED_DESC = "Specifies that models support raising property changed events."; public static final String GENERATE_PROPERTY_CHANGED_DESC = "Specifies that models support raising property changed events.";
@ -158,4 +158,5 @@ public class CodegenConstants {
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride"; public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation."; public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation.";
} }

View File

@ -109,7 +109,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString())); CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
.ENSURE_UNIQUE_PARAMS_DESC).defaultValue(Boolean.TRUE.toString())); .ENSURE_UNIQUE_PARAMS_DESC).defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
.defaultValue(Boolean.TRUE.toString()));
} }
@ -134,6 +135,14 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath); additionalProperties.put("modelDocPath", modelDocPath);
// default HIDE_GENERATION_TIMESTAMP to true
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
} else {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
Boolean.valueOf(additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP).toString()));
}
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiClient.pm")); supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiClient.pm"));
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "Configuration.pm")); supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "Configuration.pm"));
supportingFiles.add(new SupportingFile("ApiFactory.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiFactory.pm")); supportingFiles.add(new SupportingFile("ApiFactory.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiFactory.pm"));
@ -161,7 +170,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
@Override @Override
public String escapeReservedWord(String name) { public String escapeReservedWord(String name) {
if(this.reservedWordsMappings().containsKey(name)) { if(this.reservedWordsMappings().containsKey(name)) {
return this.reservedWordsMappings().get(name); return this.reservedWordsMappings().get(name);
} }
@ -399,7 +408,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public void setParameterExampleValue(CodegenParameter p) { public void setParameterExampleValue(CodegenParameter p) {
if (Boolean.TRUE.equals(p.isString) || Boolean.TRUE.equals(p.isBinary) || if (Boolean.TRUE.equals(p.isString) || Boolean.TRUE.equals(p.isBinary) ||
Boolean.TRUE.equals(p.isByteArray) || Boolean.TRUE.equals(p.isFile)) { Boolean.TRUE.equals(p.isByteArray) || Boolean.TRUE.equals(p.isFile)) {
p.example = "'" + p.example + "'"; p.example = "'" + p.example + "'";
} else if (Boolean.TRUE.equals(p.isBoolean)) { } else if (Boolean.TRUE.equals(p.isBoolean)) {

View File

@ -10,7 +10,9 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/
- API version: {{appVersion}} - API version: {{appVersion}}
- Package version: {{moduleVersion}} - Package version: {{moduleVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}} - Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}} - Build package: {{generatorClass}}
{{#infoUrl}} {{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
@ -18,43 +20,43 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
{{moduleName}}::ApiFactory for non-Moosey usage. {{moduleName}}::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with '{{moduleName}}::Role'; with '{{moduleName}}::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@ -67,33 +69,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will 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. default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `{{moduleName}}::Configuration` namespace The tokens will be placed in the `{{moduleName}}::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `${{moduleName}}::Configuration::username` - `${{moduleName}}::Configuration::username`
@ -124,22 +126,22 @@ as follows, but you don't need to know about this.
- `${{moduleName}}::Configuration::access_token` - `${{moduleName}}::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method 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 returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a {{moduleName}}::PetApi instance $self->api_factory('Pet'); # returns a {{moduleName}}::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@ -149,9 +151,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@ -164,12 +166,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@ -184,8 +186,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@ -197,28 +199,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@ -297,7 +299,7 @@ Class | Method | HTTP request | Description
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}} {{#authMethods}}## {{{name}}}
{{#isApiKey}}- **Type**: API key {{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}} - **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} - **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}} {{/isApiKey}}
@ -312,5 +314,3 @@ Class | Method | HTTP request | Description
{{/isOAuth}} {{/isOAuth}}
{{/authMethods}} {{/authMethods}}

View File

@ -1,6 +1,6 @@
{{>partial_license}} {{>partial_license}}
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@ -21,7 +21,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => '{{moduleName}}::ApiFactory', isa => '{{moduleName}}::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@ -38,12 +38,14 @@ has _cfg => ( is => 'ro',
default => '{{moduleName}}::Configuration', default => '{{moduleName}}::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => '{{appName}}', app_name => '{{appName}}',
app_version => '{{appVersion}}', app_version => '{{appVersion}}',
{{^hideGenerationTimestamp}}
generated_date => '{{generatedDate}}', generated_date => '{{generatedDate}}',
{{/hideGenerationTimestamp}}
generator_class => '{{generatorClass}}', generator_class => '{{generatorClass}}',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
@ -51,36 +53,36 @@ has version_info => ( is => 'ro',
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@ -99,62 +101,64 @@ sub _build_af {
=head1 NAME =head1 NAME
{{moduleName}}::Role - a Moose role for the {{appName}} {{moduleName}}::Role - a Moose role for the {{appName}}
=head2 {{appName}} version: {{appVersion}} =head2 {{appName}} version: {{appVersion}}
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
{{^hideGenerationTimestamp}}
=item Build date: {{generatedDate}} =item Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
=item Build package: {{generatorClass}} =item Build package: {{generatorClass}}
=item Codegen version: =item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
{{moduleName}}::ApiFactory for non-Moosey usage. {{moduleName}}::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with '{{moduleName}}::Role'; with '{{moduleName}}::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@ -167,33 +171,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will 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. default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<{{moduleName}}::Configuration> namespace The tokens will be placed in the C<{{moduleName}}::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@ -226,7 +230,7 @@ all api keys require a prefix.
=item C<${{moduleName}}::Configuration::access_token> =item C<${{moduleName}}::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@ -234,16 +238,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method 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 returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a {{moduleName}}::PetApi instance $self->api_factory('Pet'); # returns a {{moduleName}}::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@ -253,9 +257,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@ -268,12 +272,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@ -288,8 +292,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@ -301,28 +305,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@ -24,6 +24,7 @@ public class PerlClientOptionsProvider implements OptionsProvider {
.put(PerlClientCodegen.MODULE_VERSION, MODULE_VERSION_VALUE) .put(PerlClientCodegen.MODULE_VERSION, MODULE_VERSION_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true") .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, "true") .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, "true")
.put("hideGenerationTimestamp", "true")
.build(); .build();
} }

View File

@ -10,48 +10,47 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/
- API version: 1.0.0 - API version: 1.0.0
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-11-16T17:12:17.554+08:00 - Build package: io.swagger.codegen.languages.PerlClientCodegen
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@ -64,33 +63,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will 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. 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 the `WWW::SwaggerClient::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::username` - `$WWW::SwaggerClient::Configuration::username`
@ -121,22 +120,22 @@ as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::access_token` - `$WWW::SwaggerClient::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method 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 returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@ -146,9 +145,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@ -161,12 +160,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@ -181,8 +180,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@ -194,28 +193,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@ -239,8 +238,10 @@ use WWW::SwaggerClient::Object::ApiResponse;
use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::ArrayTest;
use WWW::SwaggerClient::Object::Capitalization;
use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::ClassModel;
use WWW::SwaggerClient::Object::Client; use WWW::SwaggerClient::Object::Client;
use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::EnumArrays; use WWW::SwaggerClient::Object::EnumArrays;
@ -256,6 +257,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::Name;
use WWW::SwaggerClient::Object::NumberOnly; use WWW::SwaggerClient::Object::NumberOnly;
use WWW::SwaggerClient::Object::Order; use WWW::SwaggerClient::Object::Order;
use WWW::SwaggerClient::Object::OuterEnum;
use WWW::SwaggerClient::Object::Pet; use WWW::SwaggerClient::Object::Pet;
use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::ReadOnlyFirst;
use WWW::SwaggerClient::Object::SpecialModelName; use WWW::SwaggerClient::Object::SpecialModelName;
@ -285,8 +287,10 @@ use WWW::SwaggerClient::Object::ApiResponse;
use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayOfNumberOnly; use WWW::SwaggerClient::Object::ArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayTest; use WWW::SwaggerClient::Object::ArrayTest;
use WWW::SwaggerClient::Object::Capitalization;
use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::ClassModel;
use WWW::SwaggerClient::Object::Client; use WWW::SwaggerClient::Object::Client;
use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::EnumArrays; use WWW::SwaggerClient::Object::EnumArrays;
@ -302,6 +306,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::Name;
use WWW::SwaggerClient::Object::NumberOnly; use WWW::SwaggerClient::Object::NumberOnly;
use WWW::SwaggerClient::Object::Order; use WWW::SwaggerClient::Object::Order;
use WWW::SwaggerClient::Object::OuterEnum;
use WWW::SwaggerClient::Object::Pet; use WWW::SwaggerClient::Object::Pet;
use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::ReadOnlyFirst;
use WWW::SwaggerClient::Object::SpecialModelName; use WWW::SwaggerClient::Object::SpecialModelName;
@ -365,8 +370,10 @@ Class | Method | HTTP request | Description
- [WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [WWW::SwaggerClient::Object::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [WWW::SwaggerClient::Object::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [WWW::SwaggerClient::Object::ArrayTest](docs/ArrayTest.md) - [WWW::SwaggerClient::Object::ArrayTest](docs/ArrayTest.md)
- [WWW::SwaggerClient::Object::Capitalization](docs/Capitalization.md)
- [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Cat](docs/Cat.md)
- [WWW::SwaggerClient::Object::Category](docs/Category.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md)
- [WWW::SwaggerClient::Object::ClassModel](docs/ClassModel.md)
- [WWW::SwaggerClient::Object::Client](docs/Client.md) - [WWW::SwaggerClient::Object::Client](docs/Client.md)
- [WWW::SwaggerClient::Object::Dog](docs/Dog.md) - [WWW::SwaggerClient::Object::Dog](docs/Dog.md)
- [WWW::SwaggerClient::Object::EnumArrays](docs/EnumArrays.md) - [WWW::SwaggerClient::Object::EnumArrays](docs/EnumArrays.md)
@ -382,6 +389,7 @@ Class | Method | HTTP request | Description
- [WWW::SwaggerClient::Object::Name](docs/Name.md) - [WWW::SwaggerClient::Object::Name](docs/Name.md)
- [WWW::SwaggerClient::Object::NumberOnly](docs/NumberOnly.md) - [WWW::SwaggerClient::Object::NumberOnly](docs/NumberOnly.md)
- [WWW::SwaggerClient::Object::Order](docs/Order.md) - [WWW::SwaggerClient::Object::Order](docs/Order.md)
- [WWW::SwaggerClient::Object::OuterEnum](docs/OuterEnum.md)
- [WWW::SwaggerClient::Object::Pet](docs/Pet.md) - [WWW::SwaggerClient::Object::Pet](docs/Pet.md)
- [WWW::SwaggerClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [WWW::SwaggerClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md) - [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md)
@ -393,7 +401,7 @@ Class | Method | HTTP request | Description
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header
@ -410,5 +418,3 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account - **write:pets**: modify pets in your account
- **read:pets**: read your pets - **read:pets**: read your pets

View File

@ -0,0 +1,20 @@
# WWW::SwaggerClient::Object::Capitalization
## Load the model package
```perl
use WWW::SwaggerClient::Object::Capitalization;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**small_camel** | **string** | | [optional]
**capital_camel** | **string** | | [optional]
**small_snake** | **string** | | [optional]
**capital_snake** | **string** | | [optional]
**sca_eth_flow_points** | **string** | | [optional]
**att_name** | **string** | Name of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,15 @@
# WWW::SwaggerClient::Object::ClassModel
## Load the model package
```perl
use WWW::SwaggerClient::Object::ClassModel;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_class** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -11,6 +11,7 @@ Name | Type | Description | Notes
**enum_string** | **string** | | [optional] **enum_string** | **string** | | [optional]
**enum_integer** | **int** | | [optional] **enum_integer** | **int** | | [optional]
**enum_number** | **double** | | [optional] **enum_number** | **double** | | [optional]
**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -19,6 +19,8 @@ Method | HTTP request | Description
To test \"client\" model To test \"client\" model
To test \"client\" model
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
@ -138,6 +140,8 @@ void (empty response body)
To test enum parameters To test enum parameters
To test enum parameters
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
@ -151,7 +155,7 @@ my $enum_header_string_array = []; # ARRAY[string] | Header parameter enum test
my $enum_header_string = 'enum_header_string_example'; # string | Header parameter enum test (string) my $enum_header_string = 'enum_header_string_example'; # string | Header parameter enum test (string)
my $enum_query_string_array = []; # ARRAY[string] | Query parameter enum test (string array) my $enum_query_string_array = []; # ARRAY[string] | Query parameter enum test (string array)
my $enum_query_string = 'enum_query_string_example'; # string | Query parameter enum test (string) my $enum_query_string = 'enum_query_string_example'; # string | Query parameter enum test (string)
my $enum_query_integer = 3.4; # Number | Query parameter enum test (double) my $enum_query_integer = 56; # int | Query parameter enum test (double)
my $enum_query_double = 1.2; # double | Query parameter enum test (double) my $enum_query_double = 1.2; # double | Query parameter enum test (double)
eval { eval {
@ -172,7 +176,7 @@ Name | Type | Description | Notes
**enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
**enum_query_string_array** | [**ARRAY[string]**](string.md)| Query parameter enum test (string array) | [optional] **enum_query_string_array** | [**ARRAY[string]**](string.md)| Query parameter enum test (string array) | [optional]
**enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg] **enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enum_query_integer** | **Number**| Query parameter enum test (double) | [optional] **enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
**enum_query_double** | **double**| Query parameter enum test (double) | [optional] **enum_query_double** | **double**| Query parameter enum test (double) | [optional]
### Return type ### Return type

View File

@ -0,0 +1,14 @@
# WWW::SwaggerClient::Object::OuterEnum
## Load the model package
```perl
use WWW::SwaggerClient::Object::OuterEnum;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -348,7 +348,7 @@ sub test_endpoint_parameters {
# @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg) # @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
# @param ARRAY[string] $enum_query_string_array Query parameter enum test (string array) (optional) # @param ARRAY[string] $enum_query_string_array Query parameter enum test (string array) (optional)
# @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) # @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
# @param Number $enum_query_integer Query parameter enum test (double) (optional) # @param int $enum_query_integer Query parameter enum test (double) (optional)
# @param double $enum_query_double Query parameter enum test (double) (optional) # @param double $enum_query_double Query parameter enum test (double) (optional)
{ {
my $params = { my $params = {
@ -383,7 +383,7 @@ sub test_endpoint_parameters {
required => '0', required => '0',
}, },
'enum_query_integer' => { 'enum_query_integer' => {
data_type => 'Number', data_type => 'int',
description => 'Query parameter enum test (double)', description => 'Query parameter enum test (double)',
required => '0', required => '0',
}, },

View File

@ -0,0 +1,210 @@
=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::Object::Capitalization;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");
#
#
#
# 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
#
=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__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->attribute_map}) {
if (defined $self->{$_key}) {
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
}
}
return $_data;
}
# from Perl hashref
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \@_array;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
} else {
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
}
}
return $self;
}
# deserialize non-array data
sub _deserialize {
my ($self, $type, $data) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
if ($type eq 'DateTime') {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => '',
class => 'Capitalization',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'small_camel' => {
datatype => 'string',
base_name => 'smallCamel',
description => '',
format => '',
read_only => '',
},
'capital_camel' => {
datatype => 'string',
base_name => 'CapitalCamel',
description => '',
format => '',
read_only => '',
},
'small_snake' => {
datatype => 'string',
base_name => 'small_Snake',
description => '',
format => '',
read_only => '',
},
'capital_snake' => {
datatype => 'string',
base_name => 'Capital_Snake',
description => '',
format => '',
read_only => '',
},
'sca_eth_flow_points' => {
datatype => 'string',
base_name => 'SCA_ETH_Flow_Points',
description => '',
format => '',
read_only => '',
},
'att_name' => {
datatype => 'string',
base_name => 'ATT_NAME',
description => 'Name of the pet ',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'small_camel' => 'string',
'capital_camel' => 'string',
'small_snake' => 'string',
'capital_snake' => 'string',
'sca_eth_flow_points' => 'string',
'att_name' => 'string'
} );
__PACKAGE__->attribute_map( {
'small_camel' => 'smallCamel',
'capital_camel' => 'CapitalCamel',
'small_snake' => 'small_Snake',
'capital_snake' => 'Capital_Snake',
'sca_eth_flow_points' => 'SCA_ETH_Flow_Points',
'att_name' => 'ATT_NAME'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -0,0 +1,165 @@
=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::Object::ClassModel;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");
#
#Model for testing model with \&quot;_class\&quot; property
#
# 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
#
=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__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->attribute_map}) {
if (defined $self->{$_key}) {
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
}
}
return $_data;
}
# from Perl hashref
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \@_array;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
} else {
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
}
}
return $self;
}
# deserialize non-array data
sub _deserialize {
my ($self, $type, $data) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
if ($type eq 'DateTime') {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => 'Model for testing model with \&quot;_class\&quot; property',
class => 'ClassModel',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'_class' => {
datatype => 'string',
base_name => '_class',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'_class' => 'string'
} );
__PACKAGE__->attribute_map( {
'_class' => '_class'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -163,18 +163,27 @@ __PACKAGE__->method_documentation({
format => '', format => '',
read_only => '', read_only => '',
}, },
'outer_enum' => {
datatype => 'OuterEnum',
base_name => 'outerEnum',
description => '',
format => '',
read_only => '',
},
}); });
__PACKAGE__->swagger_types( { __PACKAGE__->swagger_types( {
'enum_string' => 'string', 'enum_string' => 'string',
'enum_integer' => 'int', 'enum_integer' => 'int',
'enum_number' => 'double' 'enum_number' => 'double',
'outer_enum' => 'OuterEnum'
} ); } );
__PACKAGE__->attribute_map( { __PACKAGE__->attribute_map( {
'enum_string' => 'enum_string', 'enum_string' => 'enum_string',
'enum_integer' => 'enum_integer', 'enum_integer' => 'enum_integer',
'enum_number' => 'enum_number' 'enum_number' => 'enum_number',
'outer_enum' => 'outerEnum'
} ); } );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});

View File

@ -0,0 +1,158 @@
=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::Object::OuterEnum;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::Parse;
use DateTime;
use base ("Class::Accessor", "Class::Data::Inheritable");
#
#
#
# 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
#
=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__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
foreach my $_key (keys %{$self->attribute_map}) {
if (defined $self->{$_key}) {
$_data->{$self->attribute_map->{$_key}} = $self->{$_key};
}
}
return $_data;
}
# from Perl hashref
sub from_hash {
my ($self, $hash) = @_;
# loop through attributes and use swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
my $_subclass = substr($_type, 6, -1);
my @_array = ();
foreach my $_element (@{$hash->{$_json_attribute}}) {
push @_array, $self->_deserialize($_subclass, $_element);
}
$self->{$_key} = \@_array;
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
} else {
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
}
}
return $self;
}
# deserialize non-array data
sub _deserialize {
my ($self, $type, $data) = @_;
$log->debugf("deserializing %s with %s",Dumper($data), $type);
if ($type eq 'DateTime') {
return DateTime->from_epoch(epoch => str2time($data));
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => '',
class => 'OuterEnum',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
});
__PACKAGE__->swagger_types( {
} );
__PACKAGE__->attribute_map( {
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -13,7 +13,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
=cut =cut
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@ -34,7 +34,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => 'WWW::SwaggerClient::ApiFactory', isa => 'WWW::SwaggerClient::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@ -51,49 +51,48 @@ has _cfg => ( is => 'ro',
default => 'WWW::SwaggerClient::Configuration', default => 'WWW::SwaggerClient::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => 'Swagger Petstore', app_name => 'Swagger Petstore',
app_version => '1.0.0', app_version => '1.0.0',
generated_date => '2016-11-16T17:12:17.554+08:00', generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
); );
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@ -112,62 +111,59 @@ sub _build_af {
=head1 NAME =head1 NAME
WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
=head2 Swagger Petstore version: 1.0.0 =head2 Swagger Petstore version: 1.0.0
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Build date: 2016-11-16T17:12:17.554+08:00 =item Codegen version:
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@ -180,33 +176,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will 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. 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 the C<WWW::SwaggerClient::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@ -239,7 +235,7 @@ all api keys require a prefix.
=item C<$WWW::SwaggerClient::Configuration::access_token> =item C<$WWW::SwaggerClient::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@ -247,16 +243,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method 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 returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@ -266,9 +262,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@ -281,12 +277,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@ -301,8 +297,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@ -314,28 +310,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly');
my $instance = WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ArrayOfNumberOnly');
my $instance = WWW::SwaggerClient::Object::ArrayOfNumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ArrayOfNumberOnly');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::Capitalization');
my $instance = WWW::SwaggerClient::Object::Capitalization->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Capitalization');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ClassModel');
my $instance = WWW::SwaggerClient::Object::ClassModel->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ClassModel');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::Client');
my $instance = WWW::SwaggerClient::Object::Client->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Client');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::EnumArrays');
my $instance = WWW::SwaggerClient::Object::EnumArrays->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::EnumArrays');

View File

@ -0,0 +1,77 @@
=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::FakeApi');
my $api = WWW::SwaggerClient::FakeApi->new();
isa_ok($api, 'WWW::SwaggerClient::FakeApi');
#
# test_client_model test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->test_client_model(body => $body);
}
#
# test_endpoint_parameters test
#
{
my $number = undef; # replace NULL with a proper value
my $double = undef; # replace NULL with a proper value
my $pattern_without_delimiter = undef; # replace NULL with a proper value
my $byte = undef; # replace NULL with a proper value
my $integer = undef; # replace NULL with a proper value
my $int32 = undef; # replace NULL with a proper value
my $int64 = undef; # replace NULL with a proper value
my $float = undef; # replace NULL with a proper value
my $string = undef; # replace NULL with a proper value
my $binary = undef; # replace NULL with a proper value
my $date = undef; # replace NULL with a proper value
my $date_time = undef; # replace NULL with a proper value
my $password = undef; # replace NULL with a proper value
my $callback = undef; # replace NULL with a proper value
my $result = $api->test_endpoint_parameters(number => $number, double => $double, pattern_without_delimiter => $pattern_without_delimiter, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, string => $string, binary => $binary, date => $date, date_time => $date_time, password => $password, callback => $callback);
}
#
# test_enum_parameters test
#
{
my $enum_form_string_array = undef; # replace NULL with a proper value
my $enum_form_string = undef; # replace NULL with a proper value
my $enum_header_string_array = undef; # replace NULL with a proper value
my $enum_header_string = undef; # replace NULL with a proper value
my $enum_query_string_array = undef; # replace NULL with a proper value
my $enum_query_string = undef; # replace NULL with a proper value
my $enum_query_integer = undef; # replace NULL with a proper value
my $enum_query_double = undef; # replace NULL with a proper value
my $result = $api->test_enum_parameters(enum_form_string_array => $enum_form_string_array, enum_form_string => $enum_form_string, enum_header_string_array => $enum_header_string_array, enum_header_string => $enum_header_string, enum_query_string_array => $enum_query_string_array, enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double);
}
1;

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::HasOnlyReadOnly');
my $instance = WWW::SwaggerClient::Object::HasOnlyReadOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::HasOnlyReadOnly');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::List');
my $instance = WWW::SwaggerClient::Object::List->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::List');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::MapTest');
my $instance = WWW::SwaggerClient::Object::MapTest->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::MapTest');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::NumberOnly');
my $instance = WWW::SwaggerClient::Object::NumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::NumberOnly');

View File

@ -0,0 +1,33 @@
=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 Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::OuterEnum');
my $instance = WWW::SwaggerClient::Object::OuterEnum->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::OuterEnum');

View File

@ -0,0 +1,102 @@
=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::PetApi');
my $api = WWW::SwaggerClient::PetApi->new();
isa_ok($api, 'WWW::SwaggerClient::PetApi');
#
# add_pet test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->add_pet(body => $body);
}
#
# delete_pet test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $api_key = undef; # replace NULL with a proper value
my $result = $api->delete_pet(pet_id => $pet_id, api_key => $api_key);
}
#
# find_pets_by_status test
#
{
my $status = undef; # replace NULL with a proper value
my $result = $api->find_pets_by_status(status => $status);
}
#
# find_pets_by_tags test
#
{
my $tags = undef; # replace NULL with a proper value
my $result = $api->find_pets_by_tags(tags => $tags);
}
#
# get_pet_by_id test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $result = $api->get_pet_by_id(pet_id => $pet_id);
}
#
# update_pet test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->update_pet(body => $body);
}
#
# update_pet_with_form test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $name = undef; # replace NULL with a proper value
my $status = undef; # replace NULL with a proper value
my $result = $api->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status);
}
#
# upload_file test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $additional_metadata = undef; # replace NULL with a proper value
my $file = undef; # replace NULL with a proper value
my $result = $api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file);
}
1;

View File

@ -0,0 +1,64 @@
=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::StoreApi');
my $api = WWW::SwaggerClient::StoreApi->new();
isa_ok($api, 'WWW::SwaggerClient::StoreApi');
#
# delete_order test
#
{
my $order_id = undef; # replace NULL with a proper value
my $result = $api->delete_order(order_id => $order_id);
}
#
# get_inventory test
#
{
my $result = $api->get_inventory();
}
#
# get_order_by_id test
#
{
my $order_id = undef; # replace NULL with a proper value
my $result = $api->get_order_by_id(order_id => $order_id);
}
#
# place_order test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->place_order(body => $body);
}
1;

View File

@ -0,0 +1,98 @@
=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::UserApi');
my $api = WWW::SwaggerClient::UserApi->new();
isa_ok($api, 'WWW::SwaggerClient::UserApi');
#
# create_user test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_user(body => $body);
}
#
# create_users_with_array_input test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_users_with_array_input(body => $body);
}
#
# create_users_with_list_input test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_users_with_list_input(body => $body);
}
#
# delete_user test
#
{
my $username = undef; # replace NULL with a proper value
my $result = $api->delete_user(username => $username);
}
#
# get_user_by_name test
#
{
my $username = undef; # replace NULL with a proper value
my $result = $api->get_user_by_name(username => $username);
}
#
# login_user test
#
{
my $username = undef; # replace NULL with a proper value
my $password = undef; # replace NULL with a proper value
my $result = $api->login_user(username => $username, password => $password);
}
#
# logout_user test
#
{
my $result = $api->logout_user();
}
#
# update_user test
#
{
my $username = undef; # replace NULL with a proper value
my $body = undef; # replace NULL with a proper value
my $result = $api->update_user(username => $username, body => $body);
}
1;