| 1 | class Github { |
| 2 | constructor() { |
| 3 | this.client_id = '678ac7bcdad2fad219d6'; |
| 4 | this.client_secret = 'b7d82810d10fb8d5d62baa792786e4f75c0bbe3e'; |
| 5 | this.repos_count = 5; |
| 6 | this.repos_sort = 'created: asc'; |
| 7 | } |
| 8 | |
| 9 | async getUser(user) { |
| 10 | const profileResponse = await fetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secret=${this.client_secret}`); |
| 11 | |
| 12 | 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}`); |
| 13 | |
| 14 | const profile = await profileResponse.json(); |
| 15 | const repos = await repoResponse.json(); |
| 16 | return { |
| 17 | profile, |
| 18 | repos |
| 19 | } |
| 20 | |
| 21 | } |
| 22 | |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected