Skip to content
Chase Redmon edited this page May 6, 2023 · 4 revisions

CatBox.NET - Getting Started

Installation

Install the package from nuget here: https://www.nuget.org/packages/CatBox.NET/

dotnet add package CatBox.NET --version 0.3.0

Setup

Start by creating a DI container with a ServiceCollection and calling the .AddCatBoxServices() method to add it to the DI container. The .AddCatBoxServices() method takes an Action<CatBoxConfig> parameter, which prompts the user for a Uri for the CatBox.moe API.

The full creation of the ServiceCollection looks like this:

var collection = new ServiceCollection()
    .AddCatBoxServices(f => f.CatBoxUrl = new Uri("https://catbox.moe/user/api.php"))
    .BuildServiceProvider();

Instance of CatBoxClient

After you have added the internal services to your ServiceCollection, get the ICatBoxClient service from the collection like so:

using (var scope = collection.CreateScope())
{
    var client = scope.ServiceProvider.GetRequiredService<ICatBoxClient>();
}

At this point, please refer to our method documentation for which methods are available and their function. Check out our sample application here

Clone this wiki locally