@@ -6,11 +6,16 @@ import (
66)
77
88type PullRequestsPayload struct {
9- ViewerCreated [] PullRequest
10- ReviewRequested [] PullRequest
9+ ViewerCreated PullRequestAndTotalCount
10+ ReviewRequested PullRequestAndTotalCount
1111 CurrentPR * PullRequest
1212}
1313
14+ type PullRequestAndTotalCount struct {
15+ TotalCount int
16+ PullRequests []PullRequest
17+ }
18+
1419type PullRequest struct {
1520 Number int
1621 Title string
@@ -123,7 +128,8 @@ type Repo interface {
123128
124129func PullRequests (client * Client , ghRepo Repo , currentPRNumber int , currentPRHeadRef , currentUsername string ) (* PullRequestsPayload , error ) {
125130 type edges struct {
126- Edges []struct {
131+ TotalCount int
132+ Edges []struct {
127133 Node PullRequest
128134 }
129135 }
@@ -177,6 +183,7 @@ func PullRequests(client *Client, ghRepo Repo, currentPRNumber int, currentPRHea
177183 query($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
178184 repository(owner: $owner, name: $repo) {
179185 pullRequests(headRefName: $headRefName, states: OPEN, first: $per_page) {
186+ totalCount
180187 edges {
181188 node {
182189 ...prWithReviews
@@ -198,13 +205,15 @@ func PullRequests(client *Client, ghRepo Repo, currentPRNumber int, currentPRHea
198205
199206 query := fragments + queryPrefix + `
200207 viewerCreated: search(query: $viewerQuery, type: ISSUE, first: $per_page) {
208+ totalCount: issueCount
201209 edges {
202210 node {
203211 ...prWithReviews
204212 }
205213 }
206214 }
207215 reviewRequested: search(query: $reviewerQuery, type: ISSUE, first: $per_page) {
216+ totalCount: issueCount
208217 edges {
209218 node {
210219 ...pr
@@ -260,9 +269,15 @@ func PullRequests(client *Client, ghRepo Repo, currentPRNumber int, currentPRHea
260269 }
261270
262271 payload := PullRequestsPayload {
263- viewerCreated ,
264- reviewRequested ,
265- currentPR ,
272+ ViewerCreated : PullRequestAndTotalCount {
273+ PullRequests : viewerCreated ,
274+ TotalCount : resp .ViewerCreated .TotalCount ,
275+ },
276+ ReviewRequested : PullRequestAndTotalCount {
277+ PullRequests : reviewRequested ,
278+ TotalCount : resp .ReviewRequested .TotalCount ,
279+ },
280+ CurrentPR : currentPR ,
266281 }
267282
268283 return & payload , nil
0 commit comments