view release on metacpan or search on metacpan
lib/Imgur/API/Model/Comment.pod
lib/Imgur/API/Model/Conversation.pod
lib/Imgur/API/Model/Tag.pod
lib/Imgur/API/Model/Message.pod
lib/Imgur/API/Model/Topic.pod
lib/Imgur/API/Model/AccountSettings.pod
lib/Imgur/API/Response.pm
lib/Imgur/API/Endpoint.pm
lib/Imgur/API.pod
scripts/
scripts/scrape_endpoints.pl
scripts/generate_classes.pl
scripts/scrape_models.pl
scripts/generate_model_pod.pl
scripts/generate_pod.pl
data/
data/models.json
data/endpoints.json
templates/
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
data/endpoints.json view on Meta::CPAN
{
"method" : "get",
"sub" : "get",
"params" : {
"username" : {
"required" : 1,
"desc" : "Username"
}
},
"url_params" : {},
"description" : " Request standard user information. If you need the username for the account that is logged in, it is returned in the request for an access token. Note: This endpoint also supports the ability to lookup account base info by ...
"name" : "Account Base",
"url" : {
"optional" : "",
"required" : "'username'",
"base" : "3/account/%s"
}
},
{
"name" : "Account Gallery Favorites",
"url" : {
data/endpoints.json view on Meta::CPAN
"username" : {
"required" : 0,
"desc" : "A valid Imgur username (between 4 and 63 alphanumeric characters)"
},
"public_images" : {
"desc" : "Set the users images to private or public by default",
"required" : 0
},
"show_mature" : {
"required" : 0,
"desc" : "true | false - Toggle display of mature images in gallery list endpoints."
}
},
"method" : "put | post",
"sub" : "updateSettings",
"url" : {
"optional" : "",
"required" : "",
"base" : ""
},
"name" : "Change Account Settings"
data/endpoints.json view on Meta::CPAN
"url_params" : {},
"name" : "Albums",
"url" : {
"base" : "3/account/%s/albums",
"required" : "'username'",
"optional" : "'page'"
}
},
{
"url_params" : {},
"description" : " Get additional information about an album, this endpoint works the same as the Album Endpoint. You can also use any of the additional routes that are used on an album in the album endpoint. ",
"method" : "get",
"params" : {
"username" : {
"desc" : "Username",
"required" : 1
},
"account" : {
"desc" : "Account",
"required" : 1
}
data/endpoints.json view on Meta::CPAN
"params" : {
"account" : {
"desc" : "Account",
"required" : 1
},
"username" : {
"desc" : "Username",
"required" : 1
}
},
"description" : " Return information about a specific comment. This endpoint works the same as the Comment Endpoint. You can use any of the additional actions that the comment endpoint allows on this end point. ",
"url_params" : {},
"url" : {
"optional" : "",
"required" : "'username','account'",
"base" : "3/account/%s/comment/%s"
},
"name" : "Comment"
},
{
"sub" : "commentIds",
data/endpoints.json view on Meta::CPAN
},
"username" : {
"required" : 1,
"desc" : "Username"
}
},
"url_params" : {},
"description" : " Return all of the images associated with the account. You can page through the images by setting the page, this defaults to 0. "
},
{
"description" : " Return information about a specific image. This endpoint works the same as the Image Endpoint. You can use any of the additional actions that the image endpoint with this endpoint. ",
"url_params" : {},
"method" : "get",
"sub" : "image",
"params" : {
"account" : {
"desc" : "Account",
"required" : 1
},
"username" : {
"desc" : "Username",
data/endpoints.json view on Meta::CPAN
"base" : "3/gallery/%s"
},
"sub" : "toGallery",
"method" : "post | put",
"params" : {
"mature" : {
"required" : 0,
"desc" : "If the post is mature, set this value to 1."
},
"terms" : {
"desc" : "If the user has not accepted our terms yet, this endpoint will return an error. To by-pass the terms in general simply set this value to 1.",
"required" : 0
},
"title" : {
"desc" : "The title of the image. This is required.",
"required" : 1
},
"gallery" : {
"required" : 1,
"desc" : "Gallery"
},
data/models.json view on Meta::CPAN
"type" : "boolean",
"desc" : "If the user is accepting incoming messages or not"
},
{
"desc" : "An array of users that have been blocked from messaging, the object is blocked_id and blocked_url.",
"type" : "Array of objects",
"name" : "blocked_users"
},
{
"name" : "show_mature",
"desc" : "True if the user has opted to have mature images displayed in gallery list endpoints.",
"type" : "boolean"
},
{
"type" : "boolean",
"desc" : "True unless the user created their account via a third party service such as Google Plus.",
"name" : "first_party"
}
]
}
],
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
=cut
=head1 METHODS
=head2 get
=over 2
Request standard user information. If you need the username for the account that is logged in, it is returned in the request for an access token. Note: This endpoint also supports the ability to lookup account base info by account ID. To do so, pass ...
=back
B<Parameters>
=over 4
=item *
C<username> I<required>
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
true | false - Allows the user to enable / disable private messages
=item *
C<username> I<optional>
A valid Imgur username (between 4 and 63 alphanumeric characters)
=item *
C<show_mature> I<optional>
true | false - Toggle display of mature images in gallery list endpoints.
=item *
C<album_privacy> I<optional>
public | hidden | secret - Sets the default privacy level of albums the users creates
=item *
C<accepted_gallery_terms> I<optional>
true | false - The user agreement to the Imgur Gallery terms.
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
Username
=back
=head2 album
=over 2
Get additional information about an album, this endpoint works the same as the Album Endpoint. You can also use any of the additional routes that are used on an album in the album endpoint.
=back
B<Parameters>
=over 4
=item *
C<account> I<required>
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
Username
=back
=head2 comment
=over 2
Return information about a specific comment. This endpoint works the same as the Comment Endpoint. You can use any of the additional actions that the comment endpoint allows on this end point.
=back
B<Parameters>
=over 4
=item *
C<account> I<required>
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
Username
=back
=head2 image
=over 2
Return information about a specific image. This endpoint works the same as the Image Endpoint. You can use any of the additional actions that the image endpoint with this endpoint.
=back
B<Parameters>
=over 4
=item *
C<username> I<required>
lib/Imgur/API/Endpoint/Account.pod view on Meta::CPAN
Username
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/account
=back
=cut
lib/Imgur/API/Endpoint/Album.pod view on Meta::CPAN
Album
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/album
=back
=cut
lib/Imgur/API/Endpoint/Comment.pod view on Meta::CPAN
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/comment
=back
=cut
lib/Imgur/API/Endpoint/Conversation.pod view on Meta::CPAN
Additional offset in current page, defaults to 0.
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/conversation
=back
=cut
lib/Imgur/API/Endpoint/Custom_gallery.pod view on Meta::CPAN
Array of tags (e.g. 'cats,dogs')
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/custom_gallery
=back
=cut
lib/Imgur/API/Endpoint/Gallery.pod view on Meta::CPAN
The name of the tags you wish to associate with a post. Can be passed as tags[]=funny&tags[]=cat or tags=funny,cat
=item *
C<mature> I<optional>
If the post is mature, set this value to 1.
=item *
C<terms> I<optional>
If the user has not accepted our terms yet, this endpoint will return an error. To by-pass the terms in general simply set this value to 1.
=item *
C<gallery> I<required>
Gallery
=back
lib/Imgur/API/Endpoint/Gallery.pod view on Meta::CPAN
Gallery
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/gallery
=back
=cut
lib/Imgur/API/Endpoint/Image.pod view on Meta::CPAN
Image
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/image
=back
=cut
lib/Imgur/API/Endpoint/Memegen.pod view on Meta::CPAN
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/memegen
=back
=cut
lib/Imgur/API/Endpoint/Notification.pod view on Meta::CPAN
Notification
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/notification
=back
=cut
lib/Imgur/API/Endpoint/Topic.pod view on Meta::CPAN
The ID or URL-formatted name of the topic. If using a topic's name, replace its spaces with underscores (Mother's_Day).
=back
=head1 SEE ALSO
=over 4
https://api.imgur.com/endpoints/topic
=back
=cut
lib/Imgur/API/Model/AccountSettings.pod view on Meta::CPAN
An array of users that have been blocked from messaging, the object is blocked_id and blocked_url.
=back
=item
C<show_mature I<boolean>>
=over 4
True if the user has opted to have mature images displayed in gallery list endpoints.
=back
=item
C<first_party I<boolean>>
=over 4
True unless the user created their account via a third party service such as Google Plus.
scripts/generate_classes.pl view on Meta::CPAN
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
foreach my $endpoint (keys %$data) {
say $endpoint;
my $stash = {name=>$endpoint,methods=>$data->{$endpoint}};
#process_template("templates/class_template.tt","lib/Imgur/API/Endpoint/$endpoint.pm",$stash);
process_template("templates/pod_template.tt","lib/Imgur/API/Endpoint/$endpoint.pod",$stash);
}
sub process_template {
my ($template,$output,$stash) = @_;
my $out = '';
$tt->process($template,$stash,\$out);
open(FO,">",$output);
print FO $out;
scripts/generate_pod.pl view on Meta::CPAN
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
foreach my $endpoint (keys %$data) {
say $endpoint;
my $stash = {name=>$endpoint,methods=>$data->{$endpoint}};
process_template("templates/pod_template.tt","lib/Imgur/API/Endpoint/$endpoint.pod",$stash);
}
sub process_template {
my ($template,$output,$stash) = @_;
my $out = '';
$tt->process($template,$stash,\$out);
open(FO,">",$output) || die;
scripts/scrape_endpoints.pl view on Meta::CPAN
use URI;
use Data::Dumper;
use JSON::XS;
use HTML::TreeBuilder::LibXML;
use LWP::UserAgent;
use HTTP::Message;
use Template;
my $template = Template->new();
my @endpoints = qw(account album comment custom_gallery gallery image conversation notification memegen topic);
my $api = {};
my $uri_skip = length("https://api.imgur.com");
foreach my $ep (@endpoints) {
my $endpoint = ucfirst($ep);
my $tree = get_page("https://api.imgur.com/endpoints/$ep");
my @options;
$api->{$endpoint} = [];
say STDERR "Endpoint: $endpoint";
foreach my $command ($tree->look_down(_tag=>"div",class=>"textbox",sub {defined $_[0]->attr('id') && $_[0]->attr('id') ne "current";})) {
my $details = {
name=>($command->find("h2"))[0]->as_text,
description=>($command->find("p"))[0]->as_text,
params=>{},
url_params=>{},
};
my $id = $command->attr("id");
scripts/scrape_endpoints.pl view on Meta::CPAN
push(@urlparams_opt,$p);
}
}
}
}
$details->{url} = {
base=>join("/",@finalparts),
required=>join(",",map {qq('$_')} @urlparams),
optional=>join(",",map {qq('$_')} @urlparams_opt),
};
push(@{$api->{$endpoint}},$details);
}
}
my $json = JSON::XS->new->pretty;
say $json->encode($api);
sub get_page {
my ($url) = @_;