matrix-react-sdk
Version:
SDK for matrix.org using React
51 lines (50 loc) • 1.74 kB
TypeScript
import { MatrixClient, MatrixEvent, Room, Thread } from "matrix-js-sdk/src/matrix";
import { MessageEventProps } from "./test-utils";
export declare const makeThreadEvent: ({ rootEventId, replyToEventId, ...props }: MessageEventProps & {
rootEventId: string;
replyToEventId: string;
}) => MatrixEvent;
type MakeThreadEventsProps = {
roomId: Room["roomId"];
authorId: string;
participantUserIds: string[];
length?: number;
ts?: number;
currentUserId?: string;
};
export declare const makeThreadEvents: ({ roomId, authorId, participantUserIds, length, ts, currentUserId, }: MakeThreadEventsProps) => {
rootEvent: MatrixEvent;
events: MatrixEvent[];
};
type MakeThreadProps = {
room: Room;
client: MatrixClient;
authorId: string;
participantUserIds: string[];
length?: number;
ts?: number;
};
/**
* Create a thread but don't actually populate it with events - see
* populateThread for what you probably want to do.
*
* Leaving this here in case it is needed by some people, but I (andyb) would
* expect us to move to use populateThread exclusively.
*/
export declare const mkThread: ({ room, client, authorId, participantUserIds, length, ts, }: MakeThreadProps) => {
thread: Thread;
rootEvent: MatrixEvent;
events: MatrixEvent[];
};
/**
* Create a thread, and make sure the events added to the thread and the room's
* timeline as if they came in via sync.
*
* Note that mkThread doesn't actually add the events properly to the room.
*/
export declare const populateThread: ({ room, client, authorId, participantUserIds, length, ts, }: MakeThreadProps) => Promise<{
thread: Thread;
rootEvent: MatrixEvent;
events: MatrixEvent[];
}>;
export {};