A dotnet client for the BoardGameGeek XMLAPI2. The core library is a simple wrapper for the API using refit, while the main library provides a useful client that interacts with the api and then maps the results into more consistent objects before returning them.
You can install via the dotnet cli
dotnet add package Bgg.Sdk
or with NuGet cli
Install-Package Bgg.Sdk
The client is intended to be setup bia dependency injection. An extension method exists to make the necessary registrations
services.AddBgg();
The IBggClient
is the primary service you'll interact with. It provides base methods for all of the API endpoints with custom query parameter objects, as well as helpful shortcut methods for most endpoints with reasonable defaults.
First, take a dependency on IBggClient
public class MyClass{
private readonly IBggClient _bggClient;
public MyClass(IBggClient bggClient){
_bggClient = bggClient;
}
}
Then call any of the endpoints. For example, to retrieve my BGG Collection
var collection = await _bggClient.CollectionAsync("theiam79");
You can view the details of the BGG XMLAPI2 here. All endpoints have a query parameter object to match the documentation, with the exception of those marked not in use.