Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/github

src/graphql.ts

16 lines · 642 B · TypeScript
import type { GitHubGraphqlOptions } from "./types"
export { graphql } from "./core"
import { graphql } from "./core"

/**
 * Make one GitHub GraphQL request.
 *
 * @returns GraphQL response with `data`, optional `errors`, and rate-limit headers.
 * @example
 * import githubGraphql from 'kody:@kentcdodds/github/graphql'
 * const result = await githubGraphql({ account: 'bot', query: 'query { viewer { login } }' })
 * // => { data: { viewer: { login: 'kody-bot' } }, ok: true }
 */
export default async function githubGraphql(params: GitHubGraphqlOptions = { query: "query Viewer { viewer { login } }" }) {
  return await graphql(params)
}