The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::Suffit::Client - The Suffit API client library

SYNOPSIS

    use WWW::Suffit::Client;

    my $clinet = WWW::Suffit::Client->new(
        url                 => "https://localhost",
        username            => "username", # optional
        password            => "password", # optional
        max_redirects       => 2, # Default: 10
        connect_timeout     => 3, # Default: 10 sec
        inactivity_timeout  => 5, # Default: 30 sec
        request_timeout     => 10, # Default: 5 min (300 sec)
    );
    my $status = $client->check();

    if ($status) {
        print STDOUT $client->res->body;
    } else {
        print STDERR $clinet->error;
    }

DESCRIPTION

This library provides methods for access to Suffit API servers

METHODS

List of extended API methods

apierr

    die $client->apierr;

This method returns the value of the "/message" API parameter or a client error if no message found. Otherwise, this method returns a string containing an HTTP error message

API METHODS

List of predefined the Suffit API methods

api_check

    my $status = $client->api_check;
    my $status = $client->api_check( URLorPath );

Returns API check-status. 0 - Error; 1 - Ok

api_data

    my $status = $client->api_data;
    my $status = $client->api_data( URLorPath );

Gets API data

api_token

    my $status = $client->api_token;

Gets API token

authorize

    my $status = $client->authorize($username, $password, {
        encrypted => \0,
        foo => \1,
    });

Performs authorization on the server and returns access token. This is private method!

DEPENDENCIES

Mojolicious, WWW::Suffit

TO DO

See TODO file

SEE ALSO

Mojo::UserAgent, WWW::Suffit::UserAgent

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2023 D&D Corporation. All Rights Reserved

LICENSE

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

See LICENSE file and https://dev.perl.org/licenses/