-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Chase Redmon edited this page May 6, 2023
·
4 revisions
Install the package from nuget here: https://www.nuget.org/packages/CatBox.NET/
dotnet add package CatBox.NET --version 0.3.0
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();
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