Table of Contents

BoeEndpointOptions Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Boe.dll
Package
Bodu.Financial.ExchangeRates.Boe 0.7.1
Source
BoeEndpointOptions.cs

Configures the provider's connection to the Bank of England Interactive Statistical Database (IADB): where the CSV query endpoint lives and how the HTTP requests that drive it are shaped.

public sealed class BoeEndpointOptions
Inheritance
BoeEndpointOptions
Inherited Members
Extension Methods

Remarks

This object isolates the network-facing settings from the behavioural options on BoeRateProviderOptions, so the host, query path, transport timeout, and request identity can be pointed at a mirror or proxy of the IADB - or simply tuned - without touching caching or series configuration. A range request is composed from BaseUrl, QueryPath, the requested series codes, and the inclusive date range through BuildRequestUrl(IReadOnlyList<string>, DateOnly, DateOnly).

Every member carries a working default, so the object binds cleanly through Microsoft.Extensions.Options and requires no configuration for the common case.

Constructors

BoeEndpointOptions()

public BoeEndpointOptions()

Properties

BaseUrl

Gets or sets the base URL under which the IADB endpoints live. Should end with a trailing slash so the query path resolves as a relative path.

public Uri BaseUrl { get; set; }

Property Value

Uri

The base URL; defaults to the Bank of England IADB path.

HttpTimeout

Gets or sets the HTTP request timeout applied to range downloads by the dependency-injection registration.

public TimeSpan HttpTimeout { get; set; }

Property Value

TimeSpan

The HTTP timeout; defaults to 30 seconds.

QueryPath

Gets or sets the relative path of the IADB CSV column query endpoint.

public string QueryPath { get; set; }

Property Value

string

The query path; defaults to _iadb-fromshowcolumns.asp.

UserAgent

Gets or sets the User-Agent header applied to range downloads by the dependency-injection registration.

public string UserAgent { get; set; }

Property Value

string

The user-agent string; defaults to a Bodu identifier.

Methods

BuildRequestUrl(IReadOnlyList<string>, DateOnly, DateOnly)

Composes the absolute IADB CSV request URL for a set of series codes over an inclusive date range.

public Uri BuildRequestUrl(IReadOnlyList<string> seriesCodes, DateOnly startDate, DateOnly endDate)

Parameters

seriesCodes IReadOnlyList<string>

The IADB series codes to request.

startDate DateOnly

The inclusive start of the range.

endDate DateOnly

The inclusive end of the range.

Returns

Uri

The absolute request URL.

Exceptions

ArgumentNullException

Thrown when seriesCodes is null.

InvalidOperationException

Thrown when BaseUrl has not been configured.

TryValidate(out string?)

Attempts to validate the endpoint options without throwing, reporting the first invariant that is violated.

public bool TryValidate(out string? error)

Parameters

error string

When this method returns false, a message describing the first violated invariant; otherwise null.

Returns

bool

true when every invariant holds; otherwise false.

Validate()

Validates the endpoint options, throwing when a required value is missing or an invariant is violated.

public void Validate()

Exceptions

ArgumentException

Thrown when BaseUrl is null; QueryPath is empty or white space; or HttpTimeout is not greater than zero.

Applies to

ProductVersions
.NET8, 10