Class HistoricalGatewayExtensions
- Namespace
- DatabentoDotNet.Historical
- Assembly
- DatabentoDotNet.Historical.dll
Extension methods for HistoricalGateway.
public static class HistoricalGatewayExtensions
- Inheritance
-
HistoricalGatewayExtensions
- Inherited Members
Methods
ToUri(HistoricalGateway)
Returns the base URL gateway is reached at.
public static Uri ToUri(this HistoricalGateway gateway)
Parameters
gatewayHistoricalGatewayThe gateway.
Returns
- Uri
The gateway's base URL.
Remarks
Bo1's literal carries no trailing slash:
new Uri("https://hist.databento.com").AbsoluteUri is already
https://hist.databento.com/, because Uri normalises a bare authority
to a root path on its own — verified, not assumed. Writing the slash into the literal would
be redundant in a way that invites someone to "tidy" it away later and read the removal as
harmless, when in fact nothing would change: Uri supplies it regardless.
This is not where a trailing slash is load-bearing. That is the client's BaseUrl
override, which can carry a path of its own:
new Uri(new Uri("http://host/api"), "v0/x") composes to http://host/v0/x —
the trailing segment api is dropped, not appended to. Normalising that case belongs
to the client that accepts the override, not to this gateway, which only ever produces a
bare authority with nothing after the root slash for it to clash with.
Exceptions
- ArgumentOutOfRangeException
gatewayis not a defined HistoricalGateway.