matrix-react-sdk
Version:
SDK for matrix.org using React
49 lines (48 loc) • 1.69 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
export declare enum InviteState {
Invited = "invited",
Error = "error"
}
export declare const UNKNOWN_PROFILE_ERRORS: string[];
export type CompletionStates = Record<string, InviteState>;
/**
* Invites multiple addresses to a room, handling rate limiting from the server
*/
export default class MultiInviter {
private readonly matrixClient;
private roomId;
private readonly progressCallback?;
private canceled;
private addresses;
private busy;
private _fatal;
private completionStates;
private errors;
private deferred;
private reason;
/**
* @param matrixClient the client of the logged in user
* @param {string} roomId The ID of the room to invite to
* @param {function} progressCallback optional callback, fired after each invite.
*/
constructor(matrixClient: MatrixClient, roomId: string, progressCallback?: (() => void) | undefined);
get fatal(): boolean;
/**
* Invite users to this room. This may only be called once per
* instance of the class.
*
* @param {array} addresses Array of addresses to invite
* @param {string} reason Reason for inviting (optional)
* @returns {Promise} Resolved when all invitations in the queue are complete
*/
invite(addresses: string[], reason?: string): Promise<CompletionStates>;
/**
* Stops inviting. Causes promises returned by invite() to be rejected.
*/
cancel(): void;
getCompletionState(addr: string): InviteState;
getErrorText(addr: string): string | null;
private inviteToRoom;
private doInvite;
private inviteMore;
}