bgg-xml-api-client

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

Usage no npm install needed!

<script type="module">
  import bggXmlApiClient from 'https://cdn.skypack.dev/bgg-xml-api-client';
</script>

README

Build Status Coverage Status minified + gzip deps count deps count

BGG XML API Client

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 bggXmlApiClient from 'bgg-xml-api-client';

const { data } = await bggXmlApiClient.get('user', { name: 'Qrzy88' });

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

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