Fixer.Api.Client
1.0.3
dotnet add package Fixer.Api.Client --version 1.0.3
NuGet\Install-Package Fixer.Api.Client -Version 1.0.3
<PackageReference Include="Fixer.Api.Client" Version="1.0.3" />
<PackageVersion Include="Fixer.Api.Client" Version="1.0.3" />
<PackageReference Include="Fixer.Api.Client" />
paket add Fixer.Api.Client --version 1.0.3
#r "nuget: Fixer.Api.Client, 1.0.3"
#:package Fixer.Api.Client@1.0.3
#addin nuget:?package=Fixer.Api.Client&version=1.0.3
#tool nuget:?package=Fixer.Api.Client&version=1.0.3
Fixer.Api.Client
A simple, strongly-typed, and configurable .NET API client for the Fixer.io currency exchange rates API.
Supports latest rates, historical data, currency conversion, time series, and fluctuations with built-in error handling and easy DI integration.
Features
- Retrieve latest exchange rates with optional base currency and symbols filter
- Fetch historical exchange rates for specific dates
- Convert currency amounts between currencies
- Query time series and fluctuation data
- Automatic error handling with explicit exceptions for API errors
- Supports cancellation tokens for async calls
- Easy integration with
IHttpClientFactoryand Dependency Injection
Installation
Install the NuGet package via:
dotnet add package Fixer.Api.Client
Getting Started
Registering the client
Configure your services in Startup.cs or wherever you configure DI:
services.AddFixerClient(Configuration.GetSection("Fixer"));
Your configuration should include at least:
{
"Fixer": {
"ApiKey": "your_api_key_here",
"BaseUrl": "https://data.fixer.io/api/"
}
}
Usage example
Inject IFixerClient into your service or controller:
public class CurrencyService
{
private readonly IFixerClient _fixerClient;
public CurrencyService(IFixerClient fixerClient)
{
_fixerClient = fixerClient;
}
public async Task PrintLatestRatesAsync()
{
var response = await _fixerClient.GetLatestRatesAsync(baseSymbol: "EUR", symbols: new[] { "USD", "GBP" });
if (response?.Success == true)
{
foreach (var rate in response.Rates)
{
Console.WriteLine($"{rate.Key}: {rate.Value}");
}
}
}
}
Error Handling
API errors throw explicit exceptions derived from FixerApiException such as:
BadRequestException(400)UnauthorizedException(401)TooManyRequestsException(429)- And others per the Fixer API error codes
Use try-catch blocks to handle these gracefully.
Testing
Includes integration tests using xUnit to verify live API behavior.
Configure your FIXER_API_KEY environment variable before running tests.
Contributing
Contributions welcome! Please open issues or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Links
| 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 was computed. 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. |
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0 && < 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0 && < 10.0.0)
- Microsoft.Extensions.Http (>= 9.0.0 && < 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.