3030 "discussions" : map [string ]any {
3131 "nodes" : discussionsAll ,
3232 "pageInfo" : map [string ]any {
33- "hasNextPage" : false ,
34- "endCursor" : "" ,
33+ "hasNextPage" : false ,
34+ "hasPreviousPage" : false ,
35+ "startCursor" : "" ,
36+ "endCursor" : "" ,
3537 },
38+ "totalCount" : 3 ,
3639 },
3740 },
3841 })
4144 "discussions" : map [string ]any {
4245 "nodes" : discussionsGeneral ,
4346 "pageInfo" : map [string ]any {
44- "hasNextPage" : false ,
45- "endCursor" : "" ,
47+ "hasNextPage" : false ,
48+ "hasPreviousPage" : false ,
49+ "startCursor" : "" ,
50+ "endCursor" : "" ,
4651 },
52+ "totalCount" : 2 ,
4753 },
4854 },
4955 })
@@ -61,9 +67,9 @@ func Test_ListDiscussions(t *testing.T) {
6167 assert .ElementsMatch (t , toolDef .InputSchema .Required , []string {"owner" , "repo" })
6268
6369 // Use exact string queries that match implementation output (from error messages)
64- qDiscussions := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,endCursor}}}}"
70+ qDiscussions := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
6571
66- qDiscussionsFiltered := "query($after:String$categoryId:ID!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after, categoryId: $categoryId){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,endCursor}}}}"
72+ qDiscussionsFiltered := "query($after:String$categoryId:ID!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussions(first: $first, after: $after, categoryId: $categoryId){nodes{number,title,createdAt,category{name},url},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
6773
6874 // Variables matching what GraphQL receives after JSON marshaling/unmarshaling
6975 varsListAll := map [string ]interface {}{
@@ -161,9 +167,12 @@ func Test_ListDiscussions(t *testing.T) {
161167 var response struct {
162168 Discussions []* github.Discussion `json:"discussions"`
163169 PageInfo struct {
164- HasNextPage bool `json:"hasNextPage"`
165- EndCursor string `json:"endCursor"`
170+ HasNextPage bool `json:"hasNextPage"`
171+ HasPreviousPage bool `json:"hasPreviousPage"`
172+ StartCursor string `json:"startCursor"`
173+ EndCursor string `json:"endCursor"`
166174 } `json:"pageInfo"`
175+ TotalCount int `json:"totalCount"`
167176 }
168177 err = json .Unmarshal ([]byte (text ), & response )
169178 require .NoError (t , err )
@@ -275,7 +284,7 @@ func Test_GetDiscussionComments(t *testing.T) {
275284 assert .ElementsMatch (t , toolDef .InputSchema .Required , []string {"owner" , "repo" , "discussionNumber" })
276285
277286 // Use exact string query that matches implementation output
278- qGetComments := "query($after:String$discussionNumber:Int!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){comments(first: $first, after: $after){nodes{body},pageInfo{hasNextPage,endCursor}}}}}"
287+ qGetComments := "query($after:String$discussionNumber:Int!$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){comments(first: $first, after: $after){nodes{body},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}}"
279288
280289 // Variables matching what GraphQL receives after JSON marshaling/unmarshaling
281290 vars := map [string ]interface {}{
@@ -295,9 +304,12 @@ func Test_GetDiscussionComments(t *testing.T) {
295304 {"body" : "This is the second comment" },
296305 },
297306 "pageInfo" : map [string ]any {
298- "hasNextPage" : false ,
299- "endCursor" : "" ,
307+ "hasNextPage" : false ,
308+ "hasPreviousPage" : false ,
309+ "startCursor" : "" ,
310+ "endCursor" : "" ,
300311 },
312+ "totalCount" : 2 ,
301313 },
302314 },
303315 },
@@ -323,9 +335,12 @@ func Test_GetDiscussionComments(t *testing.T) {
323335 var response struct {
324336 Comments []* github.IssueComment `json:"comments"`
325337 PageInfo struct {
326- HasNextPage bool `json:"hasNextPage"`
327- EndCursor string `json:"endCursor"`
338+ HasNextPage bool `json:"hasNextPage"`
339+ HasPreviousPage bool `json:"hasPreviousPage"`
340+ StartCursor string `json:"startCursor"`
341+ EndCursor string `json:"endCursor"`
328342 } `json:"pageInfo"`
343+ TotalCount int `json:"totalCount"`
329344 }
330345 err = json .Unmarshal ([]byte (textContent .Text ), & response )
331346 require .NoError (t , err )
@@ -338,7 +353,7 @@ func Test_GetDiscussionComments(t *testing.T) {
338353
339354func Test_ListDiscussionCategories (t * testing.T ) {
340355 // Use exact string query that matches implementation output
341- qListCategories := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussionCategories(first: $first, after: $after){nodes{id,name},pageInfo{hasNextPage,endCursor}}}}"
356+ qListCategories := "query($after:String$first:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussionCategories(first: $first, after: $after){nodes{id,name},pageInfo{hasNextPage,hasPreviousPage,startCursor, endCursor},totalCount }}}"
342357
343358 // Variables matching what GraphQL receives after JSON marshaling/unmarshaling
344359 vars := map [string ]interface {}{
@@ -356,9 +371,12 @@ func Test_ListDiscussionCategories(t *testing.T) {
356371 {"id" : "456" , "name" : "CategoryTwo" },
357372 },
358373 "pageInfo" : map [string ]any {
359- "hasNextPage" : false ,
360- "endCursor" : "" ,
374+ "hasNextPage" : false ,
375+ "hasPreviousPage" : false ,
376+ "startCursor" : "" ,
377+ "endCursor" : "" ,
361378 },
379+ "totalCount" : 2 ,
362380 },
363381 },
364382 })
@@ -385,9 +403,12 @@ func Test_ListDiscussionCategories(t *testing.T) {
385403 var response struct {
386404 Categories []map [string ]string `json:"categories"`
387405 PageInfo struct {
388- HasNextPage bool `json:"hasNextPage"`
389- EndCursor string `json:"endCursor"`
406+ HasNextPage bool `json:"hasNextPage"`
407+ HasPreviousPage bool `json:"hasPreviousPage"`
408+ StartCursor string `json:"startCursor"`
409+ EndCursor string `json:"endCursor"`
390410 } `json:"pageInfo"`
411+ TotalCount int `json:"totalCount"`
391412 }
392413 require .NoError (t , json .Unmarshal ([]byte (text ), & response ))
393414 assert .Len (t , response .Categories , 2 )
0 commit comments