@zeepkist/graphql
v3.4.0
Published
GraphQL client for Zeepkists' GraphQL APIs
Readme
@zeepkist/graphql
Fully typed TypeScript GraphQL client (powered by GenQL) for Zeepkist, providing the GTR and Workshop GraphQL API 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 to the schema may occur in minor releases.
Changelogs
GraphQL IDEs
Explore and test your GraphQL queries on the GraphiQL IDE: https://graphql.zeepki.st
Convert GraphQL to GenQL Syntax
Use the online converter provided by GenQL to quickly convert a GrapQL query to a format usable by this library:
- https://genql.dev/converter
Usage
CDN
<script type="module">
import { client } from 'https://esm.run/@zeepkist/graphql'
const response = await client.query({
...
})
</script>Deno
import { client } from 'https://esm.run/@zeepkist/graphql'
const response = await client.query({
...
})Node / Bundlers
Install dependencies
yarn add @zeepkist/graphql
# or with npm:
npm install @zeepkist/graphqlImport and use
import { client } from '@zeepkist/graphql'
const response = await client.query({
...
})Enums
Enums can be imported, for example:
import {
client,
enumLevelsOrderBy,
RecordGenqlSelection,
QueryGenqlSelection,
} from '@zeepkist/graphql'
const recordFragment: RecordGenqlSelection = {
time: true,
user: {
steamId: true,
steamName: true,
}
}
const query: QueryGenqlSelection = {
levels: {
__args: {
first: 10,
orderBy: [enumLevelsOrderBy.LEVEL_POINT_COUNT_DESC]
},
nodes: {
personalBestGlobals: {
totalCount: true,
},
// Get the world record from the worldRecordGlobal
worldRecordGlobals: {
nodes: {
record: recordFragment
}
},
// Get the world record by filtering records for records that have a worldRecordGlobal relation
records: {
__args: {
filter: {
worldRecordGlobalsExist: true,
}
},
nodes: recordFragment
}
}
}
}
const response = await client.query({
__name: 'GetExampleQuery',
...query
})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 iType-Check, Compile and Minify for Production
pnpm buildRun tests
pnpm testRun tests with code coverage
pnpm coverageLint with ESLint
pnpm lintUpdate schemas with the latest versions
pnpm generate