Skip to content
Discussion options

You must be logged in to vote

Hi @RedFour,

A mutation has the same signature as a query, with variables as the first argument of the SDK method, as shown below:

import { GraphQLClient } from 'graphql-request'
import { getSdk } from './sdk' // THIS FILE IS THE GENERATED FILE
 
async function main() {
  const client = new GraphQLClient('https://countries.trevorblades.com')
  const sdk = getSdk(client)
  const { continent } = await sdk.createContinent({ name: "Europe" }) // This is fully typed, based on the query
 
  console.log(`GraphQL data:`, continent)
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by charlypoly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants