TrackSeries.FanArtTV.Client.OpenTelemetry
2.0.4
dotnet add package TrackSeries.FanArtTV.Client.OpenTelemetry --version 2.0.4
NuGet\Install-Package TrackSeries.FanArtTV.Client.OpenTelemetry -Version 2.0.4
<PackageReference Include="TrackSeries.FanArtTV.Client.OpenTelemetry" Version="2.0.4" />
<PackageVersion Include="TrackSeries.FanArtTV.Client.OpenTelemetry" Version="2.0.4" />
<PackageReference Include="TrackSeries.FanArtTV.Client.OpenTelemetry" />
paket add TrackSeries.FanArtTV.Client.OpenTelemetry --version 2.0.4
#r "nuget: TrackSeries.FanArtTV.Client.OpenTelemetry, 2.0.4"
#:package TrackSeries.FanArtTV.Client.OpenTelemetry@2.0.4
#addin nuget:?package=TrackSeries.FanArtTV.Client.OpenTelemetry&version=2.0.4
#tool nuget:?package=TrackSeries.FanArtTV.Client.OpenTelemetry&version=2.0.4
TrackSeries FanArtTV .NET Client
.NET Client for the FanArt.TV API integrated with IHttpClientFactory best practices and IServiceCollection.
Getting Started
The best way of using the client is adding the dependencies to the ServiceCollection and resolving IFanArtTVClient where you'd like to use it:
services.AddFanArtTVClient(options =>
{
options.ApiKey = "Set here your API-KEY for FanArtTV";
});
The client targets the FanArtTV v3.2 API and uses IHttpClientFactory. By default it installs the standard .NET HTTP resilience pipeline, including retries with jitter and Retry-After support, timeouts, rate limiting, and a circuit breaker.
Options can also be loaded from configuration:
{
"FanArtTV": {
"ApiKey": "Set here your API-KEY for FanArtTV",
"ClientKey": "Optional personal key",
"BaseAddress": "https://webservice.fanart.tv/v3.2/"
}
}
services.AddFanArtTVClientFromConfiguration(configuration.GetSection("FanArtTV"));
HTTP handlers and resilience
AddFanArtTVClient returns the standard IHttpClientBuilder, so application handlers can be appended normally:
services.AddTransient<MyHandler>();
services
.AddFanArtTVClient(options => options.ApiKey = "api-key")
.AddHttpMessageHandler<MyHandler>();
Handlers appended this way execute inside the default resilience pipeline and therefore run once per attempt. To own the complete handler and resilience pipeline, disable the library default and add exactly one application pipeline:
services
.AddFanArtTVClient(
FanArtTVResilienceMode.None,
options => options.ApiKey = "api-key")
.AddHttpMessageHandler<MyHandler>()
.AddStandardResilienceHandler(options =>
{
options.Retry.MaxRetryAttempts = 2;
});
Use FanArtTVResilienceMode.None when resilience is configured globally or when adding a custom AddResilienceHandler or AddStandardResilienceHandler; stacking resilience handlers multiplies attempts and delays.
OpenTelemetry
Install the optional integration package to collect the client's traces and metrics without manually registering its instrumentation names:
dotnet add package TrackSeries.FanArtTV.Client.OpenTelemetry
services
.AddOpenTelemetry()
.AddFanArtTVClientInstrumentation();
Configure exporters, resources and sampling in the application as usual. The standard HttpClient instrumentation can be enabled alongside this integration to observe individual HTTP attempts, while the FanArtTV activity represents the logical request across retries.
Services that only need the stable source and meter names can reference the lightweight TrackSeries.FanArtTV.Client.Diagnostics package without pulling in the client or OpenTelemetry dependencies.
Migrating to version 2
Version 2 moves the default API from v3 to v3.2, enables nullable reference types, and returns nullable results when the FanArtTV API can return an empty response. Music albums are now exposed as List<AlbumImages> and each item identifies itself through ReleaseGroupId, matching the v3.2 response shape. Image models also expose v3.2 dimensions, timestamps, and collection counts.
The concrete client and options types are now sealed; depend on IFanArtTVClient, ITVClient, IMoviesClient, and IMusicClient when substituting implementations.
Configuration is validated when IFanArtTVClient is resolved. An API key is required, the base address must use HTTPS, and custom base paths are normalized with a trailing slash.
Configuration binding is explicit in version 2: pass the desired IConfigurationSection to AddFanArtTVClientFromConfiguration. Registration through an options delegate no longer requires an IConfiguration service.
Non-success API responses are surfaced as HttpRequestException. Applications should avoid bulk requests and unnecessary polling in accordance with FanArtTV's API-key rules.
References
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- TrackSeries.FanArtTV.Client.Diagnostics (>= 2.0.4)
-
net8.0
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- TrackSeries.FanArtTV.Client.Diagnostics (>= 2.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.