Astrada TypeScript SDK
    Preparing search index...

    Class RequestApi

    This is the base class for all generated API classes.

    Hierarchy (View Summary)

    Index
    configuration: Configuration
    middleware: Middleware[]

    The middleware of this instance; protected so hand-written subclasses can pass it on.

    • Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json

      Parameters

      • mime: string

        MIME (Multipurpose Internet Mail Extensions)

      Returns boolean

      True if the given MIME is JSON, false otherwise.

    • Sends the request. Network errors and timeouts (while waiting for the answer or reading its body), 408, 429 and 5xx are retried for idempotent methods (see ConfigurationParameters.maxRetries). A 401 is retried once with a new token. Any other status outside 200 to 299 throws a ResponseError subclass. The body is read here, whole.

      Parameters

      Returns Promise<Response>

    • Sends method path and returns the parsed JSON body (undefined for an empty one). Any status outside 200 to 299 throws the same ResponseError subclasses as the generated methods; a 2xx whose body is not JSON throws a ResponseError whose response can still be read (the call did succeed). The path follows normaliseRequestPath.

      Type Parameters

      • T = unknown

      Parameters

      Returns Promise<T>