jasonkuhrt / graphql-request

Minimal GraphQL client
MIT License
5.77k stars 307 forks source link

Graffle helper functions #849

Closed jasonkuhrt closed 2 months ago

jasonkuhrt commented 2 months ago

Perceived Problem

Ideas / Proposed Solution(s)

import { execute, request, Graffle } from 'graffle'

const graffle1 = Graffle.create({
  schema: new URL('https://...'),
  headers: {...},
})

await graffle1.rawOrThrow(`GraphQL Document Here`, {
  headers: {...},
  variables: {...}
})

await request({
  schema: new URL('https://...'),
  headers: {...},
  document: `GraphQL Document Here`,
  variables: {...},
})

const graffle2 = Graffle.create({ schema: someSchema })

await graffle2.rawOrThrow(`GraphQL Document Here`)

await execute({
  schema: someSchema
  document: `GraphQL Document Here`,
  headers: {...},
})