Update octokit graphql type dependencies (#228)

* Update GraphQL support in base API
This commit is contained in:
Ross Brodbeck
2019-12-06 07:52:04 -05:00
committed by GitHub
parent 1c12ced7ba
commit 5fdab2aaf2
6 changed files with 72 additions and 81 deletions
+10 -6
View File
@@ -1,5 +1,11 @@
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
import {GraphQlQueryResponse, Variables, defaults} from '@octokit/graphql'
import {graphql} from '@octokit/graphql'
// we need this type to set up a property on the GitHub object
// that has token authorization
// (it is not exported from octokit by default)
import {graphql as GraphQL} from '@octokit/graphql/dist-types/types'
import Octokit from '@octokit/rest'
import * as Context from './context'
@@ -9,14 +15,12 @@ Octokit.prototype = new Octokit()
export const context = new Context.Context()
export class GitHub extends Octokit {
graphql: (
query: string,
variables?: Variables
) => Promise<GraphQlQueryResponse>
graphql: GraphQL
constructor(token: string, opts: Omit<Octokit.Options, 'auth'> = {}) {
super({...opts, auth: `token ${token}`})
this.graphql = defaults({
this.graphql = graphql.defaults({
headers: {authorization: `token ${token}`}
})
}