Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added kakasoo/.gitkeep
Empty file.
37 changes: 37 additions & 0 deletions kakasoo/githubApiSdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import axios from 'axios';

// GitHub API 기본 설정
const GITHUB_API_BASE_URL = 'https://api.github.com';
const TOKEN = 'YOUR_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;
}
}

// 커밋 목록 가져오기
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;
}
}
14 changes: 14 additions & 0 deletions kakasoo/package.json
Original file line number Diff line number Diff line change
@@ -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"
}