mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-22 12:21:12 +00:00
* Removing monads. Fixes #98 * Fixing http get params * In encode get params, dont serialize the undefineds. * v0.17.0-rc.60
This commit is contained in:
parent
f1d164fca3
commit
8065620cb5
15 changed files with 764 additions and 2340 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lemmy-js-client",
|
"name": "lemmy-js-client",
|
||||||
"version": "0.17.0-rc.59",
|
"version": "0.17.0-rc.60",
|
||||||
"description": "A javascript / typescript client for Lemmy",
|
"description": "A javascript / typescript client for Lemmy",
|
||||||
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
@ -26,10 +26,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sniptt/monads": "^0.5.10",
|
"node-fetch": "2.6.6"
|
||||||
"class-transformer": "^0.5.1",
|
|
||||||
"node-fetch": "2.6.6",
|
|
||||||
"reflect-metadata": "^0.1.13"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.6.2",
|
"@types/node": "^18.6.2",
|
||||||
|
|
441
src/http.ts
441
src/http.ts
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,3 @@
|
||||||
export * from "./http";
|
export * from "./http";
|
||||||
export * from "./interfaces";
|
export * from "./interfaces";
|
||||||
export * from "./utils";
|
|
||||||
export * from "./websocket";
|
export * from "./websocket";
|
||||||
|
|
|
@ -1,127 +1,71 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { toOption, toUndefined } from "../../utils";
|
|
||||||
import { CommentSortType, ListingType } from "../others";
|
import { CommentSortType, ListingType } from "../others";
|
||||||
import { CommentReportView, CommentView } from "../views";
|
import { CommentReportView, CommentView } from "../views";
|
||||||
|
|
||||||
export class CreateComment {
|
export interface CreateComment {
|
||||||
content: string;
|
content: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
parent_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
language_id?: number;
|
||||||
@Expose()
|
|
||||||
parent_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
language_id: Option<number>;
|
|
||||||
post_id: number;
|
post_id: number;
|
||||||
/**
|
/**
|
||||||
* 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 }) => toOption(value), { toClassOnly: true })
|
form_id?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
form_id: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreateComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditComment {
|
export interface EditComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
content?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
content: Option<string>;
|
|
||||||
/**
|
/**
|
||||||
* "Distinguishes" a comment, or speak officially. Only doable by community mods or admins.
|
* "Distinguishes" a comment, or speak officially. Only doable by community mods or admins.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
distinguished?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
language_id?: number;
|
||||||
@Expose()
|
|
||||||
distinguished: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
language_id: Option<number>;
|
|
||||||
/**
|
/**
|
||||||
* 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 }) => toOption(value), { toClassOnly: true })
|
form_id?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
form_id: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: EditComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only the creator can delete the comment.
|
* Only the creator can delete the comment.
|
||||||
*/
|
*/
|
||||||
export class DeleteComment {
|
export interface DeleteComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: DeleteComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only a mod or admin can remove the comment.
|
* Only a mod or admin can remove the comment.
|
||||||
*/
|
*/
|
||||||
export class RemoveComment {
|
export interface RemoveComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: RemoveComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SaveComment {
|
export interface SaveComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
save: boolean;
|
save: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: SaveComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentResponse {
|
export interface CommentResponse {
|
||||||
@Type(() => CommentView)
|
|
||||||
comment_view: CommentView;
|
comment_view: CommentView;
|
||||||
recipient_ids: number[];
|
recipient_ids: number[];
|
||||||
/**
|
/**
|
||||||
* 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 }) => toOption(value), { toClassOnly: true })
|
form_id?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
form_id: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCommentLike {
|
export interface CreateCommentLike {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
score: number;
|
score: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreateCommentLike) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,122 +74,58 @@ export class CreateCommentLike {
|
||||||
* You can use either `community_id` or `community_name` as an id.
|
* You can use either `community_id` or `community_name` as an id.
|
||||||
* 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 interface GetComments {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
type_?: ListingType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
sort?: CommentSortType;
|
||||||
@Expose()
|
max_depth?: number;
|
||||||
type_: Option<ListingType>;
|
page?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
limit?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
community_id?: number;
|
||||||
@Expose()
|
community_name?: string;
|
||||||
sort: Option<CommentSortType>;
|
post_id?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
parent_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
saved_only?: boolean;
|
||||||
@Expose()
|
auth?: string;
|
||||||
max_depth: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
post_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
parent_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
saved_only: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetComments) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCommentsResponse {
|
export interface GetCommentsResponse {
|
||||||
@Type(() => CommentView)
|
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCommentReport {
|
export interface CreateCommentReport {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreateCommentReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReportResponse {
|
export interface CommentReportResponse {
|
||||||
@Type(() => CommentReportView)
|
|
||||||
comment_report_view: CommentReportView;
|
comment_report_view: CommentReportView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolveCommentReport {
|
export interface ResolveCommentReport {
|
||||||
report_id: number;
|
report_id: number;
|
||||||
/**
|
/**
|
||||||
* Either resolve or unresolve a report.
|
* Either resolve or unresolve a report.
|
||||||
*/
|
*/
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ResolveCommentReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommentReports {
|
export interface ListCommentReports {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
page?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
limit?: number;
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
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 }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
unresolved_only?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
unresolved_only: Option<boolean>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ListCommentReports) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommentReportsResponse {
|
export interface ListCommentReportsResponse {
|
||||||
@Type(() => CommentReportView)
|
|
||||||
comment_reports: CommentReportView[];
|
comment_reports: CommentReportView[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
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 {
|
||||||
|
@ -15,116 +11,51 @@ 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 interface GetCommunity {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
name?: string;
|
||||||
@Expose()
|
auth?: string;
|
||||||
id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCommunityResponse {
|
export interface GetCommunityResponse {
|
||||||
@Type(() => CommunityView)
|
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
site?: Site;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => Site)
|
|
||||||
site: Option<Site>;
|
|
||||||
@Type(() => CommunityModeratorView)
|
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
online: number;
|
online: number;
|
||||||
discussion_languages: number[];
|
discussion_languages: number[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
default_post_language?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_post_language: Option<number>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateCommunity {
|
export interface CreateCommunity {
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
description?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
icon?: string;
|
||||||
@Expose()
|
banner?: string;
|
||||||
description: Option<string>;
|
nsfw?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
posting_restricted_to_mods?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
discussion_languages?: number[];
|
||||||
@Expose()
|
|
||||||
icon: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banner: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
nsfw: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
posting_restricted_to_mods: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
discussion_languages: Option<number[]>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreateCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityResponse {
|
export interface CommunityResponse {
|
||||||
@Type(() => CommunityView)
|
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
discussion_languages: number[];
|
discussion_languages: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommunities {
|
export interface ListCommunities {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
type_?: ListingType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
sort?: SortType;
|
||||||
@Expose()
|
page?: number;
|
||||||
type_: Option<ListingType>;
|
limit?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
auth?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
sort: Option<SortType>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: ListCommunities) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListCommunitiesResponse {
|
export interface ListCommunitiesResponse {
|
||||||
@Type(() => CommunityView)
|
|
||||||
communities: CommunityView[];
|
communities: CommunityView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BanFromCommunity {
|
export interface BanFromCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
ban: boolean;
|
ban: boolean;
|
||||||
|
@ -132,156 +63,85 @@ export class BanFromCommunity {
|
||||||
/**
|
/**
|
||||||
* Removes/Restores their comments and posts for that community.
|
* Removes/Restores their comments and posts for that community.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
remove_data?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
reason?: string;
|
||||||
@Expose()
|
|
||||||
remove_data: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
expires?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: BanFromCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BanFromCommunityResponse {
|
export interface BanFromCommunityResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddModToCommunity {
|
export interface AddModToCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
added: boolean;
|
added: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: AddModToCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddModToCommunityResponse {
|
export interface AddModToCommunityResponse {
|
||||||
@Type(() => CommunityModeratorView)
|
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only mods can edit a community.
|
* Only mods can edit a community.
|
||||||
*/
|
*/
|
||||||
export class EditCommunity {
|
export interface EditCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
title?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
description?: string;
|
||||||
@Expose()
|
icon?: string;
|
||||||
title: Option<string>;
|
banner?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
nsfw?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
posting_restricted_to_mods?: boolean;
|
||||||
@Expose()
|
discussion_languages?: number[];
|
||||||
description: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
icon: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banner: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
nsfw: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
posting_restricted_to_mods: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
discussion_languages: Option<number[]>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: EditCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeleteCommunity {
|
export interface DeleteCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: DeleteCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins can remove a community.
|
* Only admins can remove a community.
|
||||||
*/
|
*/
|
||||||
export class RemoveCommunity {
|
export interface RemoveCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
expires?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: RemoveCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FollowCommunity {
|
export interface FollowCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
follow: boolean;
|
follow: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: FollowCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TransferCommunity {
|
export interface TransferCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: TransferCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BlockCommunity {
|
export interface BlockCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
block: boolean;
|
block: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: BlockCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BlockCommunityResponse {
|
export interface BlockCommunityResponse {
|
||||||
@Type(() => CommunityView)
|
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { toOption, toUndefined } from "../../utils";
|
|
||||||
import { CommentSortType, SortType } from "../others";
|
import { CommentSortType, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentReplyView,
|
CommentReplyView,
|
||||||
|
@ -14,13 +10,9 @@ import {
|
||||||
PrivateMessageView,
|
PrivateMessageView,
|
||||||
} from "../views";
|
} from "../views";
|
||||||
|
|
||||||
export class Login {
|
export interface Login {
|
||||||
username_or_email: string;
|
username_or_email: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
constructor(init: Login) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,60 +20,37 @@ export class Login {
|
||||||
*
|
*
|
||||||
* Only the first user to register will be able to be the admin.
|
* Only the first user to register will be able to be the admin.
|
||||||
*/
|
*/
|
||||||
export class Register {
|
export interface Register {
|
||||||
username: string;
|
username: string;
|
||||||
/**
|
/**
|
||||||
* Email is mandatory if email verification is enabled on the server
|
* Email is mandatory if email verification is enabled on the server
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
email?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
email: Option<string>;
|
|
||||||
password: string;
|
password: string;
|
||||||
password_verify: string;
|
password_verify: string;
|
||||||
show_nsfw: boolean;
|
show_nsfw: boolean;
|
||||||
/**
|
/**
|
||||||
* Captcha is only checked if these are enabled in the server.
|
* Captcha is only checked if these are enabled in the server.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
captcha_uuid?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
captcha_answer?: string;
|
||||||
@Expose()
|
honeypot?: string;
|
||||||
captcha_uuid: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
captcha_answer: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
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 }) => toOption(value), { toClassOnly: true })
|
answer?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
answer: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: Register) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetCaptcha {}
|
export interface GetCaptcha {}
|
||||||
|
|
||||||
export class GetCaptchaResponse {
|
export interface GetCaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* Will be undefined if captchas are disabled.
|
* Will be undefined if captchas are disabled.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
ok?: CaptchaResponse;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => CaptchaResponse)
|
|
||||||
ok: Option<CaptchaResponse>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CaptchaResponse {
|
export interface CaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* A Base64 encoded png.
|
* A Base64 encoded png.
|
||||||
*/
|
*/
|
||||||
|
@ -90,10 +59,7 @@ export class CaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* A Base64 encoded wav file.
|
* A Base64 encoded wav file.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
wav?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
wav: Option<string>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A UUID to match the one given on request.
|
* A UUID to match the one given on request.
|
||||||
|
@ -101,563 +67,299 @@ export class CaptchaResponse {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SaveUserSettings {
|
export interface SaveUserSettings {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
show_nsfw?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_nsfw: Option<boolean>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default for this is `browser`.
|
* Default for this is `browser`.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
theme?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
theme: Option<string>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The [[SortType]].
|
* The [[SortType]].
|
||||||
*
|
*
|
||||||
* The Sort types from above, zero indexed as a number
|
* The Sort types from above, zero indexed as a number
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
default_sort_type?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_sort_type: Option<number>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The [[ListingType]].
|
* The [[ListingType]].
|
||||||
*
|
*
|
||||||
* Post listing types are `All, Subscribed, Community`
|
* Post listing types are `All, Subscribed, Community`
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
default_listing_type?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
interface_language?: string;
|
||||||
@Expose()
|
avatar?: string;
|
||||||
default_listing_type: Option<number>;
|
banner?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
display_name?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
email?: string;
|
||||||
@Expose()
|
bio?: string;
|
||||||
interface_language: Option<string>;
|
matrix_user_id?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
show_avatars?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
show_scores?: boolean;
|
||||||
@Expose()
|
send_notifications_to_email?: boolean;
|
||||||
avatar: Option<string>;
|
bot_account?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
show_bot_accounts?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
show_read_posts?: boolean;
|
||||||
@Expose()
|
show_new_post_notifs?: boolean;
|
||||||
banner: Option<string>;
|
discussion_languages?: number[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
display_name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
email: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
bio: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
matrix_user_id: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_avatars: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_scores: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
send_notifications_to_email: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
bot_account: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_bot_accounts: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_read_posts: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
show_new_post_notifs: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
discussion_languages: Option<number[]>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: SaveUserSettings) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ChangePassword {
|
export interface ChangePassword {
|
||||||
new_password: string;
|
new_password: string;
|
||||||
new_password_verify: string;
|
new_password_verify: string;
|
||||||
old_password: string;
|
old_password: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ChangePassword) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
||||||
*/
|
*/
|
||||||
export class LoginResponse {
|
export interface 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 }) => toOption(value), { toClassOnly: true })
|
jwt?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
jwt: Option<string>;
|
|
||||||
verify_email_sent: boolean;
|
verify_email_sent: boolean;
|
||||||
registration_created: boolean;
|
registration_created: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonDetails {
|
export interface GetPersonDetails {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
person_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
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 }) => toOption(value), { toClassOnly: true })
|
username?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
sort?: SortType;
|
||||||
@Expose()
|
page?: number;
|
||||||
username: Option<string>;
|
limit?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
saved_only?: boolean;
|
||||||
@Expose()
|
auth?: string;
|
||||||
sort: Option<SortType>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
saved_only: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetPersonDetails) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonDetailsResponse {
|
export interface GetPersonDetailsResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
@Type(() => CommentView)
|
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
@Type(() => PostView)
|
|
||||||
posts: PostView[];
|
posts: PostView[];
|
||||||
@Type(() => CommunityModeratorView)
|
|
||||||
moderates: CommunityModeratorView[];
|
moderates: CommunityModeratorView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetRepliesResponse {
|
export interface GetRepliesResponse {
|
||||||
@Type(() => CommentReplyView)
|
|
||||||
replies: CommentReplyView[];
|
replies: CommentReplyView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonMentionsResponse {
|
export interface GetPersonMentionsResponse {
|
||||||
@Type(() => PersonMentionView)
|
|
||||||
mentions: PersonMentionView[];
|
mentions: PersonMentionView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MarkAllAsRead {
|
export interface MarkAllAsRead {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(auth: string) {
|
|
||||||
this.auth = auth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddAdmin {
|
export interface AddAdmin {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
added: boolean;
|
added: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: AddAdmin) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AddAdminResponse {
|
export interface AddAdminResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
admins: PersonViewSafe[];
|
admins: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BanPerson {
|
export interface BanPerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
ban: boolean;
|
ban: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes/Restores their comments, posts, and communities
|
* Removes/Restores their comments, posts, and communities
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
remove_data?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
reason?: string;
|
||||||
@Expose()
|
|
||||||
remove_data: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
/**
|
/**
|
||||||
* The expire time in Unix seconds
|
* The expire time in Unix seconds
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
expires?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: BanPerson) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BanPersonResponse {
|
export interface BanPersonResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetReplies {
|
export interface GetReplies {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
sort?: CommentSortType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
page?: number;
|
||||||
@Expose()
|
limit?: number;
|
||||||
sort: Option<CommentSortType>;
|
unread_only?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
unread_only: Option<boolean>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetReplies) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPersonMentions {
|
export interface GetPersonMentions {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
sort?: CommentSortType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
page?: number;
|
||||||
@Expose()
|
limit?: number;
|
||||||
sort: Option<CommentSortType>;
|
unread_only?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
unread_only: Option<boolean>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetPersonMentions) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MarkPersonMentionAsRead {
|
export interface MarkPersonMentionAsRead {
|
||||||
person_mention_id: number;
|
person_mention_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: MarkPersonMentionAsRead) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonMentionResponse {
|
export interface PersonMentionResponse {
|
||||||
@Type(() => PersonMentionView)
|
|
||||||
person_mention_view: PersonMentionView;
|
person_mention_view: PersonMentionView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MarkCommentReplyAsRead {
|
export interface MarkCommentReplyAsRead {
|
||||||
comment_reply_id: number;
|
comment_reply_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: MarkCommentReplyAsRead) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReplyResponse {
|
export interface CommentReplyResponse {
|
||||||
@Type(() => CommentReplyView)
|
|
||||||
comment_reply_view: CommentReplyView;
|
comment_reply_view: CommentReplyView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permanently deletes your posts and comments
|
* Permanently deletes your posts and comments
|
||||||
*/
|
*/
|
||||||
export class DeleteAccount {
|
export interface DeleteAccount {
|
||||||
password: string;
|
password: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: DeleteAccount) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeleteAccountResponse {}
|
export interface DeleteAccountResponse {}
|
||||||
|
|
||||||
export class PasswordReset {
|
export interface PasswordReset {
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
constructor(init: PasswordReset) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PasswordResetResponse {}
|
export interface PasswordResetResponse {}
|
||||||
|
|
||||||
export class PasswordChange {
|
export interface PasswordChange {
|
||||||
token: string;
|
token: string;
|
||||||
password: string;
|
password: string;
|
||||||
password_verify: string;
|
password_verify: string;
|
||||||
|
|
||||||
constructor(init: PasswordChange) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePrivateMessage {
|
export interface CreatePrivateMessage {
|
||||||
content: string;
|
content: string;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreatePrivateMessage) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditPrivateMessage {
|
export interface EditPrivateMessage {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
content: string;
|
content: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: EditPrivateMessage) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeletePrivateMessage {
|
export interface DeletePrivateMessage {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: DeletePrivateMessage) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MarkPrivateMessageAsRead {
|
export interface MarkPrivateMessageAsRead {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: MarkPrivateMessageAsRead) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPrivateMessages {
|
export interface GetPrivateMessages {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
unread_only?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
page?: number;
|
||||||
@Expose()
|
limit?: number;
|
||||||
unread_only: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetPrivateMessages) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessagesResponse {
|
export interface PrivateMessagesResponse {
|
||||||
@Type(() => PrivateMessageView)
|
|
||||||
private_messages: PrivateMessageView[];
|
private_messages: PrivateMessageView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessageResponse {
|
export interface PrivateMessageResponse {
|
||||||
@Type(() => PrivateMessageView)
|
|
||||||
private_message_view: PrivateMessageView;
|
private_message_view: PrivateMessageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePrivateMessageReport {
|
export interface CreatePrivateMessageReport {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreatePrivateMessageReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessageReportResponse {
|
export interface PrivateMessageReportResponse {
|
||||||
@Type(() => PrivateMessageReportView)
|
|
||||||
private_message_report_view: PrivateMessageReportView;
|
private_message_report_view: PrivateMessageReportView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolvePrivateMessageReport {
|
export interface ResolvePrivateMessageReport {
|
||||||
report_id: number;
|
report_id: number;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ResolvePrivateMessageReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListPrivateMessageReports {
|
export interface ListPrivateMessageReports {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
page?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
limit?: number;
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
/// Only shows the unresolved reports
|
/// Only shows the unresolved reports
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
unresolved_only?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
unresolved_only: Option<boolean>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ListPrivateMessageReports) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListPrivateMessageReportsResponse {
|
export interface ListPrivateMessageReportsResponse {
|
||||||
@Type(() => PrivateMessageReportView)
|
|
||||||
private_message_reports: PrivateMessageReportView[];
|
private_message_reports: PrivateMessageReportView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetReportCount {
|
export interface 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 }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetReportCount) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetReportCountResponse {
|
export interface GetReportCountResponse {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
comment_reports: number;
|
comment_reports: number;
|
||||||
post_reports: number;
|
post_reports: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
private_message_reports?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
private_message_reports: Option<number>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetUnreadCount {
|
export interface GetUnreadCount {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetUnreadCount) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetUnreadCountResponse {
|
export interface GetUnreadCountResponse {
|
||||||
replies: number;
|
replies: number;
|
||||||
mentions: number;
|
mentions: number;
|
||||||
private_messages: number;
|
private_messages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VerifyEmail {
|
export interface VerifyEmail {
|
||||||
token: string;
|
token: string;
|
||||||
|
|
||||||
constructor(init: VerifyEmail) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VerifyEmailResponse {}
|
export interface VerifyEmailResponse {}
|
||||||
|
|
||||||
export class BlockPerson {
|
export interface BlockPerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
block: boolean;
|
block: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: BlockPerson) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BlockPersonResponse {
|
export interface BlockPersonResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetBannedPersons {
|
export interface GetBannedPersons {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetBannedPersons) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BannedPersonsResponse {
|
export interface BannedPersonsResponse {
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
banned: PersonViewSafe[];
|
banned: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { toOption, toUndefined } from "../../utils";
|
|
||||||
import {
|
import {
|
||||||
ListingType,
|
ListingType,
|
||||||
PostFeatureType,
|
PostFeatureType,
|
||||||
|
@ -15,118 +11,53 @@ import {
|
||||||
PostView,
|
PostView,
|
||||||
} from "../views";
|
} from "../views";
|
||||||
|
|
||||||
export class CreatePost {
|
export interface CreatePost {
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
url?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
body?: string;
|
||||||
@Expose()
|
nsfw?: boolean;
|
||||||
url: Option<string>;
|
language_id?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
body: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
nsfw: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
language_id: Option<number>;
|
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
honeypot?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
honeypot: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreatePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostResponse {
|
export interface PostResponse {
|
||||||
@Type(() => PostView)
|
|
||||||
post_view: PostView;
|
post_view: PostView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPost {
|
export interface GetPost {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
comment_id?: number;
|
||||||
@Expose()
|
auth?: string;
|
||||||
id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
comment_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetPost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPostResponse {
|
export interface GetPostResponse {
|
||||||
@Type(() => PostView)
|
|
||||||
post_view: PostView;
|
post_view: PostView;
|
||||||
@Type(() => CommunityView)
|
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
@Type(() => CommunityModeratorView)
|
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
online: number;
|
online: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPosts {
|
export interface GetPosts {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
type_?: ListingType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
sort?: SortType;
|
||||||
@Expose()
|
page?: number;
|
||||||
type_: Option<ListingType>;
|
limit?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
sort: Option<SortType>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
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 }) => toOption(value), { toClassOnly: true })
|
community_name?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
saved_only?: boolean;
|
||||||
@Expose()
|
auth?: string;
|
||||||
community_name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
saved_only: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetPosts) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetPostsResponse {
|
export interface GetPostsResponse {
|
||||||
@Type(() => PostView)
|
|
||||||
posts: PostView[];
|
posts: PostView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePostLike {
|
export interface CreatePostLike {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,190 +65,109 @@ export class CreatePostLike {
|
||||||
*/
|
*/
|
||||||
score: number;
|
score: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreatePostLike) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditPost {
|
export interface EditPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
name?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
url?: string;
|
||||||
@Expose()
|
body?: string;
|
||||||
name: Option<string>;
|
nsfw?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
language_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
url: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
body: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
nsfw: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
language_id: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: EditPost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeletePost {
|
export interface DeletePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: DeletePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can remove a post.
|
* Only admins and mods can remove a post.
|
||||||
*/
|
*/
|
||||||
export class RemovePost {
|
export interface RemovePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: RemovePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a post as read.
|
* Marks a post as read.
|
||||||
*/
|
*/
|
||||||
export class MarkPostAsRead {
|
export interface MarkPostAsRead {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: MarkPostAsRead) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can lock a post.
|
* Only admins and mods can lock a post.
|
||||||
*/
|
*/
|
||||||
export class LockPost {
|
export interface LockPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
locked: boolean;
|
locked: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: LockPost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can feature a community post.
|
* Only admins and mods can feature a community post.
|
||||||
*/
|
*/
|
||||||
export class FeaturePost {
|
export interface FeaturePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
featured: boolean;
|
featured: boolean;
|
||||||
feature_type: PostFeatureType;
|
feature_type: PostFeatureType;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: FeaturePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SavePost {
|
export interface SavePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
save: boolean;
|
save: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: SavePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePostReport {
|
export interface CreatePostReport {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: CreatePostReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostReportResponse {
|
export interface PostReportResponse {
|
||||||
@Type(() => PostReportView)
|
|
||||||
post_report_view: PostReportView;
|
post_report_view: PostReportView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolvePostReport {
|
export interface ResolvePostReport {
|
||||||
report_id: number;
|
report_id: number;
|
||||||
/**
|
/**
|
||||||
* Either resolve or unresolve a report.
|
* Either resolve or unresolve a report.
|
||||||
*/
|
*/
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ResolvePostReport) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListPostReports {
|
export interface ListPostReports {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
page?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
limit?: number;
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
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 }) => toOption(value), { toClassOnly: true })
|
community_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
unresolved_only?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
unresolved_only: Option<boolean>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ListPostReports) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListPostReportsResponse {
|
export interface ListPostReportsResponse {
|
||||||
@Type(() => PostReportView)
|
|
||||||
post_reports: PostReportView[];
|
post_reports: PostReportView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetSiteMetadata {
|
export interface GetSiteMetadata {
|
||||||
url: string;
|
url: string;
|
||||||
|
|
||||||
constructor(init: GetSiteMetadata) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetSiteMetadataResponse {
|
export interface GetSiteMetadataResponse {
|
||||||
@Type(() => SiteMetadata)
|
|
||||||
metadata: SiteMetadata;
|
metadata: SiteMetadata;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { toOption, toUndefined } from "../../utils";
|
|
||||||
import { ListingType, ModlogActionType, SearchType, SortType } from "../others";
|
import { ListingType, ModlogActionType, SearchType, SortType } from "../others";
|
||||||
import { Language, RegistrationMode, Tagline } from "../source";
|
import { Language, RegistrationMode, Tagline } from "../source";
|
||||||
import {
|
import {
|
||||||
|
@ -35,695 +31,262 @@ import {
|
||||||
/**
|
/**
|
||||||
* Search lemmy for different types of data.
|
* Search lemmy for different types of data.
|
||||||
*/
|
*/
|
||||||
export class Search {
|
export interface Search {
|
||||||
/**
|
/**
|
||||||
* The search query string.
|
* The search query string.
|
||||||
*/
|
*/
|
||||||
q: string;
|
q: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
type_?: SearchType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
community_id?: number;
|
||||||
@Expose()
|
community_name?: string;
|
||||||
type_: Option<SearchType>;
|
creator_id?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
sort?: SortType;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
listing_type?: ListingType;
|
||||||
@Expose()
|
page?: number;
|
||||||
community_id: Option<number>;
|
limit?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
auth?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
creator_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
sort: Option<SortType>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
listing_type: Option<ListingType>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: Search) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SearchResponse {
|
export interface SearchResponse {
|
||||||
/**
|
/**
|
||||||
* The [[SearchType]].
|
* The [[SearchType]].
|
||||||
*/
|
*/
|
||||||
type_: string;
|
type_: string;
|
||||||
@Type(() => CommentView)
|
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
@Type(() => PostView)
|
|
||||||
posts: PostView[];
|
posts: PostView[];
|
||||||
@Type(() => CommunityView)
|
|
||||||
communities: CommunityView[];
|
communities: CommunityView[];
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
users: PersonViewSafe[];
|
users: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetModlog {
|
export interface GetModlog {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
mod_person_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
community_id?: number;
|
||||||
@Expose()
|
page?: number;
|
||||||
mod_person_id: Option<number>;
|
limit?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
auth?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
community_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
type_: ModlogActionType;
|
type_: ModlogActionType;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
other_person_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
other_person_id: Option<number>;
|
|
||||||
constructor(init: GetModlog) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetModlogResponse {
|
export interface GetModlogResponse {
|
||||||
@Type(() => ModRemovePostView)
|
|
||||||
removed_posts: ModRemovePostView[];
|
removed_posts: ModRemovePostView[];
|
||||||
@Type(() => ModLockPostView)
|
|
||||||
locked_posts: ModLockPostView[];
|
locked_posts: ModLockPostView[];
|
||||||
@Type(() => ModFeaturePostView)
|
|
||||||
featured_posts: ModFeaturePostView[];
|
featured_posts: ModFeaturePostView[];
|
||||||
@Type(() => ModRemoveCommentView)
|
|
||||||
removed_comments: ModRemoveCommentView[];
|
removed_comments: ModRemoveCommentView[];
|
||||||
@Type(() => ModRemoveCommunityView)
|
|
||||||
removed_communities: ModRemoveCommunityView[];
|
removed_communities: ModRemoveCommunityView[];
|
||||||
@Type(() => ModBanFromCommunityView)
|
|
||||||
banned_from_community: ModBanFromCommunityView[];
|
banned_from_community: ModBanFromCommunityView[];
|
||||||
@Type(() => ModBanView)
|
|
||||||
banned: ModBanView[];
|
banned: ModBanView[];
|
||||||
@Type(() => ModAddCommunityView)
|
|
||||||
added_to_community: ModAddCommunityView[];
|
added_to_community: ModAddCommunityView[];
|
||||||
@Type(() => ModTransferCommunityView)
|
|
||||||
transferred_to_community: ModTransferCommunityView[];
|
transferred_to_community: ModTransferCommunityView[];
|
||||||
@Type(() => ModAddView)
|
|
||||||
added: ModAddView[];
|
added: ModAddView[];
|
||||||
@Type(() => AdminPurgePersonView)
|
|
||||||
admin_purged_persons: AdminPurgePersonView[];
|
admin_purged_persons: AdminPurgePersonView[];
|
||||||
@Type(() => AdminPurgeCommunityView)
|
|
||||||
admin_purged_communities: AdminPurgeCommunityView[];
|
admin_purged_communities: AdminPurgeCommunityView[];
|
||||||
@Type(() => AdminPurgePostView)
|
|
||||||
admin_purged_posts: AdminPurgePostView[];
|
admin_purged_posts: AdminPurgePostView[];
|
||||||
@Type(() => AdminPurgeCommentView)
|
|
||||||
admin_purged_comments: AdminPurgeCommentView[];
|
admin_purged_comments: AdminPurgeCommentView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateSite {
|
export interface CreateSite {
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
sidebar?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
description?: string;
|
||||||
@Expose()
|
icon?: string;
|
||||||
sidebar: Option<string>;
|
banner?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
enable_downvotes?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
enable_nsfw?: boolean;
|
||||||
@Expose()
|
community_creation_admin_only?: boolean;
|
||||||
description: Option<string>;
|
require_email_verification?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
registration_mode?: RegistrationMode;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
application_question?: string;
|
||||||
@Expose()
|
private_instance?: boolean;
|
||||||
icon: Option<string>;
|
default_theme?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
default_post_listing_type?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
application_email_admins?: boolean;
|
||||||
@Expose()
|
hide_modlog_mod_names?: boolean;
|
||||||
banner: Option<string>;
|
discussion_languages?: number[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
legal_information?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
slur_filter_regex?: string;
|
||||||
@Expose()
|
actor_name_max_length?: number;
|
||||||
enable_downvotes: Option<boolean>;
|
rate_limit_message?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_message_per_second?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_post?: number;
|
||||||
@Expose()
|
rate_limit_post_per_second?: number;
|
||||||
enable_nsfw: Option<boolean>;
|
rate_limit_register?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_register_per_second?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_image?: number;
|
||||||
@Expose()
|
rate_limit_image_per_second?: number;
|
||||||
community_creation_admin_only: Option<boolean>;
|
rate_limit_comment?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_comment_per_second?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_search?: number;
|
||||||
@Expose()
|
rate_limit_search_per_second?: number;
|
||||||
require_email_verification: Option<boolean>;
|
federation_enabled?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
federation_debug?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
federation_worker_count?: number;
|
||||||
@Expose()
|
captcha_enabled?: boolean;
|
||||||
registration_mode: Option<RegistrationMode>;
|
captcha_difficulty?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
allowed_instances?: string[];
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
blocked_instances?: string[];
|
||||||
@Expose()
|
taglines?: string[];
|
||||||
application_question: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
private_instance: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_theme: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_post_listing_type: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
application_email_admins: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
hide_modlog_mod_names: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
discussion_languages: Option<number[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
legal_information: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
slur_filter_regex: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
actor_name_max_length: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_message: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_message_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_post: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_post_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_register: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_register_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_image: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_image_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_comment: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_comment_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_search: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_search_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_enabled: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_debug: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_worker_count: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
captcha_enabled: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
captcha_difficulty: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
allowed_instances: Option<string[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
blocked_instances: Option<string[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
taglines: Option<string[]>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
constructor(init: CreateSite) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EditSite {
|
export interface EditSite {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
name?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
sidebar?: string;
|
||||||
@Expose()
|
description?: string;
|
||||||
name: Option<string>;
|
icon?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
banner?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
enable_downvotes?: boolean;
|
||||||
@Expose()
|
enable_nsfw?: boolean;
|
||||||
sidebar: Option<string>;
|
community_creation_admin_only?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
require_email_verification?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
registration_mode?: RegistrationMode;
|
||||||
@Expose()
|
application_question?: string;
|
||||||
description: Option<string>;
|
private_instance?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
default_theme?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
default_post_listing_type?: string;
|
||||||
@Expose()
|
legal_information?: string;
|
||||||
icon: Option<string>;
|
application_email_admins?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
hide_modlog_mod_names?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
discussion_languages?: number[];
|
||||||
@Expose()
|
slur_filter_regex?: string;
|
||||||
banner: Option<string>;
|
actor_name_max_length?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_message?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_message_per_second?: number;
|
||||||
@Expose()
|
rate_limit_post?: number;
|
||||||
enable_downvotes: Option<boolean>;
|
rate_limit_post_per_second?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_register?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_register_per_second?: number;
|
||||||
@Expose()
|
rate_limit_image?: number;
|
||||||
enable_nsfw: Option<boolean>;
|
rate_limit_image_per_second?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
rate_limit_comment?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
rate_limit_comment_per_second?: number;
|
||||||
@Expose()
|
rate_limit_search?: number;
|
||||||
community_creation_admin_only: Option<boolean>;
|
rate_limit_search_per_second?: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
federation_enabled?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
federation_debug?: boolean;
|
||||||
@Expose()
|
federation_worker_count?: number;
|
||||||
require_email_verification: Option<boolean>;
|
captcha_enabled?: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
captcha_difficulty?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
allowed_instances?: string[];
|
||||||
@Expose()
|
blocked_instances?: string[];
|
||||||
registration_mode: Option<RegistrationMode>;
|
taglines?: string[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
application_question: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
private_instance: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_theme: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
default_post_listing_type: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
legal_information: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
application_email_admins: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
hide_modlog_mod_names: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
discussion_languages: Option<number[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
slur_filter_regex: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
actor_name_max_length: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_message: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_message_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_post: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_post_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_register: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_register_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_image: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_image_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_comment: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_comment_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_search: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
rate_limit_search_per_second: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_enabled: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_debug: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
federation_worker_count: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
captcha_enabled: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
captcha_difficulty: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
allowed_instances: Option<string[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
blocked_instances: Option<string[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
taglines: Option<string[]>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: EditSite) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetSite {
|
export interface GetSite {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
auth?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: GetSite) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SiteResponse {
|
export interface SiteResponse {
|
||||||
@Type(() => SiteView)
|
|
||||||
site_view: SiteView;
|
site_view: SiteView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetSiteResponse {
|
export interface GetSiteResponse {
|
||||||
@Type(() => SiteView)
|
|
||||||
site_view: SiteView;
|
site_view: SiteView;
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
admins: PersonViewSafe[];
|
admins: PersonViewSafe[];
|
||||||
online: number;
|
online: number;
|
||||||
version: string;
|
version: string;
|
||||||
/**
|
/**
|
||||||
* 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 }) => toOption(value), { toClassOnly: true })
|
my_user?: MyUserInfo;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
federated_instances?: FederatedInstances;
|
||||||
@Expose()
|
|
||||||
@Type(() => MyUserInfo)
|
|
||||||
my_user: Option<MyUserInfo>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => FederatedInstances)
|
|
||||||
federated_instances: Option<FederatedInstances>;
|
|
||||||
@Type(() => Language)
|
|
||||||
all_languages: Language[];
|
all_languages: Language[];
|
||||||
discussion_languages: number[];
|
discussion_languages: number[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
taglines?: Tagline[];
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => Tagline)
|
|
||||||
taglines: Option<Tagline[]>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Your user info, such as blocks, follows, etc.
|
* Your user info, such as blocks, follows, etc.
|
||||||
*/
|
*/
|
||||||
export class MyUserInfo {
|
export interface MyUserInfo {
|
||||||
@Type(() => LocalUserSettingsView)
|
|
||||||
local_user_view: LocalUserSettingsView;
|
local_user_view: LocalUserSettingsView;
|
||||||
@Type(() => CommunityFollowerView)
|
|
||||||
follows: CommunityFollowerView[];
|
follows: CommunityFollowerView[];
|
||||||
@Type(() => CommunityModeratorView)
|
|
||||||
moderates: CommunityModeratorView[];
|
moderates: CommunityModeratorView[];
|
||||||
@Type(() => CommunityBlockView)
|
|
||||||
community_blocks: CommunityBlockView[];
|
community_blocks: CommunityBlockView[];
|
||||||
@Type(() => PersonBlockView)
|
|
||||||
person_blocks: PersonBlockView[];
|
person_blocks: PersonBlockView[];
|
||||||
discussion_languages: number[];
|
discussion_languages: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LeaveAdmin {
|
export interface LeaveAdmin {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: LeaveAdmin) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FederatedInstances {
|
export interface FederatedInstances {
|
||||||
linked: string[];
|
linked: string[];
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
allowed?: string[];
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
blocked?: string[];
|
||||||
@Expose()
|
|
||||||
allowed: Option<string[]>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
blocked: Option<string[]>;
|
|
||||||
|
|
||||||
constructor(init: FederatedInstances) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolveObject {
|
export interface ResolveObject {
|
||||||
q: string;
|
q: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
auth?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
auth: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: ResolveObject) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ResolveObjectResponse {
|
export interface ResolveObjectResponse {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
comment?: CommentView;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
post?: PostView;
|
||||||
@Expose()
|
community?: CommunityView;
|
||||||
@Type(() => CommentView)
|
person?: PersonViewSafe;
|
||||||
comment: Option<CommentView>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PostView)
|
|
||||||
post: Option<PostView>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => CommunityView)
|
|
||||||
community: Option<CommunityView>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonViewSafe)
|
|
||||||
person: Option<PersonViewSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PurgePerson {
|
export interface PurgePerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: PurgePerson) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PurgeCommunity {
|
export interface PurgeCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: PurgeCommunity) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PurgePost {
|
export interface PurgePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: PurgePost) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PurgeComment {
|
export interface PurgeComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: PurgeComment) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PurgeItemResponse {
|
export interface PurgeItemResponse {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListRegistrationApplications {
|
export interface 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 }) => toOption(value), { toClassOnly: true })
|
unread_only?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
page?: number;
|
||||||
@Expose()
|
limit?: number;
|
||||||
unread_only: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
page: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
limit: Option<number>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ListRegistrationApplications) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ListRegistrationApplicationsResponse {
|
export interface ListRegistrationApplicationsResponse {
|
||||||
@Type(() => RegistrationApplicationView)
|
|
||||||
registration_applications: RegistrationApplicationView[];
|
registration_applications: RegistrationApplicationView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ApproveRegistrationApplication {
|
export interface ApproveRegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
approve: boolean;
|
approve: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
deny_reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
deny_reason: Option<string>;
|
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: ApproveRegistrationApplication) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RegistrationApplicationResponse {
|
export interface RegistrationApplicationResponse {
|
||||||
@Type(() => RegistrationApplicationView)
|
|
||||||
registration_application: RegistrationApplicationView;
|
registration_application: RegistrationApplicationView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetUnreadRegistrationApplicationCount {
|
export interface GetUnreadRegistrationApplicationCount {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
constructor(init: GetUnreadRegistrationApplicationCount) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GetUnreadRegistrationApplicationCountResponse {
|
export interface GetUnreadRegistrationApplicationCountResponse {
|
||||||
registration_applications: number;
|
registration_applications: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform } from "class-transformer";
|
|
||||||
import { toOption, toUndefined } from "../utils";
|
|
||||||
export const VERSION = "v3";
|
export const VERSION = "v3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,25 +224,9 @@ export enum PostFeatureType {
|
||||||
/**
|
/**
|
||||||
* 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 interface SiteMetadata {
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
title?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
description?: string;
|
||||||
@Expose()
|
image?: string;
|
||||||
title: Option<string>;
|
html?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
description: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
image: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
html: Option<string>;
|
|
||||||
|
|
||||||
constructor(init: SiteMetadata) {
|
|
||||||
Object.assign(this, init);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
import { Option } from "@sniptt/monads";
|
export interface LocalUserSettings {
|
||||||
import { Expose, Transform } from "class-transformer";
|
|
||||||
import { toOption, toUndefined } from "../utils";
|
|
||||||
|
|
||||||
export class LocalUserSettings {
|
|
||||||
id: number;
|
id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
email?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
email: Option<string>;
|
|
||||||
show_nsfw: boolean;
|
show_nsfw: boolean;
|
||||||
theme: string;
|
theme: string;
|
||||||
default_sort_type: number;
|
default_sort_type: number;
|
||||||
|
@ -25,80 +18,41 @@ export class LocalUserSettings {
|
||||||
accepted_application: boolean;
|
accepted_application: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonSafe {
|
export interface PersonSafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
display_name?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
avatar?: string;
|
||||||
@Expose()
|
|
||||||
display_name: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
avatar: Option<string>;
|
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
bio?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
bio: Option<string>;
|
|
||||||
local: boolean;
|
local: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
banner?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banner: Option<string>;
|
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
shared_inbox_url?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
matrix_user_id?: string;
|
||||||
@Expose()
|
|
||||||
shared_inbox_url: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
matrix_user_id: Option<string>;
|
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
bot_account: boolean;
|
bot_account: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
ban_expires?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
ban_expires: Option<string>;
|
|
||||||
instance_id: number;
|
instance_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Site {
|
export interface Site {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
sidebar?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
sidebar: Option<string>;
|
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
icon?: string;
|
||||||
@Expose()
|
banner?: string;
|
||||||
updated: Option<string>;
|
description?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
icon: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banner: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
description: Option<string>;
|
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
last_refreshed_at: string;
|
last_refreshed_at: string;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
private_key: Option<string>;
|
private_key?: string;
|
||||||
public_key: string;
|
public_key: string;
|
||||||
instance_id: number;
|
instance_id: number;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +63,7 @@ export enum RegistrationMode {
|
||||||
Open = "open",
|
Open = "open",
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LocalSite {
|
export interface LocalSite {
|
||||||
id: number;
|
id: number;
|
||||||
site_id: number;
|
site_id: number;
|
||||||
site_setup: boolean;
|
site_setup: boolean;
|
||||||
|
@ -118,23 +72,14 @@ export class LocalSite {
|
||||||
enable_nsfw: boolean;
|
enable_nsfw: boolean;
|
||||||
community_creation_admin_only: boolean;
|
community_creation_admin_only: boolean;
|
||||||
require_email_verification: boolean;
|
require_email_verification: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
application_question?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
application_question: Option<string>;
|
|
||||||
private_instance: boolean;
|
private_instance: boolean;
|
||||||
default_theme: string;
|
default_theme: string;
|
||||||
default_post_listing_type: string;
|
default_post_listing_type: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
legal_information?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
legal_information: Option<string>;
|
|
||||||
hide_modlog_mod_names: boolean;
|
hide_modlog_mod_names: boolean;
|
||||||
application_email_admins: boolean;
|
application_email_admins: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
slur_filter_regex?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
slur_filter_regex: Option<string>;
|
|
||||||
actor_name_max_length: number;
|
actor_name_max_length: number;
|
||||||
federation_enabled: boolean;
|
federation_enabled: boolean;
|
||||||
federation_debug: boolean;
|
federation_debug: boolean;
|
||||||
|
@ -142,13 +87,10 @@ export class LocalSite {
|
||||||
captcha_enabled: boolean;
|
captcha_enabled: boolean;
|
||||||
captcha_difficulty: string;
|
captcha_difficulty: string;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LocalSiteRateLimit {
|
export interface LocalSiteRateLimit {
|
||||||
id: number;
|
id: number;
|
||||||
local_site_id: number;
|
local_site_id: number;
|
||||||
message: number;
|
message: number;
|
||||||
|
@ -164,13 +106,10 @@ export class LocalSiteRateLimit {
|
||||||
search: number;
|
search: number;
|
||||||
search_per_second: number;
|
search_per_second: number;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessage {
|
export interface PrivateMessage {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
|
@ -178,78 +117,42 @@ export class PrivateMessage {
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostReport {
|
export interface PostReport {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
original_post_name: string;
|
original_post_name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
original_post_url?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
original_post_body?: string;
|
||||||
@Expose()
|
|
||||||
original_post_url: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
original_post_body: Option<string>;
|
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
resolver_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
resolver_id: Option<number>;
|
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Post {
|
export interface Post {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
url?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
body?: string;
|
||||||
@Expose()
|
|
||||||
url: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
body: Option<string>;
|
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
locked: boolean;
|
locked: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
embed_title?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
embed_description?: string;
|
||||||
@Expose()
|
embed_video_url?: string;
|
||||||
embed_title: Option<string>;
|
thumbnail_url?: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
embed_description: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
embed_video_url: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
thumbnail_url: Option<string>;
|
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
language_id: number;
|
language_id: number;
|
||||||
|
@ -257,40 +160,31 @@ export class Post {
|
||||||
featured_local: boolean;
|
featured_local: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PasswordResetRequest {
|
export interface PasswordResetRequest {
|
||||||
id: number;
|
id: number;
|
||||||
local_user_id: number;
|
local_user_id: number;
|
||||||
token_encrypted: string;
|
token_encrypted: string;
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemovePost {
|
export interface ModRemovePost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
removed?: boolean;
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModLockPost {
|
export interface ModLockPost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
locked?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
locked: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModFeaturePost {
|
export interface ModFeaturePost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
|
@ -299,216 +193,141 @@ export class ModFeaturePost {
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemoveComment {
|
export interface ModRemoveComment {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
removed?: boolean;
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemoveCommunity {
|
export interface ModRemoveCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
removed?: boolean;
|
||||||
@Expose()
|
expires?: string;
|
||||||
reason: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModBanFromCommunity {
|
export interface ModBanFromCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
banned?: boolean;
|
||||||
@Expose()
|
expires?: string;
|
||||||
reason: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banned: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModBan {
|
export interface ModBan {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
banned?: boolean;
|
||||||
@Expose()
|
expires?: string;
|
||||||
reason: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banned: Option<boolean>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
expires: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModAddCommunity {
|
export interface ModAddCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
removed?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModTransferCommunity {
|
export interface ModTransferCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
removed?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModAdd {
|
export interface ModAdd {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
removed?: boolean;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
removed: Option<boolean>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgePerson {
|
export interface AdminPurgePerson {
|
||||||
id: number;
|
id: number;
|
||||||
admin_person_id: number;
|
admin_person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgeCommunity {
|
export interface AdminPurgeCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
admin_person_id: number;
|
admin_person_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgePost {
|
export interface AdminPurgePost {
|
||||||
id: number;
|
id: number;
|
||||||
admin_person_id: number;
|
admin_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgeComment {
|
export interface AdminPurgeComment {
|
||||||
id: number;
|
id: number;
|
||||||
admin_person_id: number;
|
admin_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
reason?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
reason: Option<string>;
|
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunitySafe {
|
export interface CommunitySafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
description?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
description: Option<string>;
|
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
icon?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
banner?: string;
|
||||||
@Expose()
|
|
||||||
icon: Option<string>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
banner: Option<string>;
|
|
||||||
hidden: boolean;
|
hidden: boolean;
|
||||||
posting_restricted_to_mods: boolean;
|
posting_restricted_to_mods: boolean;
|
||||||
instance_id: number;
|
instance_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReport {
|
export interface CommentReport {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
original_comment_text: string;
|
original_comment_text: string;
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
resolver_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
resolver_id: Option<number>;
|
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Comment {
|
export interface Comment {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
content: string;
|
content: string;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
|
@ -517,7 +336,7 @@ export class Comment {
|
||||||
language_id: number;
|
language_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonMention {
|
export interface PersonMention {
|
||||||
id: number;
|
id: number;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
|
@ -525,7 +344,7 @@ export class PersonMention {
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReply {
|
export interface CommentReply {
|
||||||
id: number;
|
id: number;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
|
@ -533,52 +352,37 @@ export class CommentReply {
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RegistrationApplication {
|
export interface RegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
local_user_id: number;
|
local_user_id: number;
|
||||||
answer: string;
|
answer: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
deny_reason?: string;
|
||||||
@Expose()
|
|
||||||
admin_id: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
deny_reason: Option<string>;
|
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Language {
|
export interface Language {
|
||||||
id: number;
|
id: number;
|
||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessageReport {
|
export interface PrivateMessageReport {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
original_pm_text: string;
|
original_pm_text: string;
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
resolver_id?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
resolver_id: Option<number>;
|
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Tagline {
|
export interface Tagline {
|
||||||
id: number;
|
id: number;
|
||||||
local_site_id: number;
|
local_site_id: number;
|
||||||
content: string;
|
content: string;
|
||||||
published: string;
|
published: string;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
updated?: string;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
updated: Option<string>;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import { Option } from "@sniptt/monads";
|
|
||||||
import { Expose, Transform, Type } from "class-transformer";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { toOption, toUndefined } from "../utils";
|
|
||||||
import {
|
import {
|
||||||
CommentAggregates,
|
CommentAggregates,
|
||||||
CommunityAggregates,
|
CommunityAggregates,
|
||||||
|
@ -43,73 +39,49 @@ import {
|
||||||
Tagline,
|
Tagline,
|
||||||
} from "./source";
|
} from "./source";
|
||||||
|
|
||||||
export class PersonViewSafe {
|
export interface PersonViewSafe {
|
||||||
@Type(() => PersonSafe)
|
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
counts: PersonAggregates;
|
counts: PersonAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonMentionView {
|
export interface PersonMentionView {
|
||||||
@Type(() => PersonMention)
|
|
||||||
person_mention: PersonMention;
|
person_mention: PersonMention;
|
||||||
@Type(() => Comment)
|
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
recipient: PersonSafe;
|
recipient: PersonSafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
subscribed: SubscribedType;
|
subscribed: SubscribedType;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LocalUserSettingsView {
|
export interface LocalUserSettingsView {
|
||||||
@Type(() => LocalUserSettings)
|
|
||||||
local_user: LocalUserSettings;
|
local_user: LocalUserSettings;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
counts: PersonAggregates;
|
counts: PersonAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SiteView {
|
export interface SiteView {
|
||||||
@Type(() => Site)
|
|
||||||
site: Site;
|
site: Site;
|
||||||
@Type(() => LocalSite)
|
|
||||||
local_site: LocalSite;
|
local_site: LocalSite;
|
||||||
@Type(() => LocalSiteRateLimit)
|
|
||||||
local_site_rate_limit: LocalSiteRateLimit;
|
local_site_rate_limit: LocalSiteRateLimit;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
taglines?: Tagline[];
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
taglines: Option<Tagline[]>;
|
|
||||||
counts: SiteAggregates;
|
counts: SiteAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessageView {
|
export interface PrivateMessageView {
|
||||||
@Type(() => PrivateMessage)
|
|
||||||
private_message: PrivateMessage;
|
private_message: PrivateMessage;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
recipient: PersonSafe;
|
recipient: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostView {
|
export interface PostView {
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
counts: PostAggregates;
|
counts: PostAggregates;
|
||||||
|
@ -117,344 +89,191 @@ export class PostView {
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
unread_comments: number;
|
unread_comments: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostReportView {
|
export interface PostReportView {
|
||||||
@Type(() => PostReport)
|
|
||||||
post_report: PostReport;
|
post_report: PostReport;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
post_creator: PersonSafe;
|
post_creator: PersonSafe;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
counts: PostAggregates;
|
counts: PostAggregates;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
resolver?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
resolver: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentView {
|
export interface CommentView {
|
||||||
@Type(() => Comment)
|
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
subscribed: SubscribedType;
|
subscribed: SubscribedType;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReplyView {
|
export interface CommentReplyView {
|
||||||
@Type(() => CommentReply)
|
|
||||||
comment_reply: CommentReply;
|
comment_reply: CommentReply;
|
||||||
@Type(() => Comment)
|
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
recipient: PersonSafe;
|
recipient: PersonSafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
subscribed: SubscribedType;
|
subscribed: SubscribedType;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommentReportView {
|
export interface CommentReportView {
|
||||||
@Type(() => CommentReport)
|
|
||||||
comment_report: CommentReport;
|
comment_report: CommentReport;
|
||||||
@Type(() => Comment)
|
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
comment_creator: PersonSafe;
|
comment_creator: PersonSafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
my_vote?: number;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
resolver?: PersonSafe;
|
||||||
@Expose()
|
|
||||||
my_vote: Option<number>;
|
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
resolver: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModAddCommunityView {
|
export interface ModAddCommunityView {
|
||||||
@Type(() => ModAddCommunity)
|
|
||||||
mod_add_community: ModAddCommunity;
|
mod_add_community: ModAddCommunity;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModTransferCommunityView {
|
export interface ModTransferCommunityView {
|
||||||
@Type(() => ModTransferCommunity)
|
|
||||||
mod_transfer_community: ModTransferCommunity;
|
mod_transfer_community: ModTransferCommunity;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModAddView {
|
export interface ModAddView {
|
||||||
@Type(() => ModAdd)
|
|
||||||
mod_add: ModAdd;
|
mod_add: ModAdd;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModBanFromCommunityView {
|
export interface ModBanFromCommunityView {
|
||||||
@Type(() => ModBanFromCommunity)
|
|
||||||
mod_ban_from_community: ModBanFromCommunity;
|
mod_ban_from_community: ModBanFromCommunity;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
banned_person: PersonSafe;
|
banned_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModBanView {
|
export interface ModBanView {
|
||||||
@Type(() => ModBan)
|
|
||||||
mod_ban: ModBan;
|
mod_ban: ModBan;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
banned_person: PersonSafe;
|
banned_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModLockPostView {
|
export interface ModLockPostView {
|
||||||
@Type(() => ModLockPost)
|
|
||||||
mod_lock_post: ModLockPost;
|
mod_lock_post: ModLockPost;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemoveCommentView {
|
export interface ModRemoveCommentView {
|
||||||
@Type(() => ModRemoveComment)
|
|
||||||
mod_remove_comment: ModRemoveComment;
|
mod_remove_comment: ModRemoveComment;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => Comment)
|
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
commenter: PersonSafe;
|
commenter: PersonSafe;
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemoveCommunityView {
|
export interface ModRemoveCommunityView {
|
||||||
@Type(() => ModRemoveCommunity)
|
|
||||||
mod_remove_community: ModRemoveCommunity;
|
mod_remove_community: ModRemoveCommunity;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModRemovePostView {
|
export interface ModRemovePostView {
|
||||||
@Type(() => ModRemovePost)
|
|
||||||
mod_remove_post: ModRemovePost;
|
mod_remove_post: ModRemovePost;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModFeaturePostView {
|
export interface ModFeaturePostView {
|
||||||
@Type(() => ModFeaturePost)
|
|
||||||
mod_feature_post: ModFeaturePost;
|
mod_feature_post: ModFeaturePost;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
moderator?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: Option<PersonSafe>;
|
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgeCommunityView {
|
export interface AdminPurgeCommunityView {
|
||||||
@Type(() => AdminPurgeCommunity)
|
|
||||||
admin_purge_community: AdminPurgeCommunity;
|
admin_purge_community: AdminPurgeCommunity;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
admin: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgePersonView {
|
export interface AdminPurgePersonView {
|
||||||
@Type(() => AdminPurgePerson)
|
|
||||||
admin_purge_person: AdminPurgePerson;
|
admin_purge_person: AdminPurgePerson;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
admin: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgePostView {
|
export interface AdminPurgePostView {
|
||||||
@Type(() => AdminPurgePost)
|
|
||||||
admin_purge_post: AdminPurgePost;
|
admin_purge_post: AdminPurgePost;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
admin: Option<PersonSafe>;
|
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AdminPurgeCommentView {
|
export interface AdminPurgeCommentView {
|
||||||
@Type(() => AdminPurgeComment)
|
|
||||||
admin_purge_comment: AdminPurgeComment;
|
admin_purge_comment: AdminPurgeComment;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
admin: Option<PersonSafe>;
|
|
||||||
@Type(() => Post)
|
|
||||||
post: Post;
|
post: Post;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityFollowerView {
|
export interface CommunityFollowerView {
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
follower: PersonSafe;
|
follower: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityBlockView {
|
export interface CommunityBlockView {
|
||||||
@Type(() => PersonSafe)
|
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityModeratorView {
|
export interface CommunityModeratorView {
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityPersonBanView {
|
export interface CommunityPersonBanView {
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PersonBlockView {
|
export interface PersonBlockView {
|
||||||
@Type(() => PersonSafe)
|
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
target: PersonSafe;
|
target: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommunityView {
|
export interface CommunityView {
|
||||||
@Type(() => CommunitySafe)
|
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
subscribed: SubscribedType;
|
subscribed: SubscribedType;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
counts: CommunityAggregates;
|
counts: CommunityAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RegistrationApplicationView {
|
export interface RegistrationApplicationView {
|
||||||
@Type(() => RegistrationApplication)
|
|
||||||
registration_application: RegistrationApplication;
|
registration_application: RegistrationApplication;
|
||||||
@Type(() => LocalUserSettings)
|
|
||||||
creator_local_user: LocalUserSettings;
|
creator_local_user: LocalUserSettings;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
admin?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
admin: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentNode {
|
export interface CommentNode {
|
||||||
|
@ -463,18 +282,10 @@ export interface CommentNode {
|
||||||
depth: number;
|
depth: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PrivateMessageReportView {
|
export interface PrivateMessageReportView {
|
||||||
@Type(() => PrivateMessageReport)
|
|
||||||
private_message_report: PrivateMessageReport;
|
private_message_report: PrivateMessageReport;
|
||||||
@Type(() => PrivateMessage)
|
|
||||||
private_message: PrivateMessage;
|
private_message: PrivateMessage;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
private_message_creator: PersonSafe;
|
private_message_creator: PersonSafe;
|
||||||
@Type(() => PersonSafe)
|
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
resolver?: PersonSafe;
|
||||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
|
||||||
@Expose()
|
|
||||||
@Type(() => PersonSafe)
|
|
||||||
resolver: Option<PersonSafe>;
|
|
||||||
}
|
}
|
||||||
|
|
15
src/utils.ts
15
src/utils.ts
|
@ -1,15 +0,0 @@
|
||||||
import { Option, Some } from "@sniptt/monads";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts an option to an undefined. Necessary for API requests.
|
|
||||||
*/
|
|
||||||
export function toUndefined<T>(opt: Option<T>) {
|
|
||||||
return opt.isSome() ? opt.unwrap() : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a null value to an option.
|
|
||||||
*/
|
|
||||||
export function toOption<T>(val: T): Option<T> {
|
|
||||||
return Some(val || undefined);
|
|
||||||
}
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { ClassConstructor, deserialize, serialize } from "class-transformer";
|
|
||||||
import {
|
import {
|
||||||
CreateComment,
|
CreateComment,
|
||||||
CreateCommentLike,
|
CreateCommentLike,
|
||||||
|
@ -686,7 +685,7 @@ export class LemmyWebsocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
||||||
let send = serialize({ op: UserOperation[op], data });
|
let send = JSON.stringify({ op: UserOperation[op], data });
|
||||||
return send;
|
return send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,10 +697,8 @@ export function wsUserOp(msg: any): UserOperation {
|
||||||
/**
|
/**
|
||||||
* Converts a websocket string response to a usable result
|
* Converts a websocket string response to a usable result
|
||||||
*/
|
*/
|
||||||
export function wsJsonToRes<ResponseType>(
|
// TODO is this still necessary?
|
||||||
msg: any,
|
export function wsJsonToRes<ResponseType>(msg: any): ResponseType {
|
||||||
responseClass: ClassConstructor<ResponseType>
|
|
||||||
): ResponseType {
|
|
||||||
// Have to deserialize the response again into the correct class
|
// Have to deserialize the response again into the correct class
|
||||||
return deserialize(responseClass, serialize(msg.data));
|
return msg.data as ResponseType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"target": "ES5",
|
"target": "ES5",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
"moduleResolution": "Node"
|
"moduleResolution": "Node"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|
15
yarn.lock
15
yarn.lock
|
@ -285,11 +285,6 @@
|
||||||
"@nodelib/fs.scandir" "2.1.5"
|
"@nodelib/fs.scandir" "2.1.5"
|
||||||
fastq "^1.6.0"
|
fastq "^1.6.0"
|
||||||
|
|
||||||
"@sniptt/monads@^0.5.10":
|
|
||||||
version "0.5.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sniptt/monads/-/monads-0.5.10.tgz#a80cd00738bbd682d36d36dd36bdc0bddc96eb76"
|
|
||||||
integrity sha512-+agDOv9DpDV+9e2zN/Vmdk+XaqGx5Sykl0fqhqgiJ90r18nsBkxe44DmZ2sA1HYK+MSsBeZBiAr6pq4w+5uhfw==
|
|
||||||
|
|
||||||
"@types/glob@^7.1.1":
|
"@types/glob@^7.1.1":
|
||||||
version "7.2.0"
|
version "7.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
|
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
|
||||||
|
@ -581,11 +576,6 @@ chalk@^4.0.0:
|
||||||
ansi-styles "^4.1.0"
|
ansi-styles "^4.1.0"
|
||||||
supports-color "^7.1.0"
|
supports-color "^7.1.0"
|
||||||
|
|
||||||
class-transformer@^0.5.1:
|
|
||||||
version "0.5.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/class-transformer/-/class-transformer-0.5.1.tgz#24147d5dffd2a6cea930a3250a677addf96ab336"
|
|
||||||
integrity sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==
|
|
||||||
|
|
||||||
clean-stack@^2.0.0:
|
clean-stack@^2.0.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
|
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
|
||||||
|
@ -1720,11 +1710,6 @@ queue-microtask@^1.2.2:
|
||||||
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
|
||||||
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
|
||||||
|
|
||||||
reflect-metadata@^0.1.13:
|
|
||||||
version "0.1.13"
|
|
||||||
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
|
|
||||||
integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==
|
|
||||||
|
|
||||||
regexpp@^3.2.0:
|
regexpp@^3.2.0:
|
||||||
version "3.2.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
|
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
|
||||||
|
|
Loading…
Reference in a new issue