3.3.12 • Published 4 months ago

biketag v3.3.12

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
4 months ago

Installation

This package is Isomorphic and Typescript ready

npm install biketag

How to include it in your projects

The library is a default export, as well as a named class export BikeTagClient. You can retrieve it from jsDeliver or npm, and it works in both the browser and nodejs.

Browser

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/biketag/client.js"></script>

Using unpkg CDN:

<script src="https://unpkg.com/npm/client.js"></script>

CommonJS

import/require the module:

// Using import statement
import { BikeTagClient } from 'biketag'
// Using require()
const { BikeTagClient } = require('biketag')

Usage

Instantiate with or without credentials (browser):

// if you have your clientKey/clientToken to retrieve an access token automatically, you can pass those in:
const client = new biketag({
  game: 'portland',
  clientKey: process.env.BIKETAG_CLIENT_KEY,
  clientToken: process.env.BIKETAG_CLIENT_TOKEN,
})

Instantiate with or without credentials (node):

// if you have Imgur credentials: clientId and clientSecret
const client = new BikeTagClient({
  game: 'portland',
  imgur: {
    clientId: process.env.IMGUR_CLIENT_ID,
    clientSecret: process.env.IMGUR_CLIENT_SECRET,
  }
})

Configuration

The BikeTag API requires only the game to be set in the configuration in order to read BikeTag data. You can read more about specific configurations in the documentation:

⚠️ For brevity, the rest of the examples will leave out the import and/or instantiation step.

Get Game Information

You can get game information by providing the name.

// retrieves the BikeTag game data 'portland' game
const biketagPortland = await client.game('portland')

Get Tags

You can get tags one by one or all at once for a given game using the getTag and getTags methods. You can also explicitely set the data adapter to any of the configurable sources (biketag, imgur, sanity):

// retrieves the BikeTag game data 'portland' game
const biketagPortland = await client.game('portland')

// retrieves the latest BikeTag posted for the 'portland' game from the most available API
const biketagPortlandCurrent = await client.getTag()

// retrieves the BikeTag #1 for the 'portland' game from imgur adapter
const biketagPortland1 = await client.tags(1, { source: 'imgur' })

// retrieves the all BikeTags for the 'portland' game from sanity adapter
const allPortlandTags = await client.tags(undefined, { source: 'sanity' })

Get Players

You can get the players of a game by calling getPlayers

// retrieves the BikeTag player data 'portland' game
const biketagPortlandPlayers = await biketagAPI.getPlayers('portland')

Credits

This project is heavily influenced by the node-imgur package, the Imgur API and it's documentation, and Sanity.IO's javascript client.

Using the typescript library configured and developed on the node-imgur v2 project: https://github.com/kaimallea/node-imgur, this package comes bundled with testing using jest and automated releases using github actions. Many thanks to Kaimallea for collaborating with me on the imgur API because I learned so much along the way!

Support the BikeTag Project on GitHub, Patreon, or directly by going out and playing a round of BikeTag in your city!

Alt

Vendors

Images powered by imgur.com

imgur.com

Structured Content powered by sanity.io

sanity.io

3.3.11

4 months ago

3.3.12

4 months ago

3.3.9

5 months ago

3.3.8

5 months ago

3.3.10

5 months ago

3.3.7

5 months ago

3.3.6

6 months ago

3.3.5

6 months ago

3.3.4

1 year ago

3.3.3

1 year ago

3.3.1

1 year ago

3.3.0

1 year ago

3.3.2

1 year ago

3.2.7

2 years ago

3.2.6

2 years ago

3.2.5

2 years ago

3.2.4

2 years ago

3.2.3

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.11

2 years ago

3.1.10

2 years ago

3.1.9

2 years ago

3.1.7

2 years ago

3.1.8

2 years ago

3.1.6

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

2.2.3

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.4

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.3

3 years ago

2.0.10

3 years ago

2.1.0

3 years ago

1.14.1

4 years ago

1.12.3

4 years ago

1.14.0

4 years ago

1.12.2

4 years ago

1.12.1

4 years ago

1.12.0

4 years ago

1.14.5

3 years ago

1.12.7

4 years ago

1.14.4

3 years ago

1.12.6

4 years ago

1.14.3

3 years ago

1.12.5

4 years ago

1.14.2

4 years ago

1.12.4

4 years ago

1.10.6

4 years ago

1.12.9

4 years ago

1.14.6

3 years ago

1.12.8

4 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.12.10

4 years ago

1.12.11

4 years ago

1.11.0

4 years ago

1.13.2

4 years ago

1.11.4

4 years ago

1.13.1

4 years ago

1.11.3

4 years ago

1.13.0

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.13.6

4 years ago

1.13.5

4 years ago

1.13.4

4 years ago

1.13.3

4 years ago

1.13.9

4 years ago

1.13.11

4 years ago

1.13.8

4 years ago

1.13.10

4 years ago

1.13.7

4 years ago

1.13.12

4 years ago

1.10.5

4 years ago

1.10.4

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.9.1

4 years ago

1.8.2

4 years ago

1.9.0

4 years ago

1.8.1

4 years ago

1.7.2

4 years ago

1.8.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.5.2

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.9.3

4 years ago

1.9.2

4 years ago

1.8.3

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.0.1-alpha-3

4 years ago

0.0.1-alpha-2

4 years ago

0.0.1-alpha-1

4 years ago

0.0.1-alpha-0

4 years ago