matrix-react-sdk
Version:
SDK for matrix.org using React
38 lines (37 loc) • 1.51 kB
TypeScript
import { Room, MatrixClient } from "matrix-js-sdk/src/matrix";
import { Membership } from "matrix-js-sdk/src/types";
/**
* Approximation of a membership status for a given room.
*/
export declare enum EffectiveMembership {
/**
* The user is effectively joined to the room. For example, actually joined
* or knocking on the room (when that becomes possible).
*/
Join = "JOIN",
/**
* The user is effectively invited to the room. Currently this is a direct map
* to the invite membership as no other membership states are effectively
* invites.
*/
Invite = "INVITE",
/**
* The user is effectively no longer in the room. For example, kicked,
* banned, or voluntarily left.
*/
Leave = "LEAVE"
}
export type MembershipSplit = {
[state in EffectiveMembership]: Room[];
};
export declare function splitRoomsByMembership(rooms: Room[]): MembershipSplit;
export declare function getEffectiveMembership(membership: Membership): EffectiveMembership;
export declare function isKnockDenied(room: Room): boolean | undefined;
export declare function getEffectiveMembershipTag(room: Room, membership?: string): EffectiveMembership;
export declare function isJoinedOrNearlyJoined(membership: Membership): boolean;
/**
* Try to ensure the user is in the room (invited or joined) before continuing
*/
export declare function waitForMember(client: MatrixClient, roomId: string, userId: string, opts?: {
timeout: number;
}): Promise<boolean>;