From 93b9be93b449182fad7ea7b4b5b535108f6b0fd0 Mon Sep 17 00:00:00 2001 From: studio-pro Date: Sun, 15 Sep 2024 19:28:36 +0900 Subject: [PATCH 1/4] Create kakasoo directory --- kakasoo/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 kakasoo/.gitkeep diff --git a/kakasoo/.gitkeep b/kakasoo/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d From 8b27d523230550ba02b27537f6567c701e6265ad Mon Sep 17 00:00:00 2001 From: studio-pro Date: Sun, 15 Sep 2024 19:31:46 +0900 Subject: [PATCH 2/4] Add GitHub API SDK function for fetching user repositories --- kakasoo/githubApiSdk.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 kakasoo/githubApiSdk.js diff --git a/kakasoo/githubApiSdk.js b/kakasoo/githubApiSdk.js new file mode 100644 index 00000000000..efc63ddc1b8 --- /dev/null +++ b/kakasoo/githubApiSdk.js @@ -0,0 +1,24 @@ +import axios from 'axios'; + +// GitHub API 기본 설정 +const GITHUB_API_BASE_URL = 'https://api.github.com'; +const TOKEN = 'YOUR_PERSONAL_ACCESS_TOKEN'; // personal access token을 여기에 삽입 + +// axios 인스턴스 생성 +const api = axios.create({ + baseURL: GITHUB_API_BASE_URL, + headers: { + Authorization: `Bearer ${TOKEN}` + } +}); + +// 사용자 레포지토리 목록 가져오기 +async function getUserRepositories(username) { + try { + const response = await api.get(`/users/${username}/repos`); + return response.data; + } catch (error) { + console.error('Error fetching repositories:', error); + throw error; + } +} \ No newline at end of file From c1e87dc0011ee7d939b040e9f5ad61440b219131 Mon Sep 17 00:00:00 2001 From: studio-pro Date: Sun, 15 Sep 2024 19:35:52 +0900 Subject: [PATCH 3/4] Update GitHub API SDK: Added getBranchCommits function --- kakasoo/githubApiSdk.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kakasoo/githubApiSdk.js b/kakasoo/githubApiSdk.js index efc63ddc1b8..adbf4931804 100644 --- a/kakasoo/githubApiSdk.js +++ b/kakasoo/githubApiSdk.js @@ -2,7 +2,7 @@ import axios from 'axios'; // GitHub API 기본 설정 const GITHUB_API_BASE_URL = 'https://api.github.com'; -const TOKEN = 'YOUR_PERSONAL_ACCESS_TOKEN'; // personal access token을 여기에 삽입 +const TOKEN = 'YOUR_PERSONAL_ACCESS_TOKEN'; // axios 인스턴스 생성 const api = axios.create({ @@ -21,4 +21,17 @@ async function getUserRepositories(username) { console.error('Error fetching repositories:', error); throw error; } +} + +// 커밋 목록 가져오기 +async function getBranchCommits(username, repo, branch) { + try { + const response = await api.get(`/repos/${username}/${repo}/commits`, { + params: { sha: branch } + }); + return response.data; + } catch (error) { + console.error('Error fetching branch commits:', error); + throw error; + } } \ No newline at end of file From de4dc5e8061fa67b996b8e190f3e55a7625913fb Mon Sep 17 00:00:00 2001 From: studio-pro Date: Sun, 15 Sep 2024 19:39:38 +0900 Subject: [PATCH 4/4] Create package.json with axios dependency --- kakasoo/package.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 kakasoo/package.json diff --git a/kakasoo/package.json b/kakasoo/package.json new file mode 100644 index 00000000000..6c14cd970e7 --- /dev/null +++ b/kakasoo/package.json @@ -0,0 +1,14 @@ +{ + "name": "github_connector", + "version": "1.0.0", + "description": "GitHub API SDK for fetching user repositories and branch commits", + "main": "githubApiSdk.js", + "dependencies": { + "axios": "^0.21.1" + }, + "scripts": { + "start": "node githubApiSdk.js" + }, + "author": "studio-pro", + "license": "MIT" +} \ No newline at end of file