From 40abc50478b14ebd481a39018fc757b2b4d07cef Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Tue, 29 Nov 2022 19:56:45 +0530 Subject: [PATCH] Add method to get/set room account data --- src/matrix/net/HomeServerApi.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index c37e49fc..a4cea6dd 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -378,6 +378,24 @@ export class HomeServerApi { return this._put(`/user/${encodeURIComponent(ownUserId)}/account_data/${encodeURIComponent(type)}`, {}, content, options); } + roomAccountData(ownUserId: string, roomId: string, type: string, options?: BaseRequestOptions): IHomeServerRequest { + return this._get( + `/user/${encodeURIComponent(ownUserId)}/rooms/${encodeURIComponent(roomId)}/account_data/${encodeURIComponent(type)}`, + undefined, + undefined, + options + ); + } + + setRoomAccountData(ownUserId: string, roomId: string, type: string, content: Record, options?: BaseRequestOptions): IHomeServerRequest { + return this._put( + `/user/${encodeURIComponent(ownUserId)}/rooms/${encodeURIComponent(roomId)}/account_data/${encodeURIComponent(type)}`, + {}, + content, + options + ); + } + getTurnServer(options?: BaseRequestOptions): IHomeServerRequest { return this._get(`/voip/turnServer`, undefined, undefined, options); }