Skip to content

Commit

Permalink
Add missing overloads for widget mode
Browse files Browse the repository at this point in the history
but leave future sending unimplemented for now
  • Loading branch information
AndrewFerr committed Jul 11, 2024
1 parent 13c307f commit cac6c79
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from "matrix-widget-api";

import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event";
import { ISendEventResponse } from "./@types/requests";
import { ISendEventResponse, ISendFutureRequestOpts, ISendFutureResponse } from "./@types/requests";
import { EventType } from "./@types/event";
import { logger } from "./logger";
import {
Expand Down Expand Up @@ -248,7 +248,20 @@ export class RoomWidgetClient extends MatrixClient {
throw new Error(`Unknown room: ${roomIdOrAlias}`);
}

protected async encryptAndSendEvent(room: Room, event: MatrixEvent): Promise<ISendEventResponse> {
protected async encryptAndSendEvent(room: Room, event: MatrixEvent): Promise<ISendEventResponse>;
protected async encryptAndSendEvent<F extends ISendFutureRequestOpts>(
room: Room,
event: MatrixEvent,
futureOpts: F,
): Promise<ISendFutureResponse<F>>;
protected async encryptAndSendEvent<F extends ISendFutureRequestOpts>(
room: Room,
event: MatrixEvent,
futureOpts?: F,
): Promise<ISendEventResponse | ISendFutureResponse<F>> {
if (futureOpts) {
throw new Error("Future sending via widgets is not implemented");
}
let response: ISendEventFromWidgetResponseData;
try {
response = await this.widgetApi.sendRoomEvent(event.getType(), event.getContent(), room.roomId);
Expand Down

0 comments on commit cac6c79

Please sign in to comment.