Skip to content

Commit d278d45

Browse files
committed
Move ListIssues test to graphql format & removal of temp file
1 parent eb4945e commit d278d45

File tree

4 files changed

+260
-371
lines changed

4 files changed

+260
-371
lines changed

pkg/github/__toolsnaps__/list_issues.snap

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
"title": "List issues",
44
"readOnlyHint": true
55
},
6-
"description": "List issues in a GitHub repository.",
6+
"description": "List issues in a GitHub repository. For pagination, use the 'endCursor' from the previous response's 'pageInfo' in the 'after' parameter.",
77
"inputSchema": {
88
"properties": {
9+
"after": {
10+
"description": "Cursor for pagination. Use the endCursor from the previous page's PageInfo for GraphQL APIs.",
11+
"type": "string"
12+
},
913
"direction": {
10-
"description": "Sort direction",
14+
"description": "Order direction. If provided, the 'orderBy' also needs to be provided.",
1115
"enum": [
12-
"asc",
13-
"desc"
16+
"ASC",
17+
"DESC"
1418
],
1519
"type": "string"
1620
},
@@ -21,15 +25,18 @@
2125
},
2226
"type": "array"
2327
},
28+
"orderBy": {
29+
"description": "Order issues by field. If provided, the 'direction' also needs to be provided.",
30+
"enum": [
31+
"CREATED_AT",
32+
"UPDATED_AT"
33+
],
34+
"type": "string"
35+
},
2436
"owner": {
2537
"description": "Repository owner",
2638
"type": "string"
2739
},
28-
"page": {
29-
"description": "Page number for pagination (min 1)",
30-
"minimum": 1,
31-
"type": "number"
32-
},
3340
"perPage": {
3441
"description": "Results per page for pagination (min 1, max 100)",
3542
"maximum": 100,
@@ -44,21 +51,11 @@
4451
"description": "Filter by date (ISO 8601 timestamp)",
4552
"type": "string"
4653
},
47-
"sort": {
48-
"description": "Sort order",
49-
"enum": [
50-
"created",
51-
"updated",
52-
"comments"
53-
],
54-
"type": "string"
55-
},
5654
"state": {
5755
"description": "Filter by state",
5856
"enum": [
59-
"open",
60-
"closed",
61-
"all"
57+
"OPEN",
58+
"CLOSED"
6259
],
6360
"type": "string"
6461
}

pkg/github/issues.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ type IssueQueryFragment struct {
5656
TotalCount int
5757
}
5858

59-
// ListIssuesQueryNoLabels is the query structure for fetching issues without label filtering.
59+
// ListIssuesQuery is the root query structure for fetching issues with optional label filtering.
6060
type ListIssuesQuery struct {
6161
Repository struct {
6262
Issues IssueQueryFragment `graphql:"issues(first: $first, after: $after, states: $states, orderBy: {field: $orderBy, direction: $direction})"`
6363
} `graphql:"repository(owner: $owner, name: $repo)"`
6464
}
6565

66-
// ListIssuesQuery is the root query structure for fetching issues with optional label filtering.
66+
// ListIssuesQueryTypeWithLabels is the query structure for fetching issues with optional label filtering.
6767
type ListIssuesQueryTypeWithLabels struct {
6868
Repository struct {
6969
Issues IssueQueryFragment `graphql:"issues(first: $first, after: $after, labels: $labels, states: $states, orderBy: {field: $orderBy, direction: $direction})"`

0 commit comments

Comments
 (0)