.NET Client for TheTVDB API integrated with IHttpClientFactory
and IServiceCollection
.
dotnet add package TrackSeries.TheTVDB.Client
Install-Package TrackSeries.TheTVDB.Client
The best way of using the client is adding the dependencies to the ServiceCollection
and resolving ITVDBClient
where you'd like to use it:
services.AddTVDBClient(options =>
{
options.ApiKey = "Set here your API-KEY for TheTVDB";
});
The client will automatically manage tokens for you so you don't need to worry about it. In case you would like to authenticate to run actions over an specific TheTVDB user you can use the following:
await client.Authentication.AuthenticateAsync("Username", "UserKey");
Now you will be able to use the endpoints under Users
:
var userFavoriteSeries = await client.Users.GetFavoritesAsync();
It's possible to share the context between all the instances of the client (token and language):
services.AddTVDBClient(options =>
{
options.ApiKey = "Set here your API-KEY for TheTVDB";
options.ShareContextBetweenClients = true;
});
Big thanks to HristoKolev for his awesome work on TvDbSharper.