(owner, repo)
| 8 | |
| 9 | export default class GithubAPI { |
| 10 | constructor(owner, repo) { |
| 11 | if (!owner) { |
| 12 | throw new Error('repo owner must be specified'); |
| 13 | } |
| 14 | |
| 15 | if (!repo) { |
| 16 | throw new Error('repo must be specified'); |
| 17 | } |
| 18 | |
| 19 | this.repo = repo; |
| 20 | this.owner = owner; |
| 21 | this.axios = githubAxios.create({ |
| 22 | baseURL: `https://api.github.com/repos/${this.owner}/${this.repo}/`, |
| 23 | }) |
| 24 | } |
| 25 | |
| 26 | async createComment(issue, body) { |
| 27 | return (await this.axios.post(`/issues/${issue}/comments`, {body})).data; |