matrix-js-sdk

    Class FetchHttpApi<O>

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    opts: O

    Methods

    • Perform an authorised request to the homeserver.

      Type Parameters

      • T

      Parameters

      • method: Method

        The HTTP method e.g. "GET".

      • path: string

        The HTTP path after the supplied prefix e.g. "/createRoom".

      • queryParams: QueryDict = {}

        A dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.

      • Optionalbody: Body

        The HTTP JSON body.

      • paramOpts: IRequestOpts = {}

        additional options. When paramOpts.doNotAttemptTokenRefresh is true, token refresh will not be attempted when an expired token is encountered. Used to only attempt token refresh once.

      Returns Promise<T>

      The parsed response.

      Error if a problem occurred. This includes network problems and Matrix-specific error JSON.

    • Form and return a homeserver request URL based on the given path params and prefix.

      Parameters

      • path: string

        The HTTP path after the supplied prefix e.g. "/createRoom".

      • OptionalqueryParams: QueryDict

        A dict of query params (these will NOT be urlencoded).

      • Optionalprefix: string

        The full prefix to use e.g. "/_matrix/client/v2_alpha", defaulting to this.opts.prefix.

      • OptionalbaseUrl: string

        The baseUrl to use e.g. "https://matrix.org", defaulting to this.opts.baseUrl.

      Returns URL

      URL

    • Type Parameters

      • T extends object = Record<string, unknown>

      Parameters

      • method: Method
      • path: string
      • params: undefined | Record<string, string | string[]>
      • prefix: string
      • OptionalaccessToken: string

      Returns Promise<T>

    • Perform a request to the homeserver without any credentials.

      Type Parameters

      • T

      Parameters

      • method: Method

        The HTTP method e.g. "GET".

      • path: string

        The HTTP path after the supplied prefix e.g. "/createRoom".

      • OptionalqueryParams: QueryDict

        A dict of query params (these will NOT be urlencoded). If unspecified, there will be no query params.

      • Optionalbody: Body

        The HTTP JSON body.

      • Optionalopts: IRequestOpts

        additional options

      Returns Promise<T>

      The parsed response.

      Error if a problem occurred. This includes network problems and Matrix-specific error JSON.

    • Perform a request to an arbitrary URL.

      Type Parameters

      • T

      Parameters

      • method: Method

        The HTTP method e.g. "GET".

      • url: string | URL

        The HTTP URL object.

      • Optionalbody: Body

        The HTTP JSON body.

      • opts: BaseRequestOpts = {}

        additional options

      Returns Promise<T>

      The parsed response.

      Error if a problem occurred. This includes network problems and Matrix-specific error JSON.

    • Sets the base URL for the identity server

      Parameters

      • Optionalurl: string

        The new base url

      Returns void

    MMNEPVFCICPMFPCPTTAAATR