Acme-Free-Public-APIs
view release on metacpan or search on metacpan
lib/Acme/Free/Public/APIs.pm view on Meta::CPAN
my $pkg = shift;
my $self = baptise { ua => HTTP::Tiny->new }, $pkg;
return $self;
}
# https://www.freepublicapis.com/api/apis
# https://www.freepublicapis.com/api/apis/275
sub apis {
my $self = shift;
my $params = d2o -autoundef, { @_ };
my $URL = sprintf "%s/apis", BASEURL;
my $ret = [];
if ($params->id) {
$URL = sprintf "%s/%d", $URL, $params->id;
my $resp = HTTPTiny2h2o $self->ua->get($URL);
$ret = d2o -autoundef, [ $resp->content ]; # preset single item in an ARRAY
}
else {
my $resp = HTTPTiny2h2o $self->ua->get($URL);
$ret = $resp->content;
}
return $ret;
}
( run in 1.786 second using v1.01-cache-2.11-cpan-d80b1682f3f )