Skip to content
Cytraen edited this page Oct 13, 2023 · 18 revisions

Welcome to the BungieSharper wiki!

Getting Started

BungieSharper targets .NET 6.0 and .NET 8.0, and is available on NuGet, GitHub Packages, the releases page, or as artifacts from GH Actions.

Usage:

  • Add a reference to BungieSharper from your project.
  • Create a new instance of BungieSharper.Client.BungieClientConfig and populate properties as needed via object initialization.
    • You must pass an API key. You can get one here.
  • Create a new instance of BungieSharper.Client.BungieApiClient, passing the BungieClientConfig in the constructor
  • Use {BungieApiClient instance}.Api.{endpoint name}
    • e.g. bungieClient.Api.Destiny2_SearchDestinyPlayer(...)

From this point on, Bungie's documentation is pretty much all you'll need.
For completeness, BungieSharper also includes Bungie's documentation in the docstrings.

Sample code

using BungieSharper.Client;
using BungieSharper.Entities.Destiny;

var bungieClient = new BungieApiClient(new BungieClientConfig
{
    ApiKey = Environment.GetEnvironmentVariable("BUNGIE_API_KEY") ?? throw new NotImplementedException("You need an API key"),
    UserAgent = "BungieSharperSample/0.1.0",
    // Optional, only needed for OAuth
    // OAuthClientId = 0,
    // OAuthClientSecret = ""
});

var profile = await bungieClient.Api.Destiny2_GetProfile(
    4611686018467948914,
    BungieSharper.Entities.BungieMembershipType.TigerSteam,
    new List<DestinyComponentType>() { DestinyComponentType.Profiles }
    );
Clone this wiki locally