Warning
This package is deprecated. The GTR and Zworpshop APIs are now available to be consumed as GraphQL or JSON:API resources.
-
Switch to the fully typed & always-up-to-date GraphQL implementation of GTR/Zworpshop (
@zeepkist/graphql
) -
Or, switch to the JSON:API implementation using
kitsu
orkitsu-core
For
kitsu
, setup the client for use with GTR and/or Zworpshop as follows:import Kitsu from 'kitsu' // setup the GTR client const gtr = new Kitsu({ baseURL: 'https://jsonapi.zeepkist-gtr.com', query: 'modern', pluralize: false }) // fetch Records resources const records = await gtr.get('records', { params: { sort: 'time', include: 'user', fields: { users: 'steamId,steamName', medias: 'ghostUrl,screenshotUrl' }, filter: "and(equals(isValid,'true'),equals(level,'BD3B71EB2AF356D3747E5674261E0589CEE79B3E'))", page: { size: 5, // 5 items per page number: 2 // page 2 of results } } }) // setup the Zworpshop client const zworpshop = new Kitsu({ baseURL: 'https://jsonapi.zworpshop.com', query: 'modern', pluralize: false }) // fetch Levels resources const levels = await zworpshop.get('levels', { params: { sort: '-name', include: 'metadata', fields: { levels: 'name,metadata', metadata: 'hash,validation,gold,silver,bronze,valid' }, filter: "and(equals(metadata.valid,'false'),lessThan(metadata.gold,'50.125'))", page: { size: 5, // 5 items per page number: 3 // page 3 of results } } })
For more examples, see the kitsu documentation (e.g fetching resources, single resource, relationships and relationships of relationships etc)
See the JsonApiDotNetCore documentation on valid filtering options.
Fully typed TypeScript API client for the GTR API.
Up-to-date with v0.20.1
of the GTR API.
Download the GTR mod for Zeepkist in Modkist (Zeepkist's Mod Loader) or on mod.io
<script type="module">
import { getRecords } from 'https://esm.run/@zeepkist/gtr-api'
async function displayRecords() {
const records = await getRecords({
BestOnly: true
})
console.log(records) // { totalAmount: 700, records: [{ ... }] }
}
displayRecords()
</script>
import { getRecords } from 'https://esm.run/@zeepkist/gtr-api'
const records = await getRecords({
BestOnly: true
})
console.log(records) // { totalAmount: 700, records: [{ ... }] }
yarn add @zeepkist/gtr-api
# or with npm:
npm install @zeepkist/gtr-api
import { getRecords } from '@zeepkist/gtr-api'
const records = await getRecords({
BestOnly: true
})
console.log(records) // { totalAmount: 700, records: [{ ... }] }
To see all available exports and options, see the package documentation.
-
Redirect your user to
https://auth.zeepkist-gtr.com/external/login?redirectUrl={redirectUrl}
where{redirectUrl}
is the URL you want to redirect the user to after they have logged in. -
After the user has logged in, they will be redirected to
{redirectUrl}?token={token}
where{token}
is a base64 encoded JSON object containing the user's token and other information. -
Decode the object and use the
AccessToken
property to authenticate your requests. -
The token is valid for a short period. Once the
AccessExpiry
time has passed, you will need to obtain a new token by sending a request tohttps://auth.zeepkist-gtr.com/external/refresh?token={token}
where{token}
is theRefreshToken
from the decoded object in Step 3. The response will be a base64 encoded object containing the newAccessToken
. If theRefreshExpiry
time has passed, you will need to start the process again from Step 1.
yarn
yarn dlx @yarnpkg/sdks vscode
yarn dev
yarn build
yarn test
yarn coverage
Lint with ESLint
yarn lint