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