1Net::GitHub::V4(3) User Contributed Perl Documentation Net::GitHub::V4(3)
2
3
4
6 Net::GitHub::V4 - GitHub GraphQL API
7
9 use Net::GitHub::V4;
10 my $gh = Net::GitHub::V4->new(
11 access_token => $oauth_token
12 );
13
14 my $data = $gh->query(<<'IQL');
15 query {
16 repository(owner: "octocat", name: "Hello-World") {
17 pullRequests(last: 10) {
18 edges {
19 node {
20 number
21 mergeable
22 }
23 }
24 }
25 }
26 }
27 IQL
28
29 # mutation
30 $data = $gh->query(<<'IQL');
31 mutation AddCommentToIssue {
32 addComment(input:{subjectId:"MDU6SXNzdWUyMzA0ODQ2Mjg=", body:"A shiny new comment! :tada:"}) {
33 commentEdge {
34 cursor
35 }
36 subject {
37 id
38 }
39 timelineEdge {
40 cursor
41 }
42 }
43 }
44 IQL
45
46 # variables
47 $data = $gh->query(<<'IQL', { number_of_repos => 3 });
48 query($number_of_repos:Int!) {
49 viewer {
50 name
51 repositories(last: $number_of_repos) {
52 nodes {
53 name
54 }
55 }
56 }
57 }
58 IQL
59
61 <https://developer.github.com/v4/>
62
63 ATTRIBUTES
64 Authentication
65
66 access_token
67 my $gh = Net::GitHub::V4->new( access_token => $ENV{GITHUB_ACCESS_TOKEN} );
68
69 raw_response
70
71 my $gh = Net::GitHub::V4->new(
72 # login/pass or access_token
73 raw_response => 1
74 );
75
76 return raw HTTP::Response object
77
78 raw_string
79
80 my $gh = Net::GitHub::V4->new(
81 # login/pass or access_token
82 raw_string => 1
83 );
84
85 return HTTP::Response response content as string
86
87 api_throttle
88
89 my $gh = Net::GitHub::V4->new(
90 # login/pass or access_token
91 api_throttle => 0
92 );
93
94 To disable call rate limiting (e.g. if your account is whitelisted),
95 set api_throttle to 0.
96
97 ua
98
99 To set the proxy for ua, you can do something like following
100
101 $gh->ua->proxy('https', 'socks://127.0.0.1:9050');
102
103 $gh->ua is an instance of LWP::UserAgent
104
105 METHODS
106 query($method, $url, $data)
107
108 my $data = $gh->query(<<IQL);
109 {
110 repository(owner: "octocat", name: "Hello-World") {
111 pullRequests(last: 10) {
112 edges {
113 node {
114 number
115 mergeable
116 }
117 }
118 }
119 }
120 }
121 IQL
122
123 GitHub GraphQL API
124
126 Pithub
127
129 Refer Net::GitHub
130
131
132
133perl v5.32.0 2020-07-28 Net::GitHub::V4(3)