Merge pull request #814 from vector-im/leave-room-hsapi

Add kick, ban & unban api
This commit is contained in:
Robert Long 2022-07-25 21:42:55 -07:00 committed by GitHub
commit 643f43413e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -285,6 +285,27 @@ export class HomeServerApi {
return this._post(`/rooms/${encodeURIComponent(roomId)}/forget`, {}, {}, options); return this._post(`/rooms/${encodeURIComponent(roomId)}/forget`, {}, {}, options);
} }
kick(roomId: string, userId: string, reason?: string, options?: BaseRequestOptions): IHomeServerRequest {
return this._post(`/rooms/${encodeURIComponent(roomId)}/kick`, {}, {
user_id: userId,
reason: reason,
}, options);
}
ban(roomId: string, userId: string, reason?: string, options?: BaseRequestOptions): IHomeServerRequest {
return this._post(`/rooms/${encodeURIComponent(roomId)}/ban`, {}, {
user_id: userId,
reason: reason,
}, options);
}
unban(roomId: string, userId: string, reason?: string, options?: BaseRequestOptions): IHomeServerRequest {
return this._post(`/rooms/${encodeURIComponent(roomId)}/unban`, {}, {
user_id: userId,
reason: reason,
}, options);
}
logout(options?: BaseRequestOptions): IHomeServerRequest { logout(options?: BaseRequestOptions): IHomeServerRequest {
return this._post(`/logout`, {}, {}, options); return this._post(`/logout`, {}, {}, options);
} }