From 54c13284193e7921fda4f913e3637b20f6aaa5e1 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 5 Sep 2019 09:54:27 -0400 Subject: [PATCH 1/2] Accept Octokit.Options in the GitHub constructor --- src/github.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/github.ts b/src/github.ts index 5c85e40..35b5f62 100644 --- a/src/github.ts +++ b/src/github.ts @@ -14,8 +14,8 @@ export class GitHub extends Octokit { variables?: Variables ) => Promise - constructor(token: string) { - super({auth: `token ${token}`}) + constructor(token: string, opts: Omit = {}) { + super({...opts, auth: `token ${token}`}) this.graphql = defaults({ headers: {authorization: `token ${token}`} }) From a683403927b113eb98407f9244160cbe9dabe6dc Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Thu, 5 Sep 2019 10:52:34 -0400 Subject: [PATCH 2/2] Add note about constructor options --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2b74bb1..b431256 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ const { data: pullRequest } = await octokit.pulls.get({ console.log(pullRequest); ``` +You can pass client options (except `auth`, which is handled by the token argument), as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor. + You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API. ```js