NAME

EveOnline::SSO::Client - base class for any Eve Online ESI API calls

SYNOPSIS

    use EveOnline::SSO::Client;

    my $client = EveOnline::SSO::Client->new(token => '************', x_user_agent => 'Pilot Name <email@gmail.com>');

    $api->get(['characters', 90922771, 'location'] );
    # url converting to https://esi.tech.ccp.is/latest/characters/90922771/location/?datasource=tranquility

DESCRIPTION

EveOnline::SSO::Client is base class for any EveOnline ESI API Contains get, post, put, delete methods for calls to any APIs.

CONSTRUCTOR

new()

Require arguments: token, x_user_agent

    my $client = EveOnline::SSO::Client->new(
                    token        => 'lPhJ_DLk345334532yfssfdJgFsnKI9rR4EZpcQnJ2',
                    x_user_agent => 'Pilot Name <email@gmail.com>',
                    endpoint     => 'https://esi.tech.ccp.is/latest/', # optional
                    datasource   => 'tranquility',                     # optional 
                );

For module based on EveOnline::SSO::Client you can override atributes:

    extends 'EveOnline::SSO::Client';
    has '+endpoint' => (
        is      => 'rw',
        default => 'https://esi.tech.ccp.is/dev/',
    ); 
    has '+datasource' => (
        is => 'rw',
        default => 'singularity',
    );

METHODS

get()

Send GET request.

    $client->get(['array', 'of', 'path', 'blocks'], 
        {
            # query string hash ref. Optional
        });

    $client->get(['characters', $character_id, 'location']);
    
    # or 
    
    $api->get(['characters', 90922771, 'contacts'], { page => 1 } );

    # or full link

    $client->get('https://esi.tech.ccp.is/latest/incursions/');

You can add any params for query hashref, it should be added to query_string

post()

Send POST request.

    $client->post(['array', 'of', 'path', 'blocks'], 
        {
            # query string hash ref. Can be empty
        },
        [ {}, [] ]  # Body structure. Converting to json. Optional
        );

    $client->post(['universe', 'names'], {}, [90922771,188956223]);
put()

Send PUT request.

    $client->put(['characters', 90922771, 'contacts'], { standing => 5, watched => 'false' }, [188956223] );
delete()

Send DELETE request.

    $client->delete(['characters', 90922771, 'contacts'], {}, [188956223] );

LICENSE

Copyright (C) Andrey Kuzmin.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Andrey Kuzmin <chipsoid@cpan.org>