Net::Async::Github - support for https://github.com's REST API with IO::Async
version 0.001
use IO::Async::Loop; use Net::Async::Github; my $loop = IO::Async::Loop->new; $loop->add( my $gh = Net::Async::Github->new( token => '...', ) );
This is a basic wrapper for Github's API.
Returns information about the current user.
my $user = $gh->current_user->get; printf "User [%s] has %d public repos and was last updated on %s%s\n", $user->login, $user->public_repos, $user->updated_at->to_string
Resolves to a Net::Async::Github::User instance.
Accepts the following optional named parameters:
token - the Github API token
token
endpoints - hashref of RFC6570-compliant URL mappings
endpoints
http - an HTTP client compatible with the Net::Async::HTTP API
http
mime_type - the MIME type to use as the Accept header for requests
mime_type
Accept
page_cache_size - number of GET responses to cache. Defaults to 1000, set to 0 to disable.
page_cache_size
You probably just want token, defaults should be fine for the other settings.
If you're creating a large number of instances, you can avoid some disk access overhead by passing endpoints from an existing instance to the constructor for a new instance.
Reopens the given PR.
Expects the following named parameters:
owner - which user or organisation owns this PR
repo - which repo it's for
id - the pull request ID
Resolves to the current status.
Returns information about the given PR.
Returns information about the given user.
Iterates through all users. This is a good way to exhaust your 5000-query ratelimiting quota.
Identifies the head version for this branch.
Requires the following named parameters:
owner - which organisation or person owns the repo
repo - the repository name
branch - which branch to check
Returns a Net::Async::Github::RateLimit::Core instance which can track rate limits.
The following methods are used internally. They're not expected to be useful for external callers.
Returns an accessor for the endpoints data. This is a hashref containing URI templates, used by "endpoint".
Expands the selected URI via URI::Template. Each item is defined in our endpoints.json file.
endpoints.json
Returns a URI instance.
Accessor for the HTTP client object. Will load and instantiate a Net::Async::HTTP instance if necessary.
Actual HTTP implementation is not guaranteed, and the default is likely to change in future.
Returns authentication information used in the HTTP request.
Returns the MIME type used for requests. Currently defined by github in https://developer.github.com/v3/media/ as application/vnd.github.v3+json.
application/vnd.github.v3+json
The URI for requests. Defaults to https://api.github.com.
Performs an HTTP GET request.
A list of all pending requests.
Applies validation rules from git-check-ref-format for a branch name.
Will raise an exception on invalid input.
Applies github rules for user/organisation name.
Applies github rules for repository name.
Convenience method to apply validation on common parameters.
Returns the total number of GET responses we'll cache. Default is probably 1000.
The page cache instance, likely to be provided by Cache::LRU.
Our Ryu::Async instance, used for instantiating Ryu::Source instances.
add_child, adopt_future, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent
Tom Molesworth <TEAM@cpan.org>
Copyright Tom Molesworth 2014-2017. Licensed under the same terms as Perl itself.
To install Net::Async::Github, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Github
CPAN shell
perl -MCPAN -e shell install Net::Async::Github
For more information on module installation, please visit the detailed CPAN module installation guide.