๐ Node.js๋ฅผ ์ํ ๋ก์ผํ์น API ํด๋ผ์ด์ธํธ
๋ก์ผํ์น๋ ์คํํธ์ ๊ธฐ์ /์ฑ์ฉ ํ๋ซํผ์ผ๋ก ์์ํ ๋น์ฆ๋์ค ๋คํธ์ํน ์๋น์ค๋ก, ์๋ง์ ๊ธฐ์ ๊ณผ ์ฌ๋๋ค์ ํ๋กํ ๊ทธ๋ฆฌ๊ณ ์ฑ์ฉ ์ ๋ณด๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
์ด ๋ชจ๋์ ๋น๊ณต์ API ํด๋ผ์ด์ธํธ๋ก,
1๏ธโฃ ๊ธฐ์
๊ณผ ๊ฐ์ธ์ด ํ๋ก์ ํธ์ ์ด๋ ฅ์ ์ ๋ณด๋ฅผ ๋ ๋น ๋ฅด๊ฒ ์
๋ฐ์ดํธํ๊ณ ,
2๏ธโฃ ์์ ์๊ฒ ํ์ํ ์ฑ์ฉ ์ ๋ณด๋ฅผ ๊ตฌํ๋ ๊ณผ์ ์ ์๋ํํ ์ ์๋๋ก ์ ์๋์์ต๋๋ค.
npm install rocketpunch-api
# Or using yarn
yarn add rocketpunch-api
import {
RocketPunchAPIClient,
ICompanyMember,
IProject,
IUserSummary,
} from 'rocketpunch-api';
// Initialize API Client with Email Login
const rocketpunchAPI = new RocketPunchAPIClient({
email: 'junhoyeo@example.com',
password: 'โขโขโขโขโขโขโขโขโขโข',
});
(async () => {
// Login with providen credentials
await rocketpunchAPI.login();
// User profile API
const userProfile = rocketpunchAPI.getUser('jyeo');
// Receive summary about user profile
const summary: IUserSummary = userProfile.getSummary();
console.log(summary.job);
// => 'Frontend Web Developer'
// Receive a list of user projects
const projects: IRocketPunchProject[] = userProfile.getProjects();
projects.forEach((project) => console.log(project));
// Company profile API
const companyProfile = rocketpunchAPI.getCompany('inu');
// Receive brief profile information about company members
const members: ICompanyMember = companyProfile.getMembers();
console.log(members);
})();
- ๐ ๋ช ์ธ
- ๐ง ๊ตฌํ ์ค
- โ ๊ตฌํ ์๋ฃ
ํน์ username
๋ฅผ ๊ฐ์ง ์ฌ์ฉ์์ ๋ฌธ์๋ฅผ ๋ถ๋ฌ์ต๋๋ค.
const userProfile = await rocketpunchAPI.getUser('@jyeo');
ํด๋น ์ฌ์ฉ์์ ์์ฝ๋ ํ๋กํ ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getSummary();
{
avatar: 'https://image.rocketpunch.com/user/183977/183977_1591104071.jpeg?s=200x200&t=cover',
name: '์ฌ์คํธ',
englishName: 'Junho Yeo',
status: 'ํ๋ฆฌ๋์',
job: 'Frontend Web Developer',
role: [ '๋์์ธ', 'SW ๊ฐ๋ฐ', '๊ธฐํ/PM' ],
interests: [ 'JavaScript', 'Front-end', 'React' ],
overview: 'Frontend is INEVITABLEโข: ๋ถ๊ฐ๋ฅํ ํ๋ก ํธ์๋๋ ์๋ค๊ณ ๋ฏฟ์ต๋๋ค...',
highlights: [
{ name: 'EmoticBox', href: '/tag/emoticbox-tuif05' },
{ name: '์ด๋', href: '/tag/inu-vrcojq' },
{
name: 'ํ๊ตญ๋์งํธ๋ฏธ๋์ด๊ณ ๋ฑํ๊ต',
href: '/tag/korea-digital-media-high-school-n8zzfw'
}
],
socialInfo: { recommends: 6, friends: 116, residence: '์กํ๊ตฌ' },
webpage: 'https://trendy-resume.now.sh/',
socialLinks: [
{ name: 'facebook', href: 'https://www.facebook.com/juno3704' },
{
name: 'instagram',
href: 'https://www.instagram.com/jyeo_official'
},
{ name: 'github', href: 'https://github.com/junhoyeo' }
],
connection: { following: 185, follower: 119 }
}
ํด๋น ์ฌ์ฉ์์ ๊ฒฝ๋ ฅ ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getCareer();
ํด๋น ์ฌ์ฉ์์ ํ๋ ฅ ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getEducation();
[
{
name: 'ํ๊ตญ๋์งํธ๋ฏธ๋์ด๊ณ ๋ฑํ๊ต',
href: '/tag/korea-digital-media-high-school-n8zzfw',
major: [ '์ ๋ฌธ(์ค์
)' ],
date: '2019๋
์
ํ',
description: '18๊ธฐ ํดํน๋ฐฉ์ด๊ณผ',
projects: [ '๋๋ฏธ๊ณ ์ธ', '๋๋ฏธ์๊ฐ', 'CAKE' ]
}
]
ํด๋น ์ฌ์ฉ์๊ฐ ๋ฑ๋กํ ํ๋ก์ ํธ ๋ชฉ๋ก์ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getProjects();
ํด๋น ์ฌ์ฉ์์ ์์ ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getAwards();
ํด๋น ์ฌ์ฉ์๊ฐ ์์ฑํ ๋ธ๋ก๊ทธ ๊ธ ๋ชฉ๋ก์ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getPosts();
ํด๋น ์ฌ์ฉ์๊ฐ ์ค๋ฆฐ ๋ด์ค ๋ฐ ๋ฏธ๋์ด ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์์ ๋๋ค.
userProfile.getMedia();