File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
packages/element-web-module-api/src Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2025 New Vector Ltd.
3+
4+ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+ Please see LICENSE files in the repository root for full details.
6+ */
7+
8+ import type { Room } from "../models/Room" ;
9+
10+ /**
11+ * Modify account data stored on the homeserver.
12+ * @public
13+ */
14+ export interface AccountDataApi {
15+ /**
16+ * Fetch account data stored from homeserver.
17+ */
18+ get ( eventType : string ) : unknown ;
19+ /**
20+ * Sett account data on the homeserver.
21+ */
22+ set ( eventType : string , content : unknown ) : Promise < void > ;
23+ /**
24+ * Delete account data from homeserver.
25+ */
26+ delete ( eventType : string ) : Promise < void > ;
27+ }
28+
29+ /**
30+ * Access some limited functionality from the SDK.
31+ * @public
32+ */
33+ export interface ClientApi {
34+ /**
35+ * Use this to modify account data on the homeserver.
36+ */
37+ getAccountDataApi : ( ) => AccountDataApi ;
38+
39+ /**
40+ * Fetch room by id from SDK.
41+ * @param id - Id of the room to get
42+ * @returns Room object from SDK
43+ */
44+ getRoom : ( id : string ) => Room | null ;
45+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { AccountAuthApiExtension } from "./auth.ts";
1717import { ProfileApiExtension } from "./profile.ts" ;
1818import { ExtrasApi } from "./extras.ts" ;
1919import { BuiltinsApi } from "./builtins.ts" ;
20+ import { ClientApi } from "./client.ts" ;
2021
2122/**
2223 * Module interface for modules to implement.
@@ -123,6 +124,11 @@ export interface Api
123124 */
124125 readonly extras : ExtrasApi ;
125126
127+ /**
128+ * Access some very specific functionality from the client.
129+ */
130+ readonly client : ClientApi ;
131+
126132 /**
127133 * Create a ReactDOM root for rendering React components.
128134 * Exposed to allow modules to avoid needing to bundle their own ReactDOM.
Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ export type * from "./api/dialog";
2020export type * from "./api/profile" ;
2121export type * from "./api/navigation" ;
2222export type * from "./api/builtins" ;
23+ export type * from "./api/client" ;
2324export * from "./api/watchable" ;
You can’t perform that action at this time.
0 commit comments