AgentPushKit-Client
view release on metacpan or search on metacpan
secretKey => 'string',
anotherKey => 'same or some other string',
};
- `$cfg->{access_token}`
String. The OAuth access token.
# METHODS
## `base_url`
The generated code has the `base_url` already set as a default value. This method
returns the current value of `base_url`.
## `api_factory`
Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a AgentPushKit::Client::PetApi instance
$self->pet_api; # the same
# MISSING METHODS
Most of the methods on the API are delegated to individual endpoint API objects
(e.g. Pet API, Store API, User API etc). Where different endpoint APIs use the
same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`.
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
unlikely in general that any methods will be undelegatable, except for:
new()
class_documentation()
method_documentation()
To call these methods, you need to get a handle on the relevant object, either
by calling `$api->foo_api` or by retrieving an object, e.g.
`$api->get_pet_by_id(pet_id => $pet_id)`. They are class methods, so
you could also call them on class names.
# BUILDING YOUR LIBRARY
See the homepage `https://openapi-generator.tech` for full details.
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
maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"}
Your library files will be built under `WWW::MyProjectName`.
$ git clone https://github.com/openapitools/openapi-generator
$ cd openapi-generator
$ mvn package
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i [URL or file path to JSON OpenAPI API spec] \
-g perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built.
# AUTOMATIC DOCUMENTATION
You can print out a summary of the generated API by running the included
`autodoc` script in the `bin` directory of your generated library. A few
output formats are supported:
Usage: autodoc [OPTION]
-w wide format (default)
-n narrow format
-p POD format
-H HTML format
-m Markdown format
-h print this help message
-c your application class
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.
# DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the OpenAPI
spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the
`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};
Each of these calls returns a hashref with various useful pieces of information.
# Installation Prerequisites
Use [cpanm](https://metacpan.org/pod/distribution/App-cpanminus/bin/cpanm) to install the module dependencies:
```
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
cpanm --quiet --no-interactive Class::Accessor Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON
```
# LOAD THE MODULES
To load the API packages:
```perl
use AgentPushKit::Client::AccountApi;
use AgentPushKit::Client::AgentTokensApi;
use AgentPushKit::Client::AuthenticationApi;
use AgentPushKit::Client::CustomerAccountsApi;
use AgentPushKit::Client::DevicesApi;
use AgentPushKit::Client::EventsApi;
use AgentPushKit::Client::HealthApi;
use AgentPushKit::Client::PreferencesApi;
```
To load the models:
```perl
use AgentPushKit::Client::Object::AcceptedResponse;
use AgentPushKit::Client::Object::AddMemberInput;
use AgentPushKit::Client::Object::AgentToken;
use AgentPushKit::Client::Object::AgentTokenCreated;
use AgentPushKit::Client::Object::ApiKeySummary;
use AgentPushKit::Client::Object::AuthResponse;
use AgentPushKit::Client::Object::CreateAgentTokenInput;
use AgentPushKit::Client::Object::CreateOrganizationInput;
use AgentPushKit::Client::Object::CurrentAccount;
use AgentPushKit::Client::Object::DeletedResponse;
use AgentPushKit::Client::Object::DeliverySummary;
use AgentPushKit::Client::Object::Device;
use AgentPushKit::Client::Object::DisabledResponse;
use AgentPushKit::Client::Object::ErrorResponse;
use AgentPushKit::Client::Object::EventDetail;
use AgentPushKit::Client::Object::EventFilter;
use AgentPushKit::Client::Object::EventPage;
use AgentPushKit::Client::Object::EventSummary;
use AgentPushKit::Client::Object::FilterGroup;
use AgentPushKit::Client::Object::FilterNot;
use AgentPushKit::Client::Object::HealthResponse;
use AgentPushKit::Client::Object::IngestionResult;
use AgentPushKit::Client::Object::InheritedResponse;
use AgentPushKit::Client::Object::Membership;
use AgentPushKit::Client::Object::MembershipUser;
use AgentPushKit::Client::Object::Organization;
use AgentPushKit::Client::Object::OrganizationApiKeyCreated;
use AgentPushKit::Client::Object::OrganizationCount;
use AgentPushKit::Client::Object::OrganizationCreated;
use AgentPushKit::Client::Object::OrganizationRecord;
use AgentPushKit::Client::Object::PasswordLoginInput;
use AgentPushKit::Client::Object::PasswordResetCompleteInput;
use AgentPushKit::Client::Object::PasswordResetRequestInput;
use AgentPushKit::Client::Object::PreferenceRecord;
use AgentPushKit::Client::Object::ProviderLoginInput;
use AgentPushKit::Client::Object::RegisterDeviceInput;
use AgentPushKit::Client::Object::RegisterInput;
use AgentPushKit::Client::Object::RegisterWebPushSubscriptionInput;
use AgentPushKit::Client::Object::RegisterWebPushSubscriptionInputKeys;
use AgentPushKit::Client::Object::RevokedResponse;
use AgentPushKit::Client::Object::SearchEventsInput;
( run in 1.763 second using v1.01-cache-2.11-cpan-364913b4093 )