types.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Types for GitHub GraphQL query responses
  2. export type GitHubAuthor = {
  3. login: string;
  4. name?: string;
  5. };
  6. export type GitHubComment = {
  7. id: string;
  8. databaseId: string;
  9. body: string;
  10. author: GitHubAuthor;
  11. createdAt: string;
  12. };
  13. export type GitHubReviewComment = GitHubComment & {
  14. path: string;
  15. line: number | null;
  16. };
  17. export type GitHubCommit = {
  18. oid: string;
  19. message: string;
  20. author: {
  21. name: string;
  22. email: string;
  23. };
  24. };
  25. export type GitHubFile = {
  26. path: string;
  27. additions: number;
  28. deletions: number;
  29. changeType: string;
  30. };
  31. export type GitHubReview = {
  32. id: string;
  33. databaseId: string;
  34. author: GitHubAuthor;
  35. body: string;
  36. state: string;
  37. submittedAt: string;
  38. comments: {
  39. nodes: GitHubReviewComment[];
  40. };
  41. };
  42. export type GitHubPullRequest = {
  43. title: string;
  44. body: string;
  45. author: GitHubAuthor;
  46. baseRefName: string;
  47. headRefName: string;
  48. headRefOid: string;
  49. createdAt: string;
  50. additions: number;
  51. deletions: number;
  52. state: string;
  53. baseRepository: {
  54. nameWithOwner: string;
  55. };
  56. headRepository: {
  57. nameWithOwner: string;
  58. };
  59. commits: {
  60. totalCount: number;
  61. nodes: Array<{
  62. commit: GitHubCommit;
  63. }>;
  64. };
  65. files: {
  66. nodes: GitHubFile[];
  67. };
  68. comments: {
  69. nodes: GitHubComment[];
  70. };
  71. reviews: {
  72. nodes: GitHubReview[];
  73. };
  74. };
  75. export type GitHubIssue = {
  76. title: string;
  77. body: string;
  78. author: GitHubAuthor;
  79. createdAt: string;
  80. state: string;
  81. comments: {
  82. nodes: GitHubComment[];
  83. };
  84. };
  85. export type PullRequestQueryResponse = {
  86. repository: {
  87. pullRequest: GitHubPullRequest;
  88. };
  89. };
  90. export type IssueQueryResponse = {
  91. repository: {
  92. issue: GitHubIssue;
  93. };
  94. };