-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.js
More file actions
28 lines (18 loc) · 817 Bytes
/
github.js
File metadata and controls
28 lines (18 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Github {
constructor() {
this.client_id = "0eb39d26063ebc34694c";
this.client_secret = "090e795b717f5195903180999b4b26fac3871bed";
this.repos_count = 5;
this.repos_sort = "created: asc";
}
async getUser(user) {
const profilerResponse = await fetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secret=${this.client_secret}`);
const repoResponse = await fetch(`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}`);
const profile = await profilerResponse.json();
const repo = await repoResponse.json();
return {
profile,
repo
}
}
}