NAME¶
Pithub - Github v3 API
VERSION¶
version 0.01025
SYNOPSIS¶
use Pithub;
use Data::Dumper;
my $p = Pithub->new;
my $result = $p->repos->get( user => 'plu', repo => 'Pithub' );
# $result->content is either an arrayref or an hashref
# depending on the API call that has been made
printf "%s\n", $result->content->{html_url}; # prints https://github.com/plu/Pithub
printf "%s\n", $result->content->{clone_url}; # prints https://github.com/plu/Pithub.git
# if the result is an arrayref, you can use the result iterator
my $result = $p->repos->list( user => 'plu' );
while ( my $row = $result->next ) {
printf "%s\n", $row->{name};
}
DESCRIPTION¶
Pithub provides a set of modules to access the Github v3 API
<
http://developer.github.com/v3/> in an object oriented way. There is
also Net::GitHub which does the same for all the versions (v1, v2, v3) of the
Github API. Pithub supports all API calls so far, but only for v3.
METHODS¶
events¶
Provides access to Pithub::Events.
gists¶
Provides access to Pithub::Gists.
git_data¶
Provides access to Pithub::GitData.
issues¶
Provides access to Pithub::Issues.
orgs¶
Provides access to Pithub::Orgs.
pull_requests¶
Provides access to Pithub::PullRequests.
repos¶
Provides access to Pithub::Repos.
search¶
Provides access to Pithub::Search.
users¶
Provides access to Pithub::Users.
DOCUMENTATION¶
Quite a lot of the Pithub documentation has been taken directly from the great
API documentation at Github <
http://developer.github.com/v3/>. Please
also read the documentation there, since it might be more complete and more
up-to-date.
WARNING¶
Pithub as well as the Github v3 API <
http://developer.github.com/v3/> are
still under development. So there might be things broken on both sides.
Besides that it's possible that the API will change. This applies to Pithub
itself as well as the Github v3 API <
http://developer.github.com/v3/>.
CONTRIBUTE¶
This module is hosted on Github <
https://github.com/plu/Pithub>, so feel
free to fork it and send pull requests. There are two different kinds of test
suites, one is just checking the HTTP requests that are created by the method
calls, without actually sending them. The second one is sending real requests
to the Github API. If you want to contribute to this project, I highly
recommend to run the live tests on a test account, because it will generate a
lof of activity.
MODULES¶
There are different ways of using the Pithub library. You can either use the
main module Pithub to get access to all other modules, like Pithub::Repos for
example. Or you can use Pithub::Repos directly and create an instance of it.
All modules accept the same attributes, either in the constructor or later by
calling the setters.
Besides that there are other modules involved. Every method call which maps
directly to a Github API call returns a Pithub::Result object. This contains
everything interesting about the response returned from the API call.
Pithub::Base might be interesting for two reasons:
- •
- The list of attributes which all modules accept.
- •
- The request method: In case Github adds a new API call which is not
supported yet by Pithub the request method can be used directly to perform
this new API call, there's some documentation on how to use it.
- •
- Pithub::PullRequests
See also: <http://developer.github.com/v3/pulls/>
my $pull_requests = Pithub->new->pull_requests;
my $pull_requests = Pithub::PullRequests->new;
- •
- Pithub::PullRequests::Comments
See also: <http://developer.github.com/v3/pulls/comments/>
my $comments = Pithub->new->pull_requests->comments;
my $comments = Pithub::PullRequests->new->comments;
my $comments = Pithub::PullRequests::Comments->new;
- •
- Pithub::Repos
See also: <http://developer.github.com/v3/repos/>
my $repos = Pithub->new->repos;
my $repos = Pithub::Repos->new;
- •
- Pithub::Repos::Collaborators
See also: <http://developer.github.com/v3/repos/collaborators/>
my $collaborators = Pithub->new->repos->collaborators;
my $collaborators = Pithub::Repos->new->collaborators;
my $collaborators = Pithub::Repos::Collaborators->new;
- •
- Pithub::Repos::Commits
See also: <http://developer.github.com/v3/repos/commits/>
my $commits = Pithub->new->repos->commits;
my $commits = Pithub::Repos->new->commits;
my $commits = Pithub::Repos::Commits->new;
- •
- Pithub::Repos::Contents
See also: <http://developer.github.com/v3/repos/contents/>
my $contents = Pithub->new->repos->contents;
my $contents = Pithub::Repos->new->contents;
my $contents = Pithub::Repos::Contents->new;
- •
- Pithub::Repos::Downloads
Github says: The Downloads API (described below) was deprecated on December
11, 2012. It will be removed at a future date. We recommend using
Pithub::Repos::Releases instead.
See also: <http://developer.github.com/v3/repos/downloads/>
my $downloads = Pithub->new->repos->downloads;
my $downloads = Pithub::Repos->new->downloads;
my $downloads = Pithub::Repos::Downloads->new;
- •
- Pithub::Repos::Forks
See also: <http://developer.github.com/v3/repos/forks/>
my $forks = Pithub->new->repos->forks;
my $forks = Pithub::Repos->new->forks;
my $forks = Pithub::Repos::Forks->new;
- •
- Pithub::Repos::Keys
See also: <http://developer.github.com/v3/repos/keys/>
my $keys = Pithub->new->repos->keys;
my $keys = Pithub::Repos->new->keys;
my $keys = Pithub::Repos::Keys->new;
- •
- Pithub::Repos::Releases
See also: <http://developer.github.com/v3/repos/releases/>
my $releases = Pithub->new->repos->releases;
my $releases = Pithub::Repos->new->releases;
my $releases = Pithub::Repos::Releases->new;
- •
- Pithub::Repos::Releases::Assets
See also: <http://developer.github.com/v3/repos/releases/>
my $assets = Pithub->new->repos->releases->assets;
my $assets = Pithub::Repos->new->releases->assets;
my $assets = Pithub::Repos::Releases->new->assets;
my $assets = Pithub::Repos::Releases::Assets->new;
- •
- Pithub::Repos::Stats
See also: <http://developer.github.com/v3/repos/statistics/>
my $watching = Pithub->new->repos->stats;
my $watching = Pithub::Repos->new->stats;
my $watching = Pithub::Repos::Stats->new;
- •
- Pithub::Repos::Statuses
See also: <http://developer.github.com/v3/repos/statuses/>
my $watching = Pithub->new->repos->statuses;
my $watching = Pithub::Repos->new->statuses;
my $watching = Pithub::Repos::Statuses->new;
- •
- Pithub::Repos::Watching
See also: <http://developer.github.com/v3/repos/watching/>
my $watching = Pithub->new->repos->watching;
my $watching = Pithub::Repos->new->watching;
my $watching = Pithub::Repos::Watching->new;
CONTRIBUTORS¶
- •
- Andreas Marienborg
- •
- Alessandro Ghedini
AUTHOR¶
Johannes Plunien <plu@cpan.org>
COPYRIGHT AND LICENSE¶
This software is copyright (c) 2011 by Johannes Plunien.
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.