Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 1 KB

README.md

File metadata and controls

17 lines (12 loc) · 1 KB

Samples

Two programs that call the real NBP API. Both use the projects in src/, so they show the current code, not the version on NuGet.

Project What it shows
OpenUrzednik.Samples.Console The NBP clients without a DI container: checking the result, Match, TryGetValue, a validation error and EnsureSuccess() with an exception
OpenUrzednik.Samples.WebApi A minimal API with AddOpenUrzednikNbp() and AddStandardResilienceHandler(); it turns the result's errors into HTTP statuses and problem details

Running

dotnet run --project samples/OpenUrzednik.Samples.Console -f net10.0
dotnet run --project samples/OpenUrzednik.Samples.WebApi -f net10.0

The Web API listens on http://localhost:5000 and answers /gold/latest, /rates/USD?topCount=5 and /tables/c/latest, among others. /rates/USD?topCount=0 returns 400 with a validation error, and missing data returns 404.