Skip to content

Commit 52751f8

Browse files
committed
Add suspend/unsuspend synapse admin apis.
1 parent fe53d1d commit 52751f8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/SynapseAdmin/SynapseAdminClient.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,20 @@ export class SynapseAdminClient {
216216
return Value.Decode(RoomDetailsResponse, value);
217217
}, resultifyBotSDKRequestErrorWith404AsUndefined);
218218
}
219+
220+
public async suspendUser(userID: StringUserID): Promise<ActionResult<void>> {
221+
const endpoint = `/_synapse/admin/v1/suspend/${encodeURIComponent(userID)}`;
222+
return await this.client
223+
.doRequest('PUT', endpoint, null, { suspend: true })
224+
.then(() => Ok(undefined), resultifyBotSDKRequestError);
225+
}
226+
227+
public async unsuspendUser(
228+
userID: StringUserID
229+
): Promise<ActionResult<void>> {
230+
const endpoint = `/_synapse/admin/v1/suspend/${encodeURIComponent(userID)}`;
231+
return await this.client
232+
.doRequest('PUT', endpoint, null, { suspend: false })
233+
.then(() => Ok(undefined), resultifyBotSDKRequestError);
234+
}
219235
}

0 commit comments

Comments
 (0)