matrix-js-sdk

    Interface Extension<Req, Res>

    An interface that must be satisfied to register extensions

    interface Extension<Req extends object, Res extends object> {
        name(): string;
        onRequest(isInitial: boolean): Promise<Req>;
        onResponse(data: Res): Promise<void>;
        when(): ExtensionState;
    }

    Type Parameters

    • Req extends object
    • Res extends object
    Index

    Methods

    • The extension name to go under 'extensions' in the request body.

      Returns string

      The JSON key.

    • A function which is called when the request JSON is being formed. Returns the data to insert under this key.

      Parameters

      • isInitial: boolean

        True when this is part of the initial request.

      Returns Promise<Req>

      The request JSON to send.

    • A function which is called when there is response JSON under this extension.

      Parameters

      • data: Res

        The response JSON under the extension name.

      Returns Promise<void>

    MMNEPVFCICPMFPCPTTAAATR