Skip to content

zeepkist/graphql

Repository files navigation

Zeepkist GraphQL Clients

Fully typed TypeScript GraphQL clients for Zeepkist, including GTR and Workshop GraphQL APIs for Zeepkist.

Download the GTR mod for Zeepkist in Modkist (Zeepkist's Mod Loader) or on mod.io

Please note that as this is an ever green package that automatically updates types when it detects the schemas change, breaking changes may occur in minor releases.

Usage

CDN

<script type="module">
  import { gtr, gtrBeta } from 'https://esm.run/@zeepkist/graphql'

  const gtrResponse = await gtr.query({
	...
  })

  const betaResponse = await gtrBeta.query({
	...
  })
</script>

Deno

import { gtr, gtrBeta } from 'https://esm.run/@zeepkist/graphql'

const gtrResponse = await gtr.query({
...
})

const betaResponse = await gtrBeta.query({
...
})

Node / Bundlers

Install dependencies

yarn add @zeepkist/graphql

# or with npm:
npm install @zeepkist/graphql

Import and use

import { gtr, gtrBeta } from '@zeepkist/graphql'

const gtrResponse = await gtr.query({
...
})

const betaResponse = await gtrBeta.query({
...
})

Enums

Enums can be imported from the specific service you are using, for example:

import { gtr } from '@zeepkist/graphql'
import { enumUserPointsOrderBy } from '@zeepkist/graphql/gtr'

const response = await gtr.query({
  allPlayerPoints: {
    __args: {
      orderBy: [enumUserPointsOrderBy.POINTS_DESC]
    }
  }
})

Documentation

To see all available exports and options, see the package documentation.

Contributing

You will either need Node.js' CorePack enabled or an installation of pnpm to run this package locally. CorePack is recommended as it will automatically keep you updated with pnpm version the repository is using.

Install development dependencies

pnpm i

Type-Check, Compile and Minify for Production

pnpm build

Run tests

pnpm test

Run tests with code coverage

pnpm coverage

Lint with ESLint

pnpm lint

Update schemas with the latest versions

pnpm generate