npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

biketag

v3.3.4

Published

The Javascript client API for BikeTag Games

Downloads

134

Readme

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