From 7fc438c235088f72fce8084d7ee8bb683ad17c9c Mon Sep 17 00:00:00 2001 From: panteliselef Date: Mon, 12 Feb 2024 10:47:50 +0200 Subject: [PATCH] feat(backend): Add `unBanUser`, `lockUser`,`unlockUser` to UserApi --- .changeset/brown-masks-wonder.md | 5 ++++ packages/backend/src/api/endpoints/UserApi.ts | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .changeset/brown-masks-wonder.md diff --git a/.changeset/brown-masks-wonder.md b/.changeset/brown-masks-wonder.md new file mode 100644 index 00000000000..66127ffb8af --- /dev/null +++ b/.changeset/brown-masks-wonder.md @@ -0,0 +1,5 @@ +--- +'@clerk/backend': minor +--- + +Add `unbanUser`, `lockUser`, and `unlockUser` methods to the UserAPI class. diff --git a/packages/backend/src/api/endpoints/UserApi.ts b/packages/backend/src/api/endpoints/UserApi.ts index 65f0970f057..d67f706b770 100644 --- a/packages/backend/src/api/endpoints/UserApi.ts +++ b/packages/backend/src/api/endpoints/UserApi.ts @@ -244,4 +244,28 @@ export class UserAPI extends AbstractAPI { path: joinPaths(basePath, userId, 'ban'), }); } + + public async unbanUser(userId: string) { + this.requireId(userId); + return this.request({ + method: 'POST', + path: joinPaths(basePath, userId, 'unban'), + }); + } + + public async lockUser(userId: string) { + this.requireId(userId); + return this.request({ + method: 'POST', + path: joinPaths(basePath, userId, 'lock'), + }); + } + + public async unlockUser(userId: string) { + this.requireId(userId); + return this.request({ + method: 'POST', + path: joinPaths(basePath, userId, 'unlock'), + }); + } }