BmltClient-ApiClient

 view release on metacpan or  search on metacpan

lib/BmltClient/Role.pm  view on Meta::CPAN

=begin comment

BMLT

BMLT Admin API Documentation

The version of the OpenAPI document: 1.0.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 BmltClient::Role;
use utf8;

use Moose::Role;
use namespace::autoclean;
use Class::Inspector;
use Log::Any qw($log);
use BmltClient::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 => 'BmltClient::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 => 'BmltClient::Configuration',
              default => sub { BmltClient::Configuration->new() },
              );

has version_info => ( is => 'ro',
                      isa => 'HashRef',
                      default => sub { {
                          app_name => 'BMLT',
                          app_version => '1.0.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) {
        if ( @{$delegates{$method}} > 1 ) {



( run in 0.604 second using v1.01-cache-2.11-cpan-39bf76dae61 )