mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-01 01:59:55 +00:00
Add Modlog Filters (#65)
* Add types for Modlog Filters * Update for optionals
This commit is contained in:
parent
8d0b25d862
commit
c3be80f46c
4 changed files with 98 additions and 18 deletions
|
@ -2,7 +2,7 @@ import { Option } from "@sniptt/monads";
|
|||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import "reflect-metadata";
|
||||
import { toOption, toUndefined } from "../../utils";
|
||||
import { ListingType, SearchType, SortType } from "../others";
|
||||
import { ListingType, SearchType, SortType, ModlogActionType } from "../others";
|
||||
import {
|
||||
AdminPurgeCommentView,
|
||||
AdminPurgeCommunityView,
|
||||
|
@ -96,6 +96,7 @@ export class SearchResponse {
|
|||
users: PersonViewSafe[];
|
||||
}
|
||||
|
||||
|
||||
export class GetModlog {
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
|
@ -117,7 +118,11 @@ export class GetModlog {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
auth: Option<string>;
|
||||
|
||||
type_: ModlogActionType;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
other_person_id: Option<number>;
|
||||
constructor(init: GetModlog) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
@ -212,8 +217,11 @@ export class CreateSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
default_post_listing_type: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: CreateSite) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
@ -284,8 +292,12 @@ export class EditSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
default_post_listing_type: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
auth: string;
|
||||
|
||||
|
||||
constructor(init: EditSite) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
|
|
@ -182,6 +182,28 @@ export enum SearchType {
|
|||
Url = "Url",
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod log action types
|
||||
*/
|
||||
export enum ModlogActionType {
|
||||
All = "All",
|
||||
ModRemovePost = "ModRemovePost",
|
||||
ModLockPost = "ModLockPost",
|
||||
ModStickyPost = "ModStickyPost",
|
||||
ModRemoveComment = "ModRemoveComment",
|
||||
ModRemoveCommunity = "ModRemoveCommunity",
|
||||
ModBanFromCommunity = "ModBanFromCommunity",
|
||||
ModAddCommunity = "ModAddCommunity",
|
||||
ModTransferCommunity = "ModTransferCommunity",
|
||||
ModAdd = "ModAdd",
|
||||
ModBan = "ModBan",
|
||||
ModHideCommunity = "ModHideCommunity",
|
||||
AdminPurgePerson = "AdminPurgePerson",
|
||||
AdminPurgeCommunity = "AdminPurgeCommunity",
|
||||
AdminPurgePost = "AdminPurgePost",
|
||||
AdminPurgeComment = "AdminPurgeComment",
|
||||
}
|
||||
|
||||
/**
|
||||
* Different Subscribed states
|
||||
*/
|
||||
|
|
|
@ -111,6 +111,10 @@ export class Site {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
legal_information: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
}
|
||||
|
||||
export class PrivateMessage {
|
||||
|
|
|
@ -208,8 +208,11 @@ export class CommentReportView {
|
|||
export class ModAddCommunityView {
|
||||
@Type(() => ModAddCommunity)
|
||||
mod_add_community: ModAddCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -219,8 +222,11 @@ export class ModAddCommunityView {
|
|||
export class ModTransferCommunityView {
|
||||
@Type(() => ModTransferCommunity)
|
||||
mod_transfer_community: ModTransferCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -230,8 +236,11 @@ export class ModTransferCommunityView {
|
|||
export class ModAddView {
|
||||
@Type(() => ModAdd)
|
||||
mod_add: ModAdd;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => PersonSafe)
|
||||
modded_person: PersonSafe;
|
||||
}
|
||||
|
@ -239,8 +248,11 @@ export class ModAddView {
|
|||
export class ModBanFromCommunityView {
|
||||
@Type(() => ModBanFromCommunity)
|
||||
mod_ban_from_community: ModBanFromCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -250,8 +262,11 @@ export class ModBanFromCommunityView {
|
|||
export class ModBanView {
|
||||
@Type(() => ModBan)
|
||||
mod_ban: ModBan;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => PersonSafe)
|
||||
banned_person: PersonSafe;
|
||||
}
|
||||
|
@ -259,8 +274,11 @@ export class ModBanView {
|
|||
export class ModLockPostView {
|
||||
@Type(() => ModLockPost)
|
||||
mod_lock_post: ModLockPost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -270,8 +288,11 @@ export class ModLockPostView {
|
|||
export class ModRemoveCommentView {
|
||||
@Type(() => ModRemoveComment)
|
||||
mod_remove_comment: ModRemoveComment;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Comment)
|
||||
comment: Comment;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -285,8 +306,11 @@ export class ModRemoveCommentView {
|
|||
export class ModRemoveCommunityView {
|
||||
@Type(() => ModRemoveCommunity)
|
||||
mod_remove_community: ModRemoveCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
}
|
||||
|
@ -294,8 +318,11 @@ export class ModRemoveCommunityView {
|
|||
export class ModRemovePostView {
|
||||
@Type(() => ModRemovePost)
|
||||
mod_remove_post: ModRemovePost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -305,8 +332,11 @@ export class ModRemovePostView {
|
|||
export class ModStickyPostView {
|
||||
@Type(() => ModStickyPost)
|
||||
mod_sticky_post: ModStickyPost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -316,22 +346,31 @@ export class ModStickyPostView {
|
|||
export class AdminPurgeCommunityView {
|
||||
@Type(() => AdminPurgeCommunity)
|
||||
admin_purge_community: AdminPurgeCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
export class AdminPurgePersonView {
|
||||
@Type(() => AdminPurgePerson)
|
||||
admin_purge_person: AdminPurgePerson;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
export class AdminPurgePostView {
|
||||
@Type(() => AdminPurgePost)
|
||||
admin_purge_post: AdminPurgePost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
}
|
||||
|
@ -339,8 +378,11 @@ export class AdminPurgePostView {
|
|||
export class AdminPurgeCommentView {
|
||||
@Type(() => AdminPurgeComment)
|
||||
admin_purge_comment: AdminPurgeComment;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue