Display the list of spaces
This commit is contained in:
5
matrixgw_frontend/src/api/matrix/MatrixApiEvent.ts
Normal file
5
matrixgw_frontend/src/api/matrix/MatrixApiEvent.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface MatrixEvent {
|
||||
id: string;
|
||||
time: number;
|
||||
sender: string;
|
||||
}
|
||||
12
matrixgw_frontend/src/api/matrix/MatrixApiMedia.ts
Normal file
12
matrixgw_frontend/src/api/matrix/MatrixApiMedia.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { APIClient } from "../ApiClient";
|
||||
|
||||
export class MatrixApiMedia {
|
||||
/**
|
||||
* Get media URL
|
||||
*/
|
||||
static MediaURL(url: string, thumbnail: boolean): string {
|
||||
return `${APIClient.ActualBackendURL()}/matrix/media/${encodeURIComponent(
|
||||
url
|
||||
)}?thumbnail=${thumbnail}`;
|
||||
}
|
||||
}
|
||||
26
matrixgw_frontend/src/api/matrix/MatrixApiProfile.ts
Normal file
26
matrixgw_frontend/src/api/matrix/MatrixApiProfile.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { APIClient } from "../ApiClient";
|
||||
|
||||
export interface UserProfile {
|
||||
user_id: string;
|
||||
display_name?: string;
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
export type UsersMap = Map<string, UserProfile>;
|
||||
|
||||
export class MatrixApiProfile {
|
||||
/**
|
||||
* Get multiple profiles information
|
||||
*/
|
||||
static async GetMultiple(ids: string[]): Promise<UsersMap> {
|
||||
const list: UserProfile[] = (
|
||||
await APIClient.exec({
|
||||
method: "POST",
|
||||
uri: "/matrix/profile/get_multiple",
|
||||
jsonData: ids,
|
||||
})
|
||||
).data;
|
||||
|
||||
return new Map(list.map((e) => [e.user_id, e]));
|
||||
}
|
||||
}
|
||||
27
matrixgw_frontend/src/api/matrix/MatrixApiRoom.ts
Normal file
27
matrixgw_frontend/src/api/matrix/MatrixApiRoom.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { APIClient } from "../ApiClient";
|
||||
import type { MatrixEvent } from "./MatrixApiEvent";
|
||||
|
||||
export interface Room {
|
||||
id: string;
|
||||
name?: string;
|
||||
members: string[];
|
||||
avatar?: string;
|
||||
is_space?: boolean;
|
||||
parents: string[];
|
||||
number_unread_messages: number;
|
||||
latest_event?: MatrixEvent;
|
||||
}
|
||||
|
||||
export class MatrixApiRoom {
|
||||
/**
|
||||
* Get the list of joined rooms
|
||||
*/
|
||||
static async ListJoined(): Promise<Room[]> {
|
||||
return (
|
||||
await APIClient.exec({
|
||||
method: "GET",
|
||||
uri: "/matrix/room/joined",
|
||||
})
|
||||
).data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user