Merge pull request #109 from element-hq/midhun/multiroom/client-api

Allow modules to access a part of `MatrixClient` functionality
This commit is contained in:
R Midhun Suresh
2025-10-27 18:11:17 +05:30
committed by GitHub
8 changed files with 232 additions and 4 deletions
@@ -24,6 +24,13 @@ export interface AccountAuthInfo {
userId: string;
}
// @public
export interface AccountDataApi {
delete(eventType: string): Promise<void>;
get(eventType: string): Watchable<unknown>;
set(eventType: string, content: unknown): Promise<void>;
}
// @alpha @deprecated (undocumented)
export interface AliasCustomisations {
// (undocumented)
@@ -37,6 +44,7 @@ export interface AliasCustomisations {
export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiExtension, DialogApiExtension, AccountAuthApiExtension, ProfileApiExtension {
// @alpha
readonly builtins: BuiltinsApi;
readonly client: ClientApi;
readonly config: ConfigApi;
createRoot(element: Element): Root;
// @alpha
@@ -46,6 +54,7 @@ export interface Api extends LegacyModuleApiExtension, LegacyCustomisationsApiEx
readonly i18n: I18nApi;
readonly navigation: NavigationApi;
readonly rootNode: HTMLElement;
readonly stores: StoresApi;
}
// @alpha
@@ -65,6 +74,12 @@ export interface ChatExportCustomisations<ExportFormat, ExportType> {
};
}
// @public
export interface ClientApi {
accountData: AccountDataApi;
getRoom: (id: string) => Room | null;
}
// @alpha @deprecated (undocumented)
export interface ComponentVisibilityCustomisations {
shouldShowComponent?(component: "UIComponent.sendInvites" | "UIComponent.roomCreation" | "UIComponent.spaceCreation" | "UIComponent.exploreRooms" | "UIComponent.addIntegrations" | "UIComponent.filterContainer" | "UIComponent.roomOptionsMenu"): boolean;
@@ -312,11 +327,24 @@ export interface ProfileApiExtension {
readonly profile: Watchable<Profile>;
}
// @public
export interface Room {
getLastActiveTimestamp: () => number;
id: string;
name: Watchable<string>;
}
// @alpha @deprecated (undocumented)
export interface RoomListCustomisations<Room> {
isRoomVisible?(room: Room): boolean;
}
// @public
export interface RoomListStoreApi {
getRooms(): Watchable<Room[]>;
waitForReady(): Promise<void>;
}
// @alpha
export interface RoomViewProps {
roomId?: string;
@@ -335,6 +363,11 @@ export interface SpacePanelItemProps {
tooltip?: string;
}
// @public
export interface StoresApi {
roomListStore: RoomListStoreApi;
}
// @public
export type Translations = Record<string, {
[ietfLanguageTag: string]: string;
@@ -360,9 +393,14 @@ export type Variables = {
// @public
export class Watchable<T> {
constructor(currentValue: T);
// Warning: (ae-forgotten-export) The symbol "WatchFn" needs to be exported by the entry point index.d.ts
//
// (undocumented)
protected readonly listeners: Set<WatchFn<T>>;
protected onFirstWatch(): void;
protected onLastWatch(): void;
// (undocumented)
unwatch(listener: (value: T) => void): void;
// (undocumented)
get value(): T;
set value(value: T);
// (undocumented)