27 lines
572 B
TypeScript
27 lines
572 B
TypeScript
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]));
|
|
}
|
|
}
|