---
name: "Net::GitHub::V4"
section: "3pm"
platform: "linux"
package: "libnet-github-perl"
version: "1.05-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Net::GitHub::V4"
---

# Net::GitHub::V4(3pm)

GitHub GraphQL API

## NAME

Net::GitHub::V4 - GitHub GraphQL API

## SYNOPSIS

```
    use Net::GitHub::V4;
    my $gh = Net::GitHub::V4->new(
        access_token => $oauth_token
    );
    my $data = $gh->query(<<'IQL');
query {
  repository(owner: "octocat", name: "Hello-World") {
    pullRequests(last: 10) {
      edges {
        node {
          number
          mergeable
        }
      }
    }
  }
}
IQL
    # mutation
    $data = $gh->query(<<'IQL');
mutation AddCommentToIssue {
  addComment(input:{subjectId:"MDU6SXNzdWUyMzA0ODQ2Mjg=", body:"A shiny new comment! :tada:"}) {
    commentEdge {
      cursor
    }
    subject {
      id
    }
    timelineEdge {
      cursor
    }
  }
}
IQL
    # variables
    $data = $gh->query(<<'IQL', { number_of_repos => 3 });
query($number_of_repos:Int!) {
  viewer {
    name
     repositories(last: $number_of_repos) {
       nodes {
         name
       }
     }
   }
}
IQL
```

## DESCRIPTION

\<https://developer.github.com/v4/\>

### ATTRIBUTES

*Authentication*

- access\_token

  ```
      my $gh = Net::GitHub::V4->new( access_token => $ENV{GITHUB_ACCESS_TOKEN} );
  ```

*raw\_response*

```
    my $gh = Net::GitHub::V4->new(
        # login/pass or access_token
        raw_response => 1
    );
```

return raw HTTP::Response object

*raw\_string*

```
    my $gh = Net::GitHub::V4->new(
        # login/pass or access_token
        raw_string => 1
    );
```

return HTTP::Response response content as string

*api\_throttle*

```
    my $gh = Net::GitHub::V4->new(
        # login/pass or access_token
        api_throttle => 0
    );
```

To disable call rate limiting (e.g. if your account is whitelisted), set **api\_throttle** to 0.

*ua*

To set the proxy for ua, you can do something like following

```
    $gh->ua->proxy('https', 'socks://127.0.0.1:9050');
```

`$gh`-\>ua is an instance of LWP::UserAgent

### METHODS

*query($method, $url, $data)*

```
    my $data = $gh->query(<<IQL);
{
  repository(owner: "octocat", name: "Hello-World") {
    pullRequests(last: 10) {
      edges {
        node {
          number
          mergeable
        }
      }
    }
  }
}
IQL
```

GitHub GraphQL API

## SEE ALSO

Pithub

## AUTHOR & COPYRIGHT & LICENSE

Refer Net::GitHub
