@@ -11,13 +11,13 @@
{issue.title}
-
+
diff --git a/src/lib/types/github.types.ts b/src/lib/types/github.types.ts
index 3d0c6c5..9dfd116 100644
--- a/src/lib/types/github.types.ts
+++ b/src/lib/types/github.types.ts
@@ -1,80 +1,24 @@
-export type User = {
+export type Owner = {
login: string;
- id: number;
- node_id: string;
- avatar_url: string;
- gravatar_id: string;
- url: string;
- html_url: string;
- followers_url: string;
- following_url: string;
- gists_url: string;
- starred_url: string;
- subscriptions_url: string;
- organizations_url: string;
- repos_url: string;
- events_url: string;
- received_events_url: string;
- type: string;
- site_admin: boolean;
};
-export type Label = {
- id: any;
- node_id: string;
- url: string;
+export type Repository = {
name: string;
- color: string;
- default: boolean;
- description: string;
-};
-
-export type Reactions = {
url: string;
- total_count: number;
- '+1': number;
- '-1': number;
- laugh: number;
- hooray: number;
- confused: number;
- heart: number;
- rocket: number;
- eyes: number;
+ owner: Owner;
};
-export type Item = {
+export type Node = {
url: string;
- repository_url: string;
- labels_url: string;
- comments_url: string;
- events_url: string;
- html_url: string;
- id: number;
- node_id: string;
- number: number;
title: string;
- user: User;
- labels: Label[];
- state: string;
- locked: boolean;
- assignee?: any;
- assignees: any[];
- milestone?: any;
- comments: number;
- created_at: Date;
- updated_at: Date;
- closed_at?: any;
- author_association: string;
- active_lock_reason?: any;
- body: string;
- reactions: Reactions;
- timeline_url: string;
- performed_via_github_app?: any;
- score: number;
+ repository: Repository;
+};
+
+export type Edge = {
+ node: Node;
};
-export type IssueResponse = {
- total_count: number;
- incomplete_results: boolean;
- items: Item[];
+export type SearchResponse = {
+ issueCount: number;
+ edges: Edge[];
};
diff --git a/src/routes/api/get-issues.ts b/src/routes/api/get-issues.ts
index df7359a..31ad411 100644
--- a/src/routes/api/get-issues.ts
+++ b/src/routes/api/get-issues.ts
@@ -5,11 +5,37 @@ export const get: RequestHandler = async () => {
const token = process.env['VITE_TOKEN'];
if (!token) return { status: 500, body: { message: 'please provide a token' } };
const octokit = new Octokit({ auth: token });
- const response = await octokit.request('GET /search/issues', {
- q: 'is:issue is:open label:"good first issue" org:EddieHubCommunity no:assignee',
- });
+ const { search } = (await octokit.graphql(
+ `query EddieHubIssues($queryString: String! $skip: Int!) {
+ search(first: $skip, query: $queryString, type: ISSUE) {
+ issueCount
+ edges {
+ node {
+ ... on Issue {
+ url
+ title
+ repository {
+ name
+ url
+ owner {
+ login
+ }
+ }
+ }
+ }
+ }
+ }
+ }`,
+ {
+ queryString: 'is:open label:"good first issue" org:EddieHubCommunity no:assignee',
+ skip: 50,
+ },
+ )) as any;
+
+ console.log(JSON.stringify(search));
+
return {
status: 200,
- body: response.data,
+ body: search,
};
};
diff --git a/src/routes/index.svelte b/src/routes/index.svelte
index 59d72bf..d027351 100644
--- a/src/routes/index.svelte
+++ b/src/routes/index.svelte
@@ -8,7 +8,7 @@
const data = await res.json();
return {
props: {
- data: data as IssueResponse,
+ data: data as SearchResponse,
},
};
}
@@ -21,12 +21,12 @@
- {#each data.items as issue}
-
+ {#each data.edges as node}
+
{/each}