-
Notifications
You must be signed in to change notification settings - Fork 6
Allow modules to access a part of MatrixClient functionality
#109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f79149f
Introduce an abstraction for Room
MidhunSureshR bd5250d
Make field protected so that Watchable can be extended
MidhunSureshR dc29052
Add client API
MidhunSureshR 29dea8d
Update api doc
MidhunSureshR 971bc52
Change method to property
MidhunSureshR 29ad0f1
Fix comment
MidhunSureshR 652b8a7
Add onFirstWatch and onLastWatch to watchable
MidhunSureshR e80a90f
Return watchable in account data api
MidhunSureshR 734d8a9
Update API doc
MidhunSureshR b91a280
Add Stores API
MidhunSureshR faefbd3
Updat api doc
MidhunSureshR 6cf3042
Convert to property
MidhunSureshR 833be72
Return a watchable
MidhunSureshR 0b38fa8
Update API doc
MidhunSureshR a284c9c
Merge pull request #110 from element-hq/midhun/multiroom/stores-api
MidhunSureshR File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| Copyright 2025 New Vector Ltd. | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial | ||
| Please see LICENSE files in the repository root for full details. | ||
| */ | ||
|
|
||
| import type { Room } from "../models/Room"; | ||
| import { Watchable } from "./watchable"; | ||
|
|
||
| /** | ||
| * Modify account data stored on the homeserver. | ||
| * @public | ||
| */ | ||
| export interface AccountDataApi { | ||
| /** | ||
| * Returns a watchable with account data for this event type. | ||
| */ | ||
| get(eventType: string): Watchable<unknown>; | ||
| /** | ||
| * Set account data on the homeserver. | ||
| */ | ||
| set(eventType: string, content: unknown): Promise<void>; | ||
| /** | ||
| * Changes the content of this event to be empty. | ||
| */ | ||
| delete(eventType: string): Promise<void>; | ||
| } | ||
|
|
||
| /** | ||
| * Access some limited functionality from the SDK. | ||
| * @public | ||
| */ | ||
| export interface ClientApi { | ||
| /** | ||
| * Use this to modify account data on the homeserver. | ||
| */ | ||
| accountData: AccountDataApi; | ||
|
|
||
| /** | ||
| * Fetch room by id from SDK. | ||
| * @param id - Id of the room to get | ||
| * @returns Room object from SDK | ||
| */ | ||
| getRoom: (id: string) => Room | null; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| Copyright 2025 New Vector Ltd. | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial | ||
| Please see LICENSE files in the repository root for full details. | ||
| */ | ||
|
|
||
| import type { Room } from "../models/Room"; | ||
| import { Watchable } from "./watchable"; | ||
|
|
||
| /** | ||
| * Provides some basic functionality of the Room List Store from element-web. | ||
| * @public | ||
| */ | ||
| export interface RoomListStoreApi { | ||
| /** | ||
| * Returns a watchable holding a flat list of sorted room. | ||
| */ | ||
| getRooms(): Watchable<Room[]>; | ||
|
|
||
| /** | ||
| * Returns a promise that resolves when RLS is ready. | ||
| */ | ||
| waitForReady(): Promise<void>; | ||
| } | ||
|
|
||
| /** | ||
| * Provides access to certain stores from element-web. | ||
| * @public | ||
| */ | ||
| export interface StoresApi { | ||
| /** | ||
| * Use this to access limited functionality of the RLS from element-web. | ||
| */ | ||
| roomListStore: RoomListStoreApi; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| Copyright 2025 New Vector Ltd. | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial | ||
| Please see LICENSE files in the repository root for full details. | ||
| */ | ||
|
|
||
| import { Watchable } from "../api/watchable"; | ||
|
|
||
| /** | ||
| * Represents a room from element-web. | ||
| * @public | ||
| */ | ||
| export interface Room { | ||
| /** | ||
| * Id of this room. | ||
| */ | ||
| id: string; | ||
| /** | ||
| * {@link Watchable} holding the name for this room. | ||
| */ | ||
| name: Watchable<string>; | ||
| /** | ||
| * Get the timestamp of the last message in this room. | ||
| * @returns last active timestamp | ||
| */ | ||
| getLastActiveTimestamp: () => number; | ||
|
MidhunSureshR marked this conversation as resolved.
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.