-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.js
More file actions
32 lines (18 loc) · 778 Bytes
/
github.js
File metadata and controls
32 lines (18 loc) · 778 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
29
30
31
32
//MY GITHUB FINDER
class Github {
constructor() {
this.client_id = '03ff34aa03d33a83b69e';
this.client_secret = 'd14d068bd51df69f3f7c0416cd220e900f28a9d3';
}
//Get Method
async getUsers(user) {
const profileResponse = 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 profileResponse.json();
const repos = await repoResponse.json();
return {
profile,
repos
}
}
}