Skip to content

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

Package listing

@kody/fly

src/graphql.ts

17 lines · 598 B · TypeScript
import { requestGraphql } from './fly-core.ts'
import type { FlyGraphqlInput } from './types.ts'

export { requestGraphql }

/**
 * Run a custom Fly.io GraphQL query using `flyApiToken`.
 * @param params.query - GraphQL query string.
 * @returns Parsed GraphQL `data` payload from Fly.
 * @example
 * import graphql from 'kody:@kody/fly/graphql'
 * const result = await graphql({ query: '{ organizations { nodes { slug } } }' })
 * // => { organizations: { nodes: [...] } }
 */
export default async function graphql(params: FlyGraphqlInput = { query: '' }) {
	return await requestGraphql(params)
}