Class BaseAPI

This is the base class for all generated API classes.

Hierarchy (view full)

Constructors

  • Parameters

    Returns BaseAPI

Properties

configuration: Configuration = DefaultConfig
middleware: Middleware[]
jsonRegex: RegExp = ...

Methods

  • Create a shallow clone of this by constructing a new instance and then shallow cloning data members.

    Type Parameters

    Parameters

    • this: T

    Returns T

  • Parameters

    Returns Promise<{
        init: RequestInit;
        url: string;
    }>

  • Parameters

    • url: string
    • init: RequestInit

    Returns Promise<Response>

  • 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.

  • Parameters

    Returns Promise<Response>

  • Type Parameters

    Parameters

    Returns T

  • Type Parameters

    Parameters

    • this: T
    • Rest ...postMiddlewares: ((context) => Promise<void | Response>)[]

    Returns T

  • Type Parameters

    Parameters

    • this: T
    • Rest ...preMiddlewares: ((context) => Promise<void | FetchParams>)[]

    Returns T