helloserve.ExchangeRatesApi
1.3.1
dotnet add package helloserve.ExchangeRatesApi --version 1.3.1
NuGet\Install-Package helloserve.ExchangeRatesApi -Version 1.3.1
<PackageReference Include="helloserve.ExchangeRatesApi" Version="1.3.1" />
paket add helloserve.ExchangeRatesApi --version 1.3.1
#r "nuget: helloserve.ExchangeRatesApi, 1.3.1"
// Install helloserve.ExchangeRatesApi as a Cake Addin #addin nuget:?package=helloserve.ExchangeRatesApi&version=1.3.1 // Install helloserve.ExchangeRatesApi as a Cake Tool #tool nuget:?package=helloserve.ExchangeRatesApi&version=1.3.1
helloserve.ExchangeRatesApi
This is a .NET Standard 2.0 client for the https://exchangeratesapi.io/ service. Available on Nuget.
Usage
Add it:
services.AddExchangeRatesApiClient(config =>
{
config.ApiKey = "<key from your config or user secrets>";
});
Inject it:
public MyClass(IExchangeRatesApiClient exchangeRatesClient)
{
}
Call it:
double usdEurRate = exchangeRatesClient.GetLatestRates().Rates["EUR"];
Remarks
The IExchangeRatesApiClient
interface provides methods and overloads to cover all the possible RESTfull route and query string combinations supported by the Exchange Rates API service.
It is important to note that, when retreiving rates for a date on which no rates were reported, you will be given the closest rate published before that date.
For example, if you request rates for 2017-12-17, you will instead get rates dated in the response to 2017-12-15. Additionally, when retreiving rates for a date range,
the result will not includes entries for dates on which no rates were reported.
API Key
Version 1.1 adds support for the new access_key
query parameter. The service (exchangeratesapi.io) recently expanded to a multi-tier pricing structure, which requires you to register for an API key.
Errors
The service recently changed to a success flag response model (instead of HTTP error codes), and so there is now an ExchangeRateApiException
thrown when this flag is false. The ErrorCode
property is enumerated according to their documentation, but it should be noted that not all errors have a code, and will be reported as unknown.
Limitations
Their subscription tier limitations are reported through the error reponses, but broadly for the free tier (which I suspect is what most people are interested in):
- no HTTPS support, so configure the API URL accordingly.
- doesn't support specifying a base currency, everything is reported in EUR.
- doesn't support the
/timeseries
endpoint, e.g. theGetRatesForDateRangeAsync
method group.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.