- Notifications
You must be signed in to change notification settings - Fork 279
refactor(api): use graphql api for issue and pull request enrichment #2468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors issue and pull request enrichment to use GitHub's GraphQL API instead of multiple REST API calls, following the same pattern previously established for discussion enrichment. The changes simplify type definitions, reduce API calls, and improve test accuracy by using GraphQL response structures.
Key Changes
- Migrated issue and pull request enrichment from REST API to GraphQL API, reducing multiple API calls to single GraphQL queries
- Consolidated type definitions by moving GitifySubject and related types from typesGitHub.ts to types.ts and leveraging GraphQL-generated types
- Standardized state representations from lowercase strings (e.g., 'open', 'closed') to uppercase enums (e.g., 'OPEN', 'CLOSED') to align with GraphQL schema
Reviewed changes
Copilot reviewed 47 out of 49 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/types.ts | Added Gitify notification types including GitifySubject, GitifyNotificationState, and related type unions using GraphQL-generated types |
| src/renderer/typesGitHub.ts | Removed custom type definitions that are now handled by GraphQL types or moved to types.ts |
| src/renderer/utils/api/client.ts | Removed REST API functions for issues and PRs, added GraphQL fetch functions fetchIssueByNumber and fetchPullByNumber |
| src/renderer/utils/api/graphql/*.graphql | Added issue.graphql and pull.graphql queries, extracted common AuthorFields fragment to common.graphql |
| src/renderer/utils/notifications/handlers/issue.ts | Refactored to use GraphQL API, simplified enrichment logic, added defaultUrl method |
| src/renderer/utils/notifications/handlers/pullRequest.ts | Refactored to use GraphQL API, simplified review aggregation, added defaultUrl method |
| src/renderer/utils/notifications/handlers/*.ts | Updated other handlers to use new types, add defaultUrl methods, and use getNotificationAuthor helper |
| src/renderer/utils/notifications/handlers/utils.ts | Renamed getSubjectUser to getNotificationAuthor for clarity |
| src/renderer/utils/helpers.ts | Simplified generateGitHubWebUrl to use handler's defaultUrl method and prefer subject.htmlUrl when available |
| src/renderer/utils/notifications/filters/state.ts | Updated state filter arrays to use uppercase enum values |
| **/*.test.ts | Updated tests to use GraphQL response structures and uppercase state values |
| codegen.ts | Added enumsAsTypes config to generate TypeScript union types instead of enums |
…ify-app/gitify into refactor/fetch-issue-graphql
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 47 out of 49 changed files in this pull request and generated 1 comment.
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 47 out of 49 changed files in this pull request and generated no new comments.
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
|




Continuing from the refactoring of Discussions enrichment via GraphQL, this PR brings the same goodness but for Issues and Pull Requests.
Along the way we've been able to simplify custom handcrafted types, improve test cases to resemble actual responses, simplify enrichment logic and importantly reduce API calls