Antybrowser-SDK

 view release on metacpan or  search on metacpan

lib/Antybrowser/SDK.pm  view on Meta::CPAN

use JSON;
use LWP::UserAgent;

sub new {
    my ($class, %args) = @_;
    my $port = $args{port} || 5173;
    return bless {
        api_key  => $args{api_key} || die "api_key required",
        base_url => $args{base_url} || "http://127.0.0.1:$port",
        ua       => LWP::UserAgent->new,
        json     => JSON->new->utf8,
    }, $class;
}

sub _request {
    my ($self, $method, $path, $body) = @_;
    my $url = $self->{base_url} . $path;
    my @headers = ('x-api-key' => $self->{api_key}, 'Content-Type' => 'application/json');
    my $response;

    if ($method eq 'GET') {



( run in 1.947 second using v1.01-cache-2.11-cpan-364913b4093 )