HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Struct InterpolatedApiPathHandler

    Provides a custom interpolated string handler for API paths, which are relative to a client's base address.

    Namespace: Singulink.Net.Http.Api.Client.InternalServices
    Assembly: Singulink.Net.Http.Api.Client.dll
    Syntax
    public readonly struct InterpolatedApiPathHandler
    Remarks

    This type exists for the compiler's interpolated string support: an interpolated string passed as a path, such as $"documents/{id}", is built with it. The literal parts are used as written and each value is formatted with the invariant culture and then escaped as URI data, so characters such as /, ? and # in a value don't start a new segment, a query or a fragment. Values are formatted the same way as query string parameter values, with dates in the round-trip format unless a format is given, except that byte arrays are base64url encoded without padding. The raw format, as in $"files/{path:raw}", skips the escaping. A value other than a raw one cannot be . or .., which escaping leaves as they are, so that a value can't change which segments the path has.

    ASP.NET Core unescapes route values except for %2F, so a / in a value reaches the service's endpoint as %2F.

    A string converts to a path as is, without escaping.

    Constructors

    Name Description
    InterpolatedApiPathHandler(int, int)

    Initializes a new instance of the InterpolatedApiPathHandler struct for an interpolated string.

    Methods

    Name Description
    AppendFormatted<T>(T)

    Appends a formatted and escaped value to the path.

    AppendFormatted<T>(T, string?)

    Appends a value to the path with the specified format, escaped unless the format is raw.

    AppendLiteral(string)

    Appends a literal part to the path as written.

    ToString()

    Returns the path.

    Operators

    Name Description
    implicit operator InterpolatedApiPathHandler(string)

    Converts a string to a path without escaping it.

    © Singulink. All rights reserved.