NAME
Net::GitHub::V4 - GitHub GraphQL API
SYNOPSIS
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
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 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
AUTHOR & COPYRIGHT & LICENSE
Refer Net::GitHub