Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bgg2json

qrzy52MITdeprecated2.0.2TypeScript support: included

This package has been deprecated. It served as a base for the new package which is bgg-xml-api-client. Please use it instead.

Wrapper for Boardgamegeek.com XML API (v1 and v2) that returns data as JS object.

bgg, bgg api, xml api, bgg json

readme

DEPRECATED

This package has been deprecated.

It's been versioned really badly and also missed some important points so now this repository served as a base for new package: bgg-xml-api-client.

Coverage Status

BGG2JSON

It's a simple library providing just a single function that returns requested BGG data as a JavaScript object. It uses axios under the hood, so the return value is wrapped with AxiosResponse - just to provide all the data about the response from API. The main data sits in data property of that response object.

Example usage:

import bgg2json from 'bgg2json';

const { data } = await bgg2json('user', { name: 'Qrzy88' });

console.log(data.id); // displays: 1381959

bgg2json takes 2 parameters:

  • BGG API resource name
  • resource parameters as object - for better DX the parameters are typed, but the type is a union of types given to the wrappers listed below

Wrappers

There are also wrappers available for certain resources that accept params (already typed) as the only argument:

  • getBggCollection(params)
  • getBggFamily(params)
  • getBggForum(params)
  • getBggForumlist(params)
  • getBggGeeklist(params)
  • getBggGuild(params)
  • getBggHot(params)
  • getBggPlays(params)
  • getBggSearch(params)
  • getBggThing(params)
  • getBggThread(params)
  • getBggUser(params)