-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgithub.js
More file actions
22 lines (18 loc) · 739 Bytes
/
github.js
File metadata and controls
22 lines (18 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Github{
constructor(){
this.per_page = 5;
}
// get user
async getUser(username){
let client_id = 'ee591408080d5e5946da';
let client_secret = '87cb9f7500f8d1cfc72566468d589102be53a2f7';
let profileResponse = await fetch(`https://api.github.com/users/${username}?client_id=${client_id}&client_secret=${client_secret}`);
let repoResponse = await fetch(`https://api.github.com/users/${username}/repos?per_page=${this.per_page}&client_id=${client_id}&client_secret=${client_secret}`);
let profile = await profileResponse.json();
let repos = await repoResponse.json();
return {
profile,
repos
}
}
}