Class ReferenceCodeFilter
- Namespace
- DatabentoDotNet.Reference
- Assembly
- DatabentoDotNet.Reference.dll
Renders a list of reference codes as the comma-joined form value the countries,
events, security_types and exchanges filters take.
public static class ReferenceCodeFilter
- Inheritance
-
ReferenceCodeFilter
- Inherited Members
Remarks
Upstream writes this four times, once per filter, each as an AddToForm impl that pushes
nothing when the list is empty (reference.rs:252-297, and corporate.rs:99-107 for
the fourth). Here it is two methods, because the four differ only in which type they hold —
three of them a reference code and the fourth a bare string. null is the "push
nothing" answer in both, so a caller omits the parameter rather than sending an empty one — the
same distinction ReferenceDateTimeRange draws for an absent end.
The exchanges overload is separate because an exchange code is not an
IReferenceCode<TSelf>. Upstream has the same problem and solves it the same way:
Vec<String> is a foreign type it cannot write an AddToForm impl for, so
corporate.rs wraps it in a private Exchanges newtype — the one form renderer that
lives in that file rather than in reference.rs. There is no set of exchange codes to
close over: list_enums reports no group for them, and Exchange
is a bare string for that reason.
Methods
Render(IEnumerable<string>?)
Joins values with commas, or returns null when there is
nothing to filter on and the parameter should be left out entirely. The overload the
exchanges filter uses.
public static string? Render(IEnumerable<string>? values)
Parameters
valuesIEnumerable<string>The exchange codes to filter for, or null for no filter.
Returns
Remarks
The refusal below is the same rule the generic overload applies to a default
code, restated for the one filter whose values are not codes: a blank entry would widen the
query if dropped and produce a stray comma if sent. Upstream joins without checking
(corporate.rs:101-106), which is the behaviour, not the contract — it has no empty
String to worry about in its own tests.
Exceptions
- ArgumentException
One of
valuesis null, empty, or white space.
Render<T>(IEnumerable<T>?)
Joins values with commas, or returns null when there is
nothing to filter on and the parameter should be left out entirely.
public static string? Render<T>(IEnumerable<T>? values) where T : struct, IReferenceCode<T>
Parameters
valuesIEnumerable<T>The codes to filter for, or null for no filter.
Returns
Type Parameters
TThe reference code type.
Exceptions
- ArgumentException
One of
valuesnames no code. A default in a filter list is a caller mistake rather than an empty filter: dropping it would silently widen the query, and sending it would produce a stray comma.