boardgamegeek

Haxe client for the BoardGameGeek API.
https://gitlab.com/haath/boardgamegeek-haxe

To install, run:

haxelib install boardgamegeek 0.2.0 

See using Haxelib in Haxelib documentation for more information.

README.md

boardgamegeek

build status test coverage license haxelib version haxelib downloads


This is a simple Haxe implementation for fetching data from the BoardGameGeek API.

Installation

The library is available on Haxelib.

haxelib install boardgamegeek

Add tink_xml as a git library. Haxelib does not currently allow git dependencies in haxelib.json.

--library tink_xml:git:https://github.com/haxetink/tink_xml.git

Usage

All the API interactions are implemented in the BoardGameGeek class.

Note that all methods return tink_core promises. As such they are compatible with the rest of the tink framework. For the examples here, it is assumed that tink_await is also installed, but it is not a dependency of this library.

var bgg: BoardGameGeek = new BoardGameGeek();

// get a specific board game by id
var game: Thing = @await bgg.getThing(283355);
game.name;
game.categories;

// get all of the game's expansions
var expansions: Array<Thing> = @await bgg.getExpansions(game);

// search for a board game by name
var results: Array<SearchResult> = @await bgg.search('Carcassone', BoardGameExpansion);

// get a user's public profile
var user: User = @await bgg.getUser('Haath');

Collections

User collections are fetched using a queue system. This means that on the first request, BGG will put us in a queue while it fetches the data.

// get a user's collection
var collection: UserCollection = null;
while (true)
{
    collection = @await bgg.getCollection('Haath');
    if (collection.items != null)
    {
        // got the result!
        break;
    }

    // our request is in the queue, try again after 1sec
    @await Future.delay(1000, 0);

}

Rate limiting

What is returned by the promise will be:

  • Success(data) if the request was successful, and data is the returned object.
  • Success(null) if the rate limiting error codes were returned by the API.
  • Failure(err) on any other error err.
Contributors
Haath
Version
0.2.0
Published
3 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂