← Public packages
@kody/github
Call GitHub REST, GraphQL, and pull requests with a GitHub OAuth App or a personal access token.
src/graphql.ts
20 lines · 691 B · TypeScriptimport type { GitHubGraphqlOptions } from "./types"
export { graphql } from "./core"
import { graphql } from "./core"
/**
* Make one GitHub GraphQL request.
*
* GraphQL mutations require `dryRun: true` or `confirm: true`.
*
* @returns GraphQL response with `data`, optional `errors`, and rate-limit headers.
* @example
* import githubGraphql from 'kody:@kody/github/graphql'
* const result = await githubGraphql({ query: 'query { viewer { login } }' })
* // => { data: { viewer: { login: 'octocat' } }, ok: true }
*/
export default async function githubGraphql(
params: GitHubGraphqlOptions = { query: "query Viewer { viewer { login } }" },
) {
return await graphql(params)
}