mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 22:31:12 +00:00
Adding toOption function.
This commit is contained in:
parent
06a70b1caa
commit
0c451fe2b6
9 changed files with 262 additions and 258 deletions
|
@ -1,13 +1,13 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../../utils";
|
import { toOption, toUndefined } from "../../utils";
|
||||||
import { ListingType, SortType } from "../others";
|
import { ListingType, SortType } from "../others";
|
||||||
import { CommentReportView, CommentView } from "../views";
|
import { CommentReportView, CommentView } from "../views";
|
||||||
|
|
||||||
export class CreateComment {
|
export class CreateComment {
|
||||||
content: string;
|
content: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
parent_id: Option<number>;
|
parent_id: Option<number>;
|
||||||
|
@ -15,7 +15,7 @@ export class CreateComment {
|
||||||
/**
|
/**
|
||||||
* An optional front end ID, to tell which is comment is coming back.
|
* An optional front end ID, to tell which is comment is coming back.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
form_id: Option<string>;
|
form_id: Option<string>;
|
||||||
|
@ -32,7 +32,7 @@ export class EditComment {
|
||||||
/**
|
/**
|
||||||
* An optional front end ID, to tell which is comment is coming back.
|
* An optional front end ID, to tell which is comment is coming back.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
form_id: Option<string>;
|
form_id: Option<string>;
|
||||||
|
@ -62,7 +62,7 @@ export class DeleteComment {
|
||||||
export class RemoveComment {
|
export class RemoveComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
|
@ -103,7 +103,7 @@ export class CommentResponse {
|
||||||
/**
|
/**
|
||||||
* An optional front end ID, to tell which is comment is coming back.
|
* An optional front end ID, to tell which is comment is coming back.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
form_id: Option<string>;
|
form_id: Option<string>;
|
||||||
|
@ -126,35 +126,35 @@ export class CreateCommentLike {
|
||||||
* To get posts for a federated community by name, use `name@instance.tld` .
|
* To get posts for a federated community by name, use `name@instance.tld` .
|
||||||
*/
|
*/
|
||||||
export class GetComments {
|
export class GetComments {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
type_: Option<ListingType>;
|
type_: Option<ListingType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_name: Option<string>;
|
community_name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
saved_only: Option<boolean>;
|
saved_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -198,18 +198,18 @@ export class ResolveCommentReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommentReports {
|
export class ListCommentReports {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
/**
|
/**
|
||||||
* if no community is given, it returns reports for all communities moderated by the auth user.
|
* if no community is given, it returns reports for all communities moderated by the auth user.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
|
@ -217,7 +217,7 @@ export class ListCommentReports {
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unresolved_only: Option<boolean>;
|
unresolved_only: Option<boolean>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../../utils";
|
import { toOption, toUndefined } from "../../utils";
|
||||||
import { ListingType, SortType } from "../others";
|
import { ListingType, SortType } from "../others";
|
||||||
import { Site } from "../source";
|
import { Site } from "../source";
|
||||||
import {
|
import {
|
||||||
|
@ -16,15 +16,15 @@ import {
|
||||||
* To get a federated community by name, use `name@instance.tld` .
|
* To get a federated community by name, use `name@instance.tld` .
|
||||||
*/
|
*/
|
||||||
export class GetCommunity {
|
export class GetCommunity {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
id: Option<number>;
|
id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
name: Option<string>;
|
name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -36,7 +36,7 @@ export class GetCommunity {
|
||||||
|
|
||||||
export class GetCommunityResponse {
|
export class GetCommunityResponse {
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => Site)
|
@Type(() => Site)
|
||||||
|
@ -49,23 +49,23 @@ export class GetCommunityResponse {
|
||||||
export class CreateCommunity {
|
export class CreateCommunity {
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
nsfw: Option<boolean>;
|
nsfw: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
posting_restricted_to_mods: Option<boolean>;
|
posting_restricted_to_mods: Option<boolean>;
|
||||||
|
@ -82,23 +82,23 @@ export class CommunityResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommunities {
|
export class ListCommunities {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
type_: Option<ListingType>;
|
type_: Option<ListingType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -121,18 +121,18 @@ export class BanFromCommunity {
|
||||||
/**
|
/**
|
||||||
* Removes/Restores their comments and posts for that community.
|
* Removes/Restores their comments and posts for that community.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
remove_data: Option<boolean>;
|
remove_data: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<number>;
|
expires: Option<number>;
|
||||||
|
@ -170,27 +170,27 @@ export class AddModToCommunityResponse {
|
||||||
*/
|
*/
|
||||||
export class EditCommunity {
|
export class EditCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
title: Option<string>;
|
title: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
nsfw: Option<boolean>;
|
nsfw: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
posting_restricted_to_mods: Option<boolean>;
|
posting_restricted_to_mods: Option<boolean>;
|
||||||
|
@ -217,14 +217,14 @@ export class DeleteCommunity {
|
||||||
export class RemoveCommunity {
|
export class RemoveCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<number>;
|
expires: Option<number>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../../utils";
|
import { toOption, toUndefined } from "../../utils";
|
||||||
import { SortType } from "../others";
|
import { SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -31,7 +31,7 @@ export class Register {
|
||||||
/**
|
/**
|
||||||
* Email is mandatory if email verification is enabled on the server
|
* Email is mandatory if email verification is enabled on the server
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
email: Option<string>;
|
email: Option<string>;
|
||||||
|
@ -41,22 +41,22 @@ export class Register {
|
||||||
/**
|
/**
|
||||||
* Captcha is only checked if these are enabled in the server.
|
* Captcha is only checked if these are enabled in the server.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
captcha_uuid: Option<string>;
|
captcha_uuid: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
captcha_answer: Option<string>;
|
captcha_answer: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
honeypot: Option<string>;
|
honeypot: Option<string>;
|
||||||
/**
|
/**
|
||||||
* An answer is mandatory if require application is enabled on the server
|
* An answer is mandatory if require application is enabled on the server
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
answer: Option<string>;
|
answer: Option<string>;
|
||||||
|
@ -72,7 +72,7 @@ export class GetCaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* Will be undefined if captchas are disabled.
|
* Will be undefined if captchas are disabled.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => CaptchaResponse)
|
@Type(() => CaptchaResponse)
|
||||||
|
@ -88,7 +88,7 @@ export class CaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* A Base64 encoded wav file.
|
* A Base64 encoded wav file.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
wav: Option<string>;
|
wav: Option<string>;
|
||||||
|
@ -100,7 +100,7 @@ export class CaptchaResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SaveUserSettings {
|
export class SaveUserSettings {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_nsfw: Option<boolean>;
|
show_nsfw: Option<boolean>;
|
||||||
|
@ -108,7 +108,7 @@ export class SaveUserSettings {
|
||||||
/**
|
/**
|
||||||
* Default for this is `browser`.
|
* Default for this is `browser`.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
theme: Option<string>;
|
theme: Option<string>;
|
||||||
|
@ -118,7 +118,7 @@ export class SaveUserSettings {
|
||||||
*
|
*
|
||||||
* The Sort types from above, zero indexed as a number
|
* The Sort types from above, zero indexed as a number
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
default_sort_type: Option<number>;
|
default_sort_type: Option<number>;
|
||||||
|
@ -128,63 +128,63 @@ export class SaveUserSettings {
|
||||||
*
|
*
|
||||||
* Post listing types are `All, Subscribed, Community`
|
* Post listing types are `All, Subscribed, Community`
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
default_listing_type: Option<number>;
|
default_listing_type: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
lang: Option<string>;
|
lang: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
avatar: Option<string>;
|
avatar: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
display_name: Option<string>;
|
display_name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
email: Option<string>;
|
email: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
bio: Option<string>;
|
bio: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
matrix_user_id: Option<string>;
|
matrix_user_id: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_avatars: Option<boolean>;
|
show_avatars: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_scores: Option<boolean>;
|
show_scores: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
send_notifications_to_email: Option<boolean>;
|
send_notifications_to_email: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
bot_account: Option<boolean>;
|
bot_account: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_bot_accounts: Option<boolean>;
|
show_bot_accounts: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_read_posts: Option<boolean>;
|
show_read_posts: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
show_new_post_notifs: Option<boolean>;
|
show_new_post_notifs: Option<boolean>;
|
||||||
|
@ -213,7 +213,7 @@ export class LoginResponse {
|
||||||
/**
|
/**
|
||||||
* This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
* This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
jwt: Option<string>;
|
jwt: Option<string>;
|
||||||
|
@ -222,38 +222,38 @@ export class LoginResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonDetails {
|
export class GetPersonDetails {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
person_id: Option<number>;
|
person_id: Option<number>;
|
||||||
/**
|
/**
|
||||||
* To get details for a federated user, use `person@instance.tld`.
|
* To get details for a federated user, use `person@instance.tld`.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
username: Option<string>;
|
username: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
saved_only: Option<boolean>;
|
saved_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -314,18 +314,18 @@ export class BanPerson {
|
||||||
/**
|
/**
|
||||||
* Removes/Restores their comments, posts, and communities
|
* Removes/Restores their comments, posts, and communities
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
remove_data: Option<boolean>;
|
remove_data: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<number>;
|
expires: Option<number>;
|
||||||
|
@ -343,19 +343,19 @@ export class BanPersonResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetReplies {
|
export class GetReplies {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unread_only: Option<boolean>;
|
unread_only: Option<boolean>;
|
||||||
|
@ -367,19 +367,19 @@ export class GetReplies {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonMentions {
|
export class GetPersonMentions {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unread_only: Option<boolean>;
|
unread_only: Option<boolean>;
|
||||||
|
@ -480,15 +480,15 @@ export class MarkPrivateMessageAsRead {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPrivateMessages {
|
export class GetPrivateMessages {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unread_only: Option<boolean>;
|
unread_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
|
@ -513,7 +513,7 @@ export class GetReportCount {
|
||||||
/**
|
/**
|
||||||
* If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates.
|
* If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
|
@ -525,7 +525,7 @@ export class GetReportCount {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetReportCountResponse {
|
export class GetReportCountResponse {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../../utils";
|
import { toOption, toUndefined } from "../../utils";
|
||||||
import { ListingType, SiteMetadata, SortType } from "../others";
|
import { ListingType, SiteMetadata, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -13,20 +13,20 @@ import {
|
||||||
|
|
||||||
export class CreatePost {
|
export class CreatePost {
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
url: Option<string>;
|
url: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
body: Option<string>;
|
body: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
nsfw: Option<boolean>;
|
nsfw: Option<boolean>;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
honeypot: Option<string>;
|
honeypot: Option<string>;
|
||||||
|
@ -44,7 +44,7 @@ export class PostResponse {
|
||||||
|
|
||||||
export class GetPost {
|
export class GetPost {
|
||||||
id: number;
|
id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -67,38 +67,38 @@ export class GetPostResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPosts {
|
export class GetPosts {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
type_: Option<ListingType>;
|
type_: Option<ListingType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
/**
|
/**
|
||||||
* To get posts for a federated community by name, use `name@instance.tld` .
|
* To get posts for a federated community by name, use `name@instance.tld` .
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_name: Option<string>;
|
community_name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
saved_only: Option<boolean>;
|
saved_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -129,19 +129,19 @@ export class CreatePostLike {
|
||||||
|
|
||||||
export class EditPost {
|
export class EditPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
name: Option<string>;
|
name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
url: Option<string>;
|
url: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
body: Option<string>;
|
body: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
nsfw: Option<boolean>;
|
nsfw: Option<boolean>;
|
||||||
|
@ -168,7 +168,7 @@ export class DeletePost {
|
||||||
export class RemovePost {
|
export class RemovePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
|
@ -257,25 +257,25 @@ export class ResolvePostReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListPostReports {
|
export class ListPostReports {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
/**
|
/**
|
||||||
* if no community is given, it returns reports for all communities moderated by the auth user.
|
* if no community is given, it returns reports for all communities moderated by the auth user.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unresolved_only: Option<boolean>;
|
unresolved_only: Option<boolean>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../../utils";
|
import { toOption, toUndefined } from "../../utils";
|
||||||
import { ListingType, SearchType, SortType } from "../others";
|
import { ListingType, SearchType, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -35,39 +35,39 @@ export class Search {
|
||||||
* The search query string.
|
* The search query string.
|
||||||
*/
|
*/
|
||||||
q: string;
|
q: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
type_: Option<SearchType>;
|
type_: Option<SearchType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_name: Option<string>;
|
community_name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
creator_id: Option<number>;
|
creator_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sort: Option<SortType>;
|
sort: Option<SortType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
listing_type: Option<ListingType>;
|
listing_type: Option<ListingType>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -93,23 +93,23 @@ export class SearchResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetModlog {
|
export class GetModlog {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
mod_person_id: Option<number>;
|
mod_person_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_id: Option<number>;
|
community_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -144,59 +144,59 @@ export class GetModlogResponse {
|
||||||
|
|
||||||
export class CreateSite {
|
export class CreateSite {
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
enable_downvotes: Option<boolean>;
|
enable_downvotes: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
open_registration: Option<boolean>;
|
open_registration: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
enable_nsfw: Option<boolean>;
|
enable_nsfw: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_creation_admin_only: Option<boolean>;
|
community_creation_admin_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
require_email_verification: Option<boolean>;
|
require_email_verification: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
require_application: Option<boolean>;
|
require_application: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
application_question: Option<string>;
|
application_question: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
private_instance: Option<boolean>;
|
private_instance: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
default_theme: Option<string>;
|
default_theme: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@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>;
|
||||||
|
@ -208,67 +208,67 @@ export class CreateSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditSite {
|
export class EditSite {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
name: Option<string>;
|
name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
enable_downvotes: Option<boolean>;
|
enable_downvotes: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
open_registration: Option<boolean>;
|
open_registration: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
enable_nsfw: Option<boolean>;
|
enable_nsfw: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
community_creation_admin_only: Option<boolean>;
|
community_creation_admin_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
require_email_verification: Option<boolean>;
|
require_email_verification: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
require_application: Option<boolean>;
|
require_application: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
application_question: Option<string>;
|
application_question: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
private_instance: Option<boolean>;
|
private_instance: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
default_theme: Option<string>;
|
default_theme: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
legal_information: Option<string>;
|
legal_information: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@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>;
|
||||||
|
@ -280,7 +280,7 @@ export class EditSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetSite {
|
export class GetSite {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -299,7 +299,7 @@ export class GetSiteResponse {
|
||||||
/**
|
/**
|
||||||
* Optional, because the site might not be set up yet.
|
* Optional, because the site might not be set up yet.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => SiteView)
|
@Type(() => SiteView)
|
||||||
|
@ -311,12 +311,12 @@ export class GetSiteResponse {
|
||||||
/**
|
/**
|
||||||
* If you're logged in, you'll get back extra user info.
|
* If you're logged in, you'll get back extra user info.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => MyUserInfo)
|
@Type(() => MyUserInfo)
|
||||||
my_user: Option<MyUserInfo>;
|
my_user: Option<MyUserInfo>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => FederatedInstances)
|
@Type(() => FederatedInstances)
|
||||||
|
@ -370,11 +370,11 @@ export class SaveSiteConfig {
|
||||||
|
|
||||||
export class FederatedInstances {
|
export class FederatedInstances {
|
||||||
linked: string[];
|
linked: string[];
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
allowed: Option<string[]>;
|
allowed: Option<string[]>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
blocked: Option<string[]>;
|
blocked: Option<string[]>;
|
||||||
|
@ -386,7 +386,7 @@ export class FederatedInstances {
|
||||||
|
|
||||||
export class ResolveObject {
|
export class ResolveObject {
|
||||||
q: string;
|
q: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
auth: Option<string>;
|
auth: Option<string>;
|
||||||
|
@ -397,22 +397,22 @@ export class ResolveObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolveObjectResponse {
|
export class ResolveObjectResponse {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => CommentView)
|
@Type(() => CommentView)
|
||||||
comment: Option<CommentView>;
|
comment: Option<CommentView>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PostView)
|
@Type(() => PostView)
|
||||||
post: Option<PostView>;
|
post: Option<PostView>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => CommunityView)
|
@Type(() => CommunityView)
|
||||||
community: Option<CommunityView>;
|
community: Option<CommunityView>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PersonViewSafe)
|
@Type(() => PersonViewSafe)
|
||||||
|
@ -423,15 +423,15 @@ export class ListRegistrationApplications {
|
||||||
/**
|
/**
|
||||||
* Only shows the unread applications (IE those without an admin actor)
|
* Only shows the unread applications (IE those without an admin actor)
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
unread_only: Option<boolean>;
|
unread_only: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
page: Option<number>;
|
page: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
limit: Option<number>;
|
limit: Option<number>;
|
||||||
|
@ -449,7 +449,7 @@ export class ListRegistrationApplicationsResponse {
|
||||||
export class ApproveRegistrationApplication {
|
export class ApproveRegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
approve: boolean;
|
approve: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
deny_reason: Option<string>;
|
deny_reason: Option<string>;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
import { Option } from "@sniptt/monads";
|
||||||
import { Expose, Transform } from "class-transformer";
|
import { Expose, Transform } from "class-transformer";
|
||||||
import { toUndefined } from "../utils";
|
import { toOption, toUndefined } from "../utils";
|
||||||
export const VERSION = "v3";
|
export const VERSION = "v3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,19 +155,19 @@ export enum SearchType {
|
||||||
* A holder for a site's metadata ( such as opengraph tags ), used for post links.
|
* A holder for a site's metadata ( such as opengraph tags ), used for post links.
|
||||||
*/
|
*/
|
||||||
export class SiteMetadata {
|
export class SiteMetadata {
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
title: Option<string>;
|
title: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
image: Option<string>;
|
image: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
html: Option<string>;
|
html: Option<string>;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
import { Option } from "@sniptt/monads";
|
||||||
import { Expose, Transform } from "class-transformer";
|
import { Expose, Transform } from "class-transformer";
|
||||||
import { toUndefined } from "../utils";
|
import { toOption, toUndefined } from "../utils";
|
||||||
|
|
||||||
export class LocalUserSettings {
|
export class LocalUserSettings {
|
||||||
id: number;
|
id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
email: Option<string>;
|
email: Option<string>;
|
||||||
|
@ -27,40 +27,40 @@ export class LocalUserSettings {
|
||||||
export class PersonSafe {
|
export class PersonSafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
display_name: Option<string>;
|
display_name: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
avatar: Option<string>;
|
avatar: Option<string>;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
bio: Option<string>;
|
bio: Option<string>;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
shared_inbox_url: string;
|
shared_inbox_url: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
matrix_user_id: Option<string>;
|
matrix_user_id: Option<string>;
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
bot_account: boolean;
|
bot_account: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
ban_expires: Option<string>;
|
ban_expires: Option<string>;
|
||||||
|
@ -69,34 +69,34 @@ export class PersonSafe {
|
||||||
export class Site {
|
export class Site {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
enable_downvotes: boolean;
|
enable_downvotes: boolean;
|
||||||
open_registration: boolean;
|
open_registration: boolean;
|
||||||
enable_nsfw: boolean;
|
enable_nsfw: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
community_creation_admin_only: boolean;
|
community_creation_admin_only: boolean;
|
||||||
require_email_verification: boolean;
|
require_email_verification: boolean;
|
||||||
require_application: boolean;
|
require_application: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
application_question: Option<string>;
|
application_question: Option<string>;
|
||||||
|
@ -107,7 +107,7 @@ export class Site {
|
||||||
last_refreshed_at: string;
|
last_refreshed_at: string;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
public_key: string;
|
public_key: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
legal_information: Option<string>;
|
legal_information: Option<string>;
|
||||||
|
@ -121,7 +121,7 @@ export class PrivateMessage {
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
|
@ -134,22 +134,22 @@ export class PostReport {
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
original_post_name: string;
|
original_post_name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
original_post_url: Option<string>;
|
original_post_url: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
original_post_body: Option<string>;
|
original_post_body: Option<string>;
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
resolver_id: Option<number>;
|
resolver_id: Option<number>;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
|
@ -158,11 +158,11 @@ export class PostReport {
|
||||||
export class Post {
|
export class Post {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
url: Option<string>;
|
url: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
body: Option<string>;
|
body: Option<string>;
|
||||||
|
@ -171,26 +171,26 @@ export class Post {
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
locked: boolean;
|
locked: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
stickied: boolean;
|
stickied: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
embed_title: Option<string>;
|
embed_title: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
embed_description: Option<string>;
|
embed_description: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
embed_html: Option<string>;
|
embed_html: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
thumbnail_url: Option<string>;
|
thumbnail_url: Option<string>;
|
||||||
|
@ -209,11 +209,11 @@ export class ModRemovePost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
|
@ -224,7 +224,7 @@ export class ModLockPost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
locked: Option<boolean>;
|
locked: Option<boolean>;
|
||||||
|
@ -235,7 +235,7 @@ export class ModStickyPost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
stickied: Option<boolean>;
|
stickied: Option<boolean>;
|
||||||
|
@ -246,11 +246,11 @@ export class ModRemoveComment {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
|
@ -261,15 +261,15 @@ export class ModRemoveCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<string>;
|
expires: Option<string>;
|
||||||
|
@ -281,15 +281,15 @@ export class ModBanFromCommunity {
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banned: Option<boolean>;
|
banned: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<string>;
|
expires: Option<string>;
|
||||||
|
@ -300,15 +300,15 @@ export class ModBan {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
reason: Option<string>;
|
reason: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banned: Option<boolean>;
|
banned: Option<boolean>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
expires: Option<string>;
|
expires: Option<string>;
|
||||||
|
@ -320,7 +320,7 @@ export class ModAddCommunity {
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
|
@ -332,7 +332,7 @@ export class ModTransferCommunity {
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
|
@ -343,7 +343,7 @@ export class ModAdd {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
removed: Option<boolean>;
|
removed: Option<boolean>;
|
||||||
|
@ -354,13 +354,13 @@ export class CommunitySafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
description: Option<string>;
|
description: Option<string>;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
|
@ -368,11 +368,11 @@ export class CommunitySafe {
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
icon: Option<string>;
|
icon: Option<string>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
banner: Option<string>;
|
banner: Option<string>;
|
||||||
|
@ -386,12 +386,12 @@ export class CommentReport {
|
||||||
original_comment_text: string;
|
original_comment_text: string;
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
resolver_id: Option<number>;
|
resolver_id: Option<number>;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
|
@ -401,7 +401,7 @@ export class Comment {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
parent_id: Option<number>;
|
parent_id: Option<number>;
|
||||||
|
@ -409,7 +409,7 @@ export class Comment {
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
read: boolean; // Whether the recipient has read the comment or not
|
read: boolean; // Whether the recipient has read the comment or not
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
updated: Option<string>;
|
updated: Option<string>;
|
||||||
|
@ -430,11 +430,11 @@ export class RegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
local_user_id: number;
|
local_user_id: number;
|
||||||
answer: string;
|
answer: string;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
admin_id: Option<number>;
|
admin_id: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
deny_reason: Option<string>;
|
deny_reason: Option<string>;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
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 { toUndefined } from "../utils";
|
import { toOption, toUndefined } from "../utils";
|
||||||
import {
|
import {
|
||||||
CommentAggregates,
|
CommentAggregates,
|
||||||
CommunityAggregates,
|
CommunityAggregates,
|
||||||
|
@ -57,7 +57,7 @@ export class PersonMentionView {
|
||||||
subscribed: boolean;
|
subscribed: boolean;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
my_vote: Option<number>;
|
my_vote: Option<number>;
|
||||||
|
@ -99,7 +99,7 @@ export class PostView {
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
my_vote: Option<number>;
|
my_vote: Option<number>;
|
||||||
|
@ -117,12 +117,12 @@ export class PostReportView {
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
post_creator: PersonSafe;
|
post_creator: PersonSafe;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
my_vote: Option<number>;
|
my_vote: Option<number>;
|
||||||
counts: PostAggregates;
|
counts: PostAggregates;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
|
@ -134,7 +134,7 @@ export class CommentView {
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
|
@ -148,7 +148,7 @@ export class CommentView {
|
||||||
subscribed: boolean;
|
subscribed: boolean;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
my_vote: Option<number>;
|
my_vote: Option<number>;
|
||||||
|
@ -169,11 +169,11 @@ export class CommentReportView {
|
||||||
comment_creator: PersonSafe;
|
comment_creator: PersonSafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
my_vote: Option<number>;
|
my_vote: Option<number>;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
|
@ -338,7 +338,7 @@ export class RegistrationApplicationView {
|
||||||
creator_local_user: LocalUserSettings;
|
creator_local_user: LocalUserSettings;
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Type(() => PersonSafe)
|
@Type(() => PersonSafe)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Option } from "@sniptt/monads";
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an option to an undefined. Necessary for API requests.
|
* Converts an option to an undefined. Necessary for API requests.
|
||||||
|
@ -6,3 +6,7 @@ import { Option } from "@sniptt/monads";
|
||||||
export function toUndefined<T>(opt: Option<T>) {
|
export function toUndefined<T>(opt: Option<T>) {
|
||||||
return opt.isSome() ? opt.unwrap() : undefined;
|
return opt.isSome() ? opt.unwrap() : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toOption<T>(val: T): Option<T> {
|
||||||
|
return Some(val || undefined);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue