3.12.1 • Published 2 years ago

@zeepkist/gtr-api v3.12.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

GTR API

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

Usage

CDN

<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>

Deno

import { getRecords } from 'https://esm.run/@zeepkist/gtr-api'

const records = await getRecords({
  BestOnly: true
})

console.log(records) // { totalAmount: 700, records: [{ ... }] }

Node / Bundlers

Install dependencies

yarn add @zeepkist/gtr-api

# or with npm:
npm install @zeepkist/gtr-api

Import and use

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.

How to get a token

  1. 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.

  2. 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.

  3. Decode the object and use the AccessToken property to authenticate your requests.

  4. 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 to https://auth.zeepkist-gtr.com/external/refresh?token={token} where {token} is the RefreshToken from the decoded object in Step 3. The response will be a base64 encoded object containing the new AccessToken. If the RefreshExpiry time has passed, you will need to start the process again from Step 1.

Contributing

First-time Project Setup

yarn
yarn dlx @yarnpkg/sdks vscode

Compile and Hot-Reload for Development

yarn dev

Type-Check, Compile and Minify for Production

yarn build

Run tests

yarn test

Run tests with code coverage

yarn coverage

Lint with ESLint

yarn lint
3.9.0

2 years ago

3.11.0

2 years ago

3.10.1

2 years ago

3.10.0

2 years ago

3.12.1

2 years ago

3.10.3

2 years ago

3.12.0

2 years ago

3.10.2

2 years ago

3.8.0

2 years ago

3.7.3

2 years ago

3.7.2

2 years ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.7.1

2 years ago

3.7.0

2 years ago

3.6.0

2 years ago

3.5.0

2 years ago

3.4.1

2 years ago

3.1.3

2 years ago

3.0.1

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

3.0.0

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago