Table of Contents

Struct RequestUriBuilder

Namespace
MassiveDotNet.Http
Assembly
MassiveDotNet.dll

Composes a relative request URI, escaping path segments and query values as it goes.

public ref struct RequestUriBuilder
Inherited Members

Remarks

This is a ref struct, so it cannot cross an await. Build the URI to completion with ToUriString() before issuing the request.

Optional query parameters are skipped when null, which lets generated endpoint code append every supported parameter unconditionally.

Constructors

RequestUriBuilder(Span<char>)

Initializes a builder over caller-supplied scratch space.

public RequestUriBuilder(Span<char> initialBuffer)

Parameters

initialBuffer Span<char>

Scratch space to use before growing into pooled memory.

Methods

AppendPathLiteral(scoped ReadOnlySpan<char>)

Appends a literal, already-safe portion of the path, such as "/v2/aggs/ticker/".

public void AppendPathLiteral(scoped ReadOnlySpan<char> value)

Parameters

value ReadOnlySpan<char>

The literal path text to append verbatim.

AppendPathSegment(int)

Appends an integer path segment.

public void AppendPathSegment(int value)

Parameters

value int

The segment value, for example an aggregate multiplier.

AppendPathSegment(string)

Appends a caller-supplied path segment, percent-escaping it.

public void AppendPathSegment(string value)

Parameters

value string

The segment value, for example a ticker symbol.

AppendQuery(scoped ReadOnlySpan<char>, bool?)

Appends a boolean query parameter, skipping it when null.

public void AppendQuery(scoped ReadOnlySpan<char> name, bool? value)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

value bool?

The parameter value, or null to omit the parameter.

AppendQuery(scoped ReadOnlySpan<char>, double?)

Appends a floating-point query parameter in invariant culture, skipping it when null.

public void AppendQuery(scoped ReadOnlySpan<char> name, double? value)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

value double?

The parameter value, or null to omit the parameter.

AppendQuery(scoped ReadOnlySpan<char>, int?)

Appends an integer query parameter, skipping it when null.

public void AppendQuery(scoped ReadOnlySpan<char> name, int? value)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

value int?

The parameter value, or null to omit the parameter.

AppendQuery(scoped ReadOnlySpan<char>, long?)

Appends a 64-bit integer query parameter, skipping it when null.

public void AppendQuery(scoped ReadOnlySpan<char> name, long? value)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

value long?

The parameter value, or null to omit the parameter.

AppendQuery(scoped ReadOnlySpan<char>, string?)

Appends a string query parameter, skipping it when null.

public void AppendQuery(scoped ReadOnlySpan<char> name, string? value)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

value string

The parameter value, or null to omit the parameter.

AppendQuery<T>(scoped ReadOnlySpan<char>, ArrayFilter<T>?)

Appends an array filter as its comparator parameters, skipping it when null or unset.

public void AppendQuery<T>(scoped ReadOnlySpan<char> name, ArrayFilter<T>? filter)

Parameters

name ReadOnlySpan<char>

The field's base name, which must already be URI-safe.

filter ArrayFilter<T>?

The filter, or null to omit the field entirely.

Type Parameters

T

The element type: string, int, long, double, LocalDate, DateOrTimestamp, or DateOrNanoseconds.

Exceptions

NotSupportedException

T is not one of the supported element types.

AppendQuery<T>(scoped ReadOnlySpan<char>, Filter<T>?)

Appends a range-or-set filter as its comparator parameters, skipping it when null or unset.

public void AppendQuery<T>(scoped ReadOnlySpan<char> name, Filter<T>? filter)

Parameters

name ReadOnlySpan<char>

The field's base name, which must already be URI-safe.

filter Filter<T>?

The filter, or null to omit the field entirely.

Type Parameters

T

The element type: string, int, long, double, LocalDate, DateOrTimestamp, or DateOrNanoseconds.

Exceptions

NotSupportedException

T is not one of the supported element types.

AppendQuery<T>(scoped ReadOnlySpan<char>, RangeFilter<T>?)

Appends a range filter as its comparator parameters, skipping it when null or unset.

public void AppendQuery<T>(scoped ReadOnlySpan<char> name, RangeFilter<T>? filter)

Parameters

name ReadOnlySpan<char>

The field's base name, which must already be URI-safe.

filter RangeFilter<T>?

The filter, or null to omit the field entirely.

Type Parameters

T

The element type: string, int, long, double, LocalDate, DateOrTimestamp, or DateOrNanoseconds.

Exceptions

NotSupportedException

T is not one of the supported element types.

AppendQuery<T>(scoped ReadOnlySpan<char>, SetFilter<T>?, bool)

Appends a set filter as its comparator parameters, skipping it when null or unset.

public void AppendQuery<T>(scoped ReadOnlySpan<char> name, SetFilter<T>? filter, bool hasExactForm = true)

Parameters

name ReadOnlySpan<char>

The field's base name, which must already be URI-safe.

filter SetFilter<T>?

The filter, or null to omit the field entirely.

hasExactForm bool

Whether the endpoint declares the plain field parameter. When it declares only field.any_of, an equality is rendered as a one-element set, which means the same thing.

Type Parameters

T

The element type: string, int, long, double, LocalDate, DateOrTimestamp, or DateOrNanoseconds.

Exceptions

NotSupportedException

T is not one of the supported element types.

AppendQuery<T>(scoped ReadOnlySpan<char>, T[]?)

Appends an array-typed query parameter as one comma-joined value, skipping it when null or empty.

public void AppendQuery<T>(scoped ReadOnlySpan<char> name, T[]? values)

Parameters

name ReadOnlySpan<char>

The parameter name, which must already be URI-safe.

values T[]

The values, or null or empty to omit the parameter.

Type Parameters

T

The element type: string, int, long, double, LocalDate, DateOrTimestamp, or DateOrNanoseconds.

Remarks

This is the field itself as a list, such as the snapshot operations' tickers, not a comparator set: there is no .any_of suffix. The OpenAPI description declares no style or explode for these parameters, and the default that implies is the repeated-key form, but the service reads only one value from that form (D19). An empty array is omitted rather than sent as name=, like every other optional parameter.

Exceptions

NotSupportedException

T is not one of the supported element types.

Dispose()

Returns any pooled buffer without materializing a string.

public void Dispose()

ToUriString()

Materializes the composed URI and returns any pooled buffer.

public string ToUriString()

Returns

string

The relative URI, including its query string when one was appended.