import { WidgetApi } from "matrix-widget-api"; import { MatrixEvent } from "./models/event"; import { ISendEventResponse, SendDelayedEventRequestOpts, SendDelayedEventResponse, UpdateDelayedEventAction } from "./@types/requests"; import { StateEvents } from "./@types/event"; import { MatrixClient, IMatrixClientCreateOpts, IStartClientOpts, SendToDeviceContentMap, IOpenIDToken } from "./client"; import { SyncState } from "./sync"; import { Room } from "./models/room"; import { ToDeviceBatch } from "./models/ToDeviceMessage"; import { DeviceInfo } from "./crypto/deviceinfo"; import { IOlmDevice } from "./crypto/algorithms/megolm"; interface IStateEventRequest { eventType: string; stateKey?: string; } export interface ICapabilities { /** * Event types that this client expects to send. */ sendEvent?: string[]; /** * Event types that this client expects to receive. */ receiveEvent?: string[]; /** * Message types that this client expects to send, or true for all message * types. */ sendMessage?: string[] | true; /** * Message types that this client expects to receive, or true for all * message types. */ receiveMessage?: string[] | true; /** * Types of state events that this client expects to send. */ sendState?: IStateEventRequest[]; /** * Types of state events that this client expects to receive. */ receiveState?: IStateEventRequest[]; /** * To-device event types that this client expects to send. */ sendToDevice?: string[]; /** * To-device event types that this client expects to receive. */ receiveToDevice?: string[]; /** * Whether this client needs access to TURN servers. * @defaultValue false */ turnServers?: boolean; /** * Whether this client needs to be able to send delayed events. * @experimental Part of MSC4140 & MSC4157 * @defaultValue false */ sendDelayedEvents?: boolean; /** * Whether this client needs to be able to update delayed events. * @experimental Part of MSC4140 & MSC4157 * @defaultValue false */ updateDelayedEvents?: boolean; } /** * A MatrixClient that routes its requests through the widget API instead of the * real CS API. * @experimental This class is considered unstable! */ export declare class RoomWidgetClient extends MatrixClient { private readonly widgetApi; private readonly capabilities; private readonly roomId; private room?; private readonly widgetApiReady; private lifecycle?; private syncState; /** * * @param widgetApi - The widget api to use for communication. * @param capabilities - The capabilities the widget client will request. * @param roomId - The room id the widget is associated with. * @param opts - The configuration options for this client. * @param sendContentLoaded - Whether to send a content loaded widget action immediately after initial setup. * Set to `false` if the widget uses `waitForIFrameLoad=true` (in this case the client does not expect a content loaded action at all), * or if the the widget wants to send the `ContentLoaded` action at a later point in time after the initial setup. */ constructor(widgetApi: WidgetApi, capabilities: ICapabilities, roomId: string, opts: IMatrixClientCreateOpts, sendContentLoaded: boolean); startClient(opts?: IStartClientOpts): Promise; stopClient(): void; joinRoom(roomIdOrAlias: string): Promise; protected encryptAndSendEvent(room: Room, event: MatrixEvent): Promise; protected encryptAndSendEvent(room: Room, event: MatrixEvent, delayOpts: SendDelayedEventRequestOpts): Promise; sendStateEvent(roomId: string, eventType: string, content: any, stateKey?: string): Promise; /** * @experimental This currently relies on an unstable MSC (MSC4140). */ _unstable_sendDelayedStateEvent(roomId: string, delayOpts: SendDelayedEventRequestOpts, eventType: K, content: StateEvents[K], stateKey?: string): Promise; private validateSendDelayedEventResponse; /** * @experimental This currently relies on an unstable MSC (MSC4140). */ _unstable_updateDelayedEvent(delayId: string, action: UpdateDelayedEventAction): Promise<{}>; sendToDevice(eventType: string, contentMap: SendToDeviceContentMap): Promise<{}>; getOpenIdToken(): Promise; queueToDevice({ eventType, batch }: ToDeviceBatch): Promise; encryptAndSendToDevices(userDeviceInfoArr: IOlmDevice[], payload: object): Promise; checkTurnServers(): Promise; getSyncState(): SyncState | null; private setSyncState; private ack; private onEvent; private onToDevice; private watchTurnServers; } export {}; //# sourceMappingURL=embedded.d.ts.map