diff --git a/src/http.ts b/src/http.ts index 420ef3e..be445a1 100644 --- a/src/http.ts +++ b/src/http.ts @@ -38,6 +38,7 @@ import { import { AddAdmin, AddAdminResponse, + BannedPersonsResponse, BanPerson, BanPersonResponse, BlockPerson, @@ -48,6 +49,7 @@ import { DeleteAccountResponse, DeletePrivateMessage, EditPrivateMessage, + GetBannedPersons, GetCaptchaResponse, GetPersonDetails, GetPersonDetailsResponse, @@ -584,6 +586,15 @@ export class LemmyHttp { return this.wrapper(HttpType.Post, "/user/ban", form); } + /** + * Get a list of banned users + */ + async getBannedPersons( + form: GetBannedPersons + ): Promise { + return this.wrapper(HttpType.Get, "/user/banned", form); + } + /** * Block a person. */ diff --git a/src/interfaces/api/person.ts b/src/interfaces/api/person.ts index 644f87b..c85b1c6 100644 --- a/src/interfaces/api/person.ts +++ b/src/interfaces/api/person.ts @@ -315,3 +315,11 @@ export interface BlockPersonResponse { person_view: PersonViewSafe; blocked: boolean; } + +export interface GetBannedPersons { + auth: string; +} + +export interface BannedPersonsResponse { + banned: PersonViewSafe[]; +} diff --git a/src/interfaces/api/site.ts b/src/interfaces/api/site.ts index 9e8623c..387ff74 100644 --- a/src/interfaces/api/site.ts +++ b/src/interfaces/api/site.ts @@ -131,7 +131,6 @@ export interface GetSiteResponse { */ site_view?: SiteView; admins: PersonViewSafe[]; - banned: PersonViewSafe[]; online: number; version: string; /** diff --git a/src/interfaces/others.ts b/src/interfaces/others.ts index 432829e..23f2d7c 100644 --- a/src/interfaces/others.ts +++ b/src/interfaces/others.ts @@ -46,6 +46,7 @@ export enum UserOperation { ListRegistrationApplications, ApproveRegistrationApplication, BanPerson, + GetBannedPersons, Search, ResolveObject, MarkAllAsRead, diff --git a/src/websocket.ts b/src/websocket.ts index 39d206f..3fcd228 100644 --- a/src/websocket.ts +++ b/src/websocket.ts @@ -33,6 +33,7 @@ import { DeleteAccount, DeletePrivateMessage, EditPrivateMessage, + GetBannedPersons, GetPersonDetails, GetPersonMentions, GetPrivateMessages, @@ -401,6 +402,13 @@ export class LemmyWebsocket { return wrapper(UserOperation.BanPerson, form); } + /** + * Get a list of banned users + */ + getBannedPersons(form: GetBannedPersons) { + return wrapper(UserOperation.GetBannedPersons, form); + } + /** * Add an admin to your site. */