- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgithub.js
More file actions
Latest commit
20 lines (18 loc) · 788 Bytes
/
Copy pathgithub.js
File metadata and controls
20 lines (18 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
classGitHub{
constructor(){
this.client_id="b538be69eaef6f6b6559";
this.client_secret="0f478dbe8a73c409c92c44a5d9aae98e7f4efd8d";
this.repos_count=5;
this.repos_sort='created: asc'
}
asyncgetUser(user){
constprofileResponse=awaitfetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secret=${this.client_secret}`);
constrepoResponse=awaitfetch(`https://api.github.com/users/${user}/repos?per_page=${this.repos_count}&sort=${this.repos_sort}&client_id=${this.client_id}&client_secret=${this.client_secret}`)
constprofile=awaitprofileResponse.json();
constrepos=awaitrepoResponse.json();
return{
profile,
repos
}
}
}