AgentPushKit-Client

 view release on metacpan or  search on metacpan

lib/AgentPushKit/Client/Role.pm  view on Meta::CPAN

=begin comment

Agent Push Kit API

The complete Agent Push Kit REST API. Application event ingestion uses an organization key beginning with `apk_`. Authenticated user operations accept either an Agent Push Kit login JWT or an agent access token beginning with `apt_`.

The version of the OpenAPI document: 0.1.0

Generated by: https://openapi-generator.tech

=end comment

=cut

#
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# Do not edit the class manually.
# Ref: https://openapi-generator.tech
#
package AgentPushKit::Client::Role;
use utf8;

use Moose::Role;
use namespace::autoclean;
use Class::Inspector;
use Log::Any qw($log);
use AgentPushKit::Client::ApiFactory;

has base_url => ( is => 'ro',
                  required => 0,
                  isa => 'Str',
                  documentation => 'Root of the server that requests are sent to',
                  );

has api_factory => ( is => 'ro',
                     isa => 'AgentPushKit::Client::ApiFactory',
                     builder => '_build_af',
                     lazy => 1,
                     documentation => 'Builds an instance of the endpoint API class',
                     );

has tokens => ( is => 'ro',
                isa => 'HashRef',
                required => 0,
                default => sub { {} },
                documentation => 'The auth tokens required by the application - basic, OAuth and/or API key(s)',
                );

has _cfg => ( is => 'ro',
              isa => 'AgentPushKit::Client::Configuration',
              default => sub { AgentPushKit::Client::Configuration->new() },
              );

has version_info => ( is => 'ro',
                      isa => 'HashRef',
                      default => sub { {
                          app_name => 'Agent Push Kit API',
                          app_version => '0.1.0',
                          generator_version => '7.24.0',
                          generator_class => 'org.openapitools.codegen.languages.PerlClientCodegen',
                      } },
                      documentation => 'Information about the application version and the codegen codebase version'
                      );

sub BUILD {
    my $self = shift;

    $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};

    # ignore these symbols imported into API namespaces
    my %outsiders = map {$_ => 1} qw( croak );

    my %delegates;

    # collect the methods callable on each API
    foreach my $api_name ($self->api_factory->apis_available) {
        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 @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;
    }

    # remove clashes
    foreach my $method (keys %delegates) {



( run in 2.410 seconds using v1.01-cache-2.11-cpan-4ac696b4eb4 )