All Downloads are FREE. Search and download functionalities are using the official Maven repository.

v2.htmlDocs2.sample_perl.mustache Maven / Gradle / Ivy

The newest version!
use Data::Dumper;
use {{{perlModuleName}}}::Configuration;
use {{perlModuleName}}::{{classname}};
{{#hasAuthMethods}}{{#authMethods}}{{#is this 'basic'}}
# Configure HTTP basic authorization: {{{name}}}
${{{perlModuleName}}}::Configuration::username = 'YOUR_USERNAME';
${{{perlModuleName}}}::Configuration::password = 'YOUR_PASSWORD';{{/is}}{{#is this 'api-key'}}
# Configure API key authorization: {{{name}}}
${{{perlModuleName}}}::Configuration::api_key->{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#${{{perlModuleName}}}::Configuration::api_key_prefix->{'{{{keyParamName}}}'} = "Bearer";{{/is}}{{#is this 'oauth'}}
# Configure OAuth2 access token for authorization: {{{name}}}
${{{perlModuleName}}}::Configuration::access_token = 'YOUR_ACCESS_TOKEN';{{/is}}{{/authMethods}}
{{/hasAuthMethods}}

my $api_instance = {{perlModuleName}}::{{classname}}->new();
{{#allParams}}my ${{paramName}} = {{#is this 'list-container'}}[{{/is}}{{#is this 'body-param'}}{{{perlModuleName}}}::Object::{{dataType}}->new(){{/is}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#is this 'list-container'}}]{{/is}}; # {{{dataType}}} | {{{unescapedDescription}}}
{{/allParams}}

eval { 
    {{#returnType}}my $result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}{{paramName}} => ${{paramName}}{{#has this 'more'}}, {{/has}}{{/allParams}});{{#returnType}}
    print Dumper($result);{{/returnType}}
};
if ($@) {
    warn "Exception when calling {{classname}}->{{operationId}}: $@\n";
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy