Help language development. Donate to The Perl Foundation

WebService::GitHub zef:raku-community-modules last updated on 2022-06-10
# WebService-GitHub

A wrapper for the GitHub REST API.


    use WebService::GitHub;

    my $gh =
        access-token => 'my-access-token'

    my $res = $gh.request('/user');
    say $;


Patches welcome

 * Handle Errors
 * Auto Pagination
 * API Throttle

## Setup

### Authentication

One can order the library to authenticate using one of three different ways.
Depending on which way you choose you need to pass a different set of arguments
to the constructor:

 * `auth_login` & `auth_token`
   OAuth token authenticaation.

 * `pat`
   Personal Access Token authentication.

 * `app-auth` and `install-id`
   Application authentication. First construct a `WebService::GitHub::AppAuth`
   passing a `pem-file` or a `pem` string to its constructor. then pass it
   as `app-auth` to the `WebService::GitHub` constructor.

### Other constructor arguments

 * `endpoint`
   Useful for GitHub Enterprise. Default to

 * `per_page`
   from [Doc](, default to 30, max to 100.

 * `jsonp_callback`
   [JSONP Callback](

 * `time-zone`
   UTC by default, [Doc](

 * `with`
   Builds the object with a particular role

   my $gh =
       with => ('Debug')

### Response

 * `is-success`
   Did it succeed?

 * `raw`
   HTTP::Response instance

 * `data`
   JSON decoded data

 * `header(Str $field)`
   Get header of HTTP Response

 * `first-page-url`, `prev-page-url`, `next-page-url`, `last-page-url`
   Parsed from the Link header, [Doc](

 * `x-ratelimit-limit`, `x-ratelimit-remaining`, `x-ratelimit-reset`
   [Rate Limit](