mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 22:31:12 +00:00
Adding rust-style Options using @sniptt/monads
- Also added serialization with class-transformer
This commit is contained in:
parent
b2bd89c105
commit
052ea66973
15 changed files with 2438 additions and 652 deletions
|
@ -16,16 +16,17 @@
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
"repository": "https://github.com/LemmyNet/lemmy-js-client",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@sniptt/monads": "^0.5.10",
|
||||||
"@types/node": "^17.0.33",
|
"@types/node": "^17.0.33",
|
||||||
"@types/node-fetch": "^3.0.3",
|
"@types/node-fetch": "^3.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
||||||
"@typescript-eslint/parser": "^5.23.0",
|
"@typescript-eslint/parser": "^5.23.0",
|
||||||
|
"class-transformer": "^0.5.1",
|
||||||
"eslint": "^8.15.0",
|
"eslint": "^8.15.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"lint-staged": "^12.4.1",
|
"lint-staged": "^12.4.1",
|
||||||
"node-fetch": "^3.2.4",
|
"node-fetch": "^3.2.4",
|
||||||
"option-t": "^32.2.0",
|
|
||||||
"prettier": "^2.6.2",
|
"prettier": "^2.6.2",
|
||||||
"prettier-plugin-import-sort": "^0.0.7",
|
"prettier-plugin-import-sort": "^0.0.7",
|
||||||
"prettier-plugin-organize-imports": "^2.3.4",
|
"prettier-plugin-organize-imports": "^2.3.4",
|
||||||
|
|
673
src/http.ts
673
src/http.ts
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,4 @@
|
||||||
export * from "./http";
|
export * from "./http";
|
||||||
export * from "./interfaces";
|
export * from "./interfaces";
|
||||||
|
export * from "./utils";
|
||||||
export * from "./websocket";
|
export * from "./websocket";
|
||||||
|
|
|
@ -1,74 +1,154 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../../utils";
|
||||||
import { ListingType, SortType } from "../others";
|
import { ListingType, SortType } from "../others";
|
||||||
import { CommentReportView, CommentView } from "../views";
|
import { CommentReportView, CommentView } from "../views";
|
||||||
|
|
||||||
export interface CreateComment {
|
export class CreateComment {
|
||||||
content: string;
|
content: string;
|
||||||
parent_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
parent_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.
|
||||||
*/
|
*/
|
||||||
form_id?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
form_id: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
content: string,
|
||||||
|
parent_id: Option<number>,
|
||||||
|
post_id: number,
|
||||||
|
form_id: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.content = content;
|
||||||
|
this.parent_id = parent_id;
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.form_id = form_id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditComment {
|
export class EditComment {
|
||||||
content: string;
|
content: string;
|
||||||
comment_id: number;
|
comment_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.
|
||||||
*/
|
*/
|
||||||
form_id?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
form_id: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
content: string,
|
||||||
|
comment_id: number,
|
||||||
|
form_id: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.content = content;
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.form_id = form_id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only the creator can delete the comment.
|
* Only the creator can delete the comment.
|
||||||
*/
|
*/
|
||||||
export interface DeleteComment {
|
export class DeleteComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(comment_id: number, deleted: boolean, auth: string) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.deleted = deleted;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only a mod or admin can remove the comment.
|
* Only a mod or admin can remove the comment.
|
||||||
*/
|
*/
|
||||||
export interface RemoveComment {
|
export class RemoveComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
comment_id: number,
|
||||||
|
removed: boolean,
|
||||||
|
reason: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.removed = removed;
|
||||||
|
this.reason = reason;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only the recipient can do this.
|
* Only the recipient can do this.
|
||||||
*/
|
*/
|
||||||
export interface MarkCommentAsRead {
|
export class MarkCommentAsRead {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(comment_id: number, read: boolean, auth: string) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.read = read;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaveComment {
|
export class SaveComment {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
save: boolean;
|
save: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(comment_id: number, save: boolean, auth: string) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.save = save;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentResponse {
|
export class CommentResponse {
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
form_id?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
form_id: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateCommentLike {
|
export class CreateCommentLike {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
score: number;
|
score: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(comment_id: number, score: number, auth: string) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.score = score;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,55 +157,137 @@ export interface 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 interface GetComments {
|
export class GetComments {
|
||||||
type_?: ListingType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
sort?: SortType;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
type_: Option<ListingType>;
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
community_name?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
saved_only?: boolean;
|
@Expose()
|
||||||
auth?: string;
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
saved_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type_: Option<ListingType>,
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
community_name: Option<string>,
|
||||||
|
saved_only: Option<boolean>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.type_ = type_;
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.community_name = community_name;
|
||||||
|
this.saved_only = saved_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetCommentsResponse {
|
export class GetCommentsResponse {
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateCommentReport {
|
export class CreateCommentReport {
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(comment_id: number, reason: string, auth: string) {
|
||||||
|
this.comment_id = comment_id;
|
||||||
|
this.reason = reason;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentReportResponse {
|
export class CommentReportResponse {
|
||||||
comment_report_view: CommentReportView;
|
comment_report_view: CommentReportView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolveCommentReport {
|
export class 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(report_id: number, resolved: boolean, auth: string) {
|
||||||
|
this.report_id = report_id;
|
||||||
|
this.resolved = resolved;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListCommentReports {
|
export class ListCommentReports {
|
||||||
page?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
limit?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(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.
|
||||||
*/
|
*/
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
unresolved_only?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
unresolved_only: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
unresolved_only: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.unresolved_only = unresolved_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListCommentReportsResponse {
|
export class ListCommentReportsResponse {
|
||||||
comment_reports: CommentReportView[];
|
comment_reports: CommentReportView[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../../utils";
|
||||||
import { ListingType, SortType } from "../others";
|
import { ListingType, SortType } from "../others";
|
||||||
import { Site } from "../source";
|
import { Site } from "../source";
|
||||||
import {
|
import {
|
||||||
|
@ -11,47 +14,129 @@ import {
|
||||||
*
|
*
|
||||||
* To get a federated community by name, use `name@instance.tld` .
|
* To get a federated community by name, use `name@instance.tld` .
|
||||||
*/
|
*/
|
||||||
export interface GetCommunity {
|
export class GetCommunity {
|
||||||
id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
name?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
auth?: string;
|
@Expose()
|
||||||
|
id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(id: Option<number>, name: Option<string>, auth: Option<string>) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetCommunityResponse {
|
export class GetCommunityResponse {
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
site?: Site;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
site: Option<Site>;
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
online: number;
|
online: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateCommunity {
|
export class CreateCommunity {
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
icon?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
banner?: string;
|
@Expose()
|
||||||
nsfw?: boolean;
|
description: Option<string>;
|
||||||
posting_restricted_to_mods?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
icon: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
nsfw: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
posting_restricted_to_mods: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
name: string,
|
||||||
|
title: string,
|
||||||
|
description: Option<string>,
|
||||||
|
icon: Option<string>,
|
||||||
|
banner: Option<string>,
|
||||||
|
nsfw: Option<boolean>,
|
||||||
|
posting_restricted_to_mods: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.name = name;
|
||||||
|
this.title = title;
|
||||||
|
this.description = description;
|
||||||
|
this.icon = icon;
|
||||||
|
this.banner = banner;
|
||||||
|
this.nsfw = nsfw;
|
||||||
|
this.posting_restricted_to_mods = posting_restricted_to_mods;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityResponse {
|
export class CommunityResponse {
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListCommunities {
|
export class ListCommunities {
|
||||||
type_?: ListingType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
sort?: SortType;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
type_: Option<ListingType>;
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type_: Option<ListingType>,
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.type_ = type_;
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListCommunitiesResponse {
|
export class ListCommunitiesResponse {
|
||||||
communities: CommunityView[];
|
communities: CommunityView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BanFromCommunity {
|
export class BanFromCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
ban: boolean;
|
ban: boolean;
|
||||||
|
@ -59,84 +144,205 @@ export interface BanFromCommunity {
|
||||||
/**
|
/**
|
||||||
* Removes/Restores their comments and posts for that community.
|
* Removes/Restores their comments and posts for that community.
|
||||||
*/
|
*/
|
||||||
remove_data?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
reason?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
remove_data: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(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
|
||||||
*/
|
*/
|
||||||
expires?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
community_id: number,
|
||||||
|
person_id: number,
|
||||||
|
ban: boolean,
|
||||||
|
remove_data: Option<boolean>,
|
||||||
|
reason: Option<string>,
|
||||||
|
expires: Option<number>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.ban = ban;
|
||||||
|
this.remove_data = remove_data;
|
||||||
|
this.reason = reason;
|
||||||
|
this.expires = expires;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BanFromCommunityResponse {
|
export class BanFromCommunityResponse {
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddModToCommunity {
|
export class AddModToCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
added: boolean;
|
added: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
community_id: number,
|
||||||
|
person_id: number,
|
||||||
|
added: boolean,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.added = added;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddModToCommunityResponse {
|
export class AddModToCommunityResponse {
|
||||||
moderators: CommunityModeratorView[];
|
moderators: CommunityModeratorView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only mods can edit a community.
|
* Only mods can edit a community.
|
||||||
*/
|
*/
|
||||||
export interface EditCommunity {
|
export class EditCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
title?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
description?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
icon?: string;
|
@Expose()
|
||||||
banner?: string;
|
title: Option<string>;
|
||||||
nsfw?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
posting_restricted_to_mods?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
description: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
icon: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
nsfw: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
posting_restricted_to_mods: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
community_id: number,
|
||||||
|
title: Option<string>,
|
||||||
|
description: Option<string>,
|
||||||
|
icon: Option<string>,
|
||||||
|
banner: Option<string>,
|
||||||
|
nsfw: Option<boolean>,
|
||||||
|
posting_restricted_to_mods: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.title = title;
|
||||||
|
this.description = description;
|
||||||
|
this.icon = icon;
|
||||||
|
this.banner = banner;
|
||||||
|
this.nsfw = nsfw;
|
||||||
|
this.posting_restricted_to_mods = posting_restricted_to_mods;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteCommunity {
|
export class DeleteCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(community_id: number, deleted: boolean, auth: string) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.deleted = deleted;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins can remove a community.
|
* Only admins can remove a community.
|
||||||
*/
|
*/
|
||||||
export interface RemoveCommunity {
|
export class RemoveCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(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
|
||||||
*/
|
*/
|
||||||
expires?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
community_id: number,
|
||||||
|
removed: boolean,
|
||||||
|
reason: Option<string>,
|
||||||
|
expires: Option<number>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.removed = removed;
|
||||||
|
this.reason = reason;
|
||||||
|
this.expires = expires;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FollowCommunity {
|
export class FollowCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
follow: boolean;
|
follow: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(community_id: number, follow: boolean, auth: string) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.follow = follow;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransferCommunity {
|
export class TransferCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(community_id: number, person_id: number, auth: string) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockCommunity {
|
export class BlockCommunity {
|
||||||
community_id: number;
|
community_id: number;
|
||||||
block: boolean;
|
block: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(community_id: number, block: boolean, auth: string) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.block = block;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockCommunityResponse {
|
export class BlockCommunityResponse {
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../../utils";
|
||||||
import { SortType } from "../others";
|
import { SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -8,9 +11,14 @@ import {
|
||||||
PrivateMessageView,
|
PrivateMessageView,
|
||||||
} from "../views";
|
} from "../views";
|
||||||
|
|
||||||
export interface Login {
|
export class Login {
|
||||||
username_or_email: string;
|
username_or_email: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
|
constructor(username_or_email: string, password: string) {
|
||||||
|
this.username_or_email = username_or_email;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,37 +26,77 @@ export interface 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 interface Register {
|
export class 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
|
||||||
*/
|
*/
|
||||||
email?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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.
|
||||||
*/
|
*/
|
||||||
captcha_uuid?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
captcha_answer?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
honeypot?: string;
|
@Expose()
|
||||||
|
captcha_uuid: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
captcha_answer: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(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
|
||||||
*/
|
*/
|
||||||
answer?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
answer: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
username: string,
|
||||||
|
email: Option<string>,
|
||||||
|
password: string,
|
||||||
|
password_verify: string,
|
||||||
|
show_nsfw: boolean,
|
||||||
|
captcha_uuid: Option<string>,
|
||||||
|
captcha_answer: Option<string>,
|
||||||
|
honeypot: Option<string>,
|
||||||
|
answer: Option<string>
|
||||||
|
) {
|
||||||
|
this.username = username;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
this.password_verify = password_verify;
|
||||||
|
this.show_nsfw = show_nsfw;
|
||||||
|
this.captcha_uuid = captcha_uuid;
|
||||||
|
this.captcha_answer = captcha_answer;
|
||||||
|
this.honeypot = honeypot;
|
||||||
|
this.answer = answer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetCaptcha {}
|
export class GetCaptcha {}
|
||||||
|
|
||||||
export interface GetCaptchaResponse {
|
export class GetCaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* Will be undefined if captchas are disabled.
|
* Will be undefined if captchas are disabled.
|
||||||
*/
|
*/
|
||||||
ok?: CaptchaResponse;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
ok: Option<CaptchaResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CaptchaResponse {
|
export class CaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* A Base64 encoded png.
|
* A Base64 encoded png.
|
||||||
*/
|
*/
|
||||||
|
@ -57,7 +105,10 @@ export interface CaptchaResponse {
|
||||||
/**
|
/**
|
||||||
* A Base64 encoded wav file.
|
* A Base64 encoded wav file.
|
||||||
*/
|
*/
|
||||||
wav?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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.
|
||||||
|
@ -65,259 +116,584 @@ export interface CaptchaResponse {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaveUserSettings {
|
export class SaveUserSettings {
|
||||||
show_nsfw?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_nsfw: Option<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default for this is `browser`.
|
* Default for this is `browser`.
|
||||||
*/
|
*/
|
||||||
theme?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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
|
||||||
*/
|
*/
|
||||||
default_sort_type?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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`
|
||||||
*/
|
*/
|
||||||
default_listing_type?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
lang?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
avatar?: string;
|
@Expose()
|
||||||
banner?: string;
|
default_listing_type: Option<number>;
|
||||||
display_name?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
email?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
bio?: string;
|
@Expose()
|
||||||
matrix_user_id?: string;
|
lang: Option<string>;
|
||||||
show_avatars?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
show_scores?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
send_notifications_to_email?: boolean;
|
@Expose()
|
||||||
bot_account?: boolean;
|
avatar: Option<string>;
|
||||||
show_bot_accounts?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
show_read_posts?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
show_new_post_notifs?: boolean;
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
display_name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
email: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
bio: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
matrix_user_id: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_avatars: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_scores: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
send_notifications_to_email: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
bot_account: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_bot_accounts: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_read_posts: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
show_new_post_notifs: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
show_nsfw: Option<boolean>,
|
||||||
|
theme: Option<string>,
|
||||||
|
default_sort_type: Option<number>,
|
||||||
|
default_listing_type: Option<number>,
|
||||||
|
lang: Option<string>,
|
||||||
|
avatar: Option<string>,
|
||||||
|
banner: Option<string>,
|
||||||
|
display_name: Option<string>,
|
||||||
|
email: Option<string>,
|
||||||
|
bio: Option<string>,
|
||||||
|
matrix_user_id: Option<string>,
|
||||||
|
show_avatars: Option<boolean>,
|
||||||
|
show_scores: Option<boolean>,
|
||||||
|
send_notifications_to_email: Option<boolean>,
|
||||||
|
bot_account: Option<boolean>,
|
||||||
|
show_bot_accounts: Option<boolean>,
|
||||||
|
show_read_posts: Option<boolean>,
|
||||||
|
show_new_post_notifs: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.show_nsfw = show_nsfw;
|
||||||
|
this.theme = theme;
|
||||||
|
this.default_sort_type = default_sort_type;
|
||||||
|
this.default_listing_type = default_listing_type;
|
||||||
|
this.lang = lang;
|
||||||
|
this.avatar = avatar;
|
||||||
|
this.banner = banner;
|
||||||
|
this.display_name = display_name;
|
||||||
|
this.email = email;
|
||||||
|
this.bio = bio;
|
||||||
|
this.matrix_user_id = matrix_user_id;
|
||||||
|
this.show_avatars = show_avatars;
|
||||||
|
this.show_scores = show_scores;
|
||||||
|
this.send_notifications_to_email = send_notifications_to_email;
|
||||||
|
this.bot_account = bot_account;
|
||||||
|
this.show_bot_accounts = show_bot_accounts;
|
||||||
|
this.show_read_posts = show_read_posts;
|
||||||
|
this.show_new_post_notifs = show_new_post_notifs;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChangePassword {
|
export class 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(
|
||||||
|
new_password: string,
|
||||||
|
new_password_verify: string,
|
||||||
|
old_password: string,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.new_password = new_password;
|
||||||
|
this.new_password_verify = new_password_verify;
|
||||||
|
this.old_password = old_password;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 interface LoginResponse {
|
export class LoginResponse {
|
||||||
/**
|
/**
|
||||||
* This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
* This is None in response to `Register` if email verification is enabled, or the server requires registration applications.
|
||||||
*/
|
*/
|
||||||
jwt?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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 interface GetPersonDetails {
|
export class GetPersonDetails {
|
||||||
person_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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`.
|
||||||
*/
|
*/
|
||||||
username?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
sort?: SortType;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
username: Option<string>;
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
saved_only?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
auth?: string;
|
@Expose()
|
||||||
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
saved_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
person_id: Option<number>,
|
||||||
|
username: Option<string>,
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
saved_only: Option<boolean>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.username = username;
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.saved_only = saved_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPersonDetailsResponse {
|
export class GetPersonDetailsResponse {
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
posts: PostView[];
|
posts: PostView[];
|
||||||
moderates: CommunityModeratorView[];
|
moderates: CommunityModeratorView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetRepliesResponse {
|
export class GetRepliesResponse {
|
||||||
replies: CommentView[];
|
replies: CommentView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPersonMentionsResponse {
|
export class GetPersonMentionsResponse {
|
||||||
mentions: PersonMentionView[];
|
mentions: PersonMentionView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarkAllAsRead {
|
export class MarkAllAsRead {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddAdmin {
|
export class AddAdmin {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
added: boolean;
|
added: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(person_id: number, added: boolean, auth: string) {
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.added = added;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AddAdminResponse {
|
export class AddAdminResponse {
|
||||||
admins: PersonViewSafe[];
|
admins: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BanPerson {
|
export class 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
|
||||||
*/
|
*/
|
||||||
remove_data?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
reason?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
remove_data: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(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
|
||||||
*/
|
*/
|
||||||
expires?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
person_id: number,
|
||||||
|
ban: boolean,
|
||||||
|
remove_data: Option<boolean>,
|
||||||
|
reason: Option<string>,
|
||||||
|
expires: Option<number>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.ban = ban;
|
||||||
|
this.remove_data = remove_data;
|
||||||
|
this.reason = reason;
|
||||||
|
this.expires = expires;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BanPersonResponse {
|
export class BanPersonResponse {
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetReplies {
|
export class GetReplies {
|
||||||
sort?: SortType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
page?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
limit?: number;
|
@Expose()
|
||||||
unread_only?: boolean;
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
unread_only: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
unread_only: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.unread_only = unread_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPersonMentions {
|
export class GetPersonMentions {
|
||||||
sort?: SortType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
page?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
limit?: number;
|
@Expose()
|
||||||
unread_only?: boolean;
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
unread_only: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
unread_only: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.unread_only = unread_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarkPersonMentionAsRead {
|
export class MarkPersonMentionAsRead {
|
||||||
person_mention_id: number;
|
person_mention_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(person_mention_id: number, read: boolean, auth: string) {
|
||||||
|
this.person_mention_id = person_mention_id;
|
||||||
|
this.read = read;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMentionResponse {
|
export class PersonMentionResponse {
|
||||||
person_mention_view: PersonMentionView;
|
person_mention_view: PersonMentionView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permanently deletes your posts and comments
|
* Permanently deletes your posts and comments
|
||||||
*/
|
*/
|
||||||
export interface DeleteAccount {
|
export class DeleteAccount {
|
||||||
password: string;
|
password: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(password: string, auth: string) {
|
||||||
|
this.password = password;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteAccountResponse {}
|
export class DeleteAccountResponse {}
|
||||||
|
|
||||||
export interface PasswordReset {
|
export class PasswordReset {
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
|
constructor(email: string) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PasswordResetResponse {}
|
export class PasswordResetResponse {}
|
||||||
|
|
||||||
export interface PasswordChange {
|
export class PasswordChange {
|
||||||
token: string;
|
token: string;
|
||||||
password: string;
|
password: string;
|
||||||
password_verify: string;
|
password_verify: string;
|
||||||
|
|
||||||
|
constructor(token: string, password: string, password_verify: string) {
|
||||||
|
this.token = token;
|
||||||
|
this.password = password;
|
||||||
|
this.password_verify = password_verify;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreatePrivateMessage {
|
export class CreatePrivateMessage {
|
||||||
content: string;
|
content: string;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(content: string, recipient_id: number, auth: string) {
|
||||||
|
this.content = content;
|
||||||
|
this.recipient_id = recipient_id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditPrivateMessage {
|
export class EditPrivateMessage {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
content: string;
|
content: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(private_message_id: number, content: string, auth: string) {
|
||||||
|
this.private_message_id = private_message_id;
|
||||||
|
this.content = content;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeletePrivateMessage {
|
export class DeletePrivateMessage {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(private_message_id: number, deleted: boolean, auth: string) {
|
||||||
|
this.private_message_id = private_message_id;
|
||||||
|
this.deleted = deleted;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarkPrivateMessageAsRead {
|
export class MarkPrivateMessageAsRead {
|
||||||
private_message_id: number;
|
private_message_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(private_message_id: number, read: boolean, auth: string) {
|
||||||
|
this.private_message_id = private_message_id;
|
||||||
|
this.read = read;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPrivateMessages {
|
export class GetPrivateMessages {
|
||||||
unread_only?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
page?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
limit?: number;
|
@Expose()
|
||||||
|
unread_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrivateMessagesResponse {
|
export class PrivateMessagesResponse {
|
||||||
private_messages: PrivateMessageView[];
|
private_messages: PrivateMessageView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrivateMessageResponse {
|
export class PrivateMessageResponse {
|
||||||
private_message_view: PrivateMessageView;
|
private_message_view: PrivateMessageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetReportCount {
|
export class GetReportCount {
|
||||||
/**
|
/**
|
||||||
* If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates.
|
* If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates.
|
||||||
*/
|
*/
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(community_id: Option<number>, auth: string) {
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetReportCountResponse {
|
export class GetReportCountResponse {
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
comment_reports: number;
|
comment_reports: number;
|
||||||
post_reports: number;
|
post_reports: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetUnreadCount {
|
export class GetUnreadCount {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetUnreadCountResponse {
|
export class GetUnreadCountResponse {
|
||||||
replies: number;
|
replies: number;
|
||||||
mentions: number;
|
mentions: number;
|
||||||
private_messages: number;
|
private_messages: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VerifyEmail {
|
export class VerifyEmail {
|
||||||
token: string;
|
token: string;
|
||||||
|
|
||||||
|
constructor(token: string) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VerifyEmailResponse {}
|
export class VerifyEmailResponse {}
|
||||||
|
|
||||||
export interface BlockPerson {
|
export class BlockPerson {
|
||||||
person_id: number;
|
person_id: number;
|
||||||
block: boolean;
|
block: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(person_id: number, block: boolean, auth: string) {
|
||||||
|
this.person_id = person_id;
|
||||||
|
this.block = block;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BlockPersonResponse {
|
export class BlockPersonResponse {
|
||||||
person_view: PersonViewSafe;
|
person_view: PersonViewSafe;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetBannedPersons {
|
export class GetBannedPersons {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BannedPersonsResponse {
|
export class BannedPersonsResponse {
|
||||||
banned: PersonViewSafe[];
|
banned: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../../utils";
|
||||||
import { ListingType, SiteMetadata, SortType } from "../others";
|
import { ListingType, SiteMetadata, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -7,26 +10,64 @@ import {
|
||||||
PostView,
|
PostView,
|
||||||
} from "../views";
|
} from "../views";
|
||||||
|
|
||||||
export interface CreatePost {
|
export class CreatePost {
|
||||||
name: string;
|
name: string;
|
||||||
url?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
body?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
nsfw?: boolean;
|
@Expose()
|
||||||
|
url: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
body: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
nsfw: Option<boolean>;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
honeypot: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
honeypot?: string;
|
|
||||||
|
constructor(
|
||||||
|
name: string,
|
||||||
|
url: Option<string>,
|
||||||
|
body: Option<string>,
|
||||||
|
nsfw: Option<boolean>,
|
||||||
|
community_id: number,
|
||||||
|
honeypot: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.name = name;
|
||||||
|
this.url = url;
|
||||||
|
this.body = body;
|
||||||
|
this.nsfw = nsfw;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.honeypot = honeypot;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostResponse {
|
export class PostResponse {
|
||||||
post_view: PostView;
|
post_view: PostView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPost {
|
export class GetPost {
|
||||||
id: number;
|
id: number;
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(id: number, auth: Option<string>) {
|
||||||
|
this.id = id;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPostResponse {
|
export class GetPostResponse {
|
||||||
post_view: PostView;
|
post_view: PostView;
|
||||||
community_view: CommunityView;
|
community_view: CommunityView;
|
||||||
comments: CommentView[];
|
comments: CommentView[];
|
||||||
|
@ -34,25 +75,69 @@ export interface GetPostResponse {
|
||||||
online: number;
|
online: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPosts {
|
export class GetPosts {
|
||||||
type_?: ListingType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
sort?: SortType;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
type_: Option<ListingType>;
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(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` .
|
||||||
*/
|
*/
|
||||||
community_name?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
saved_only?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
auth?: string;
|
@Expose()
|
||||||
|
community_name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
saved_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
type_: Option<ListingType>,
|
||||||
|
sort: Option<SortType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
community_name: Option<string>,
|
||||||
|
saved_only: Option<boolean>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.type_ = type_;
|
||||||
|
this.sort = sort;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.community_name = community_name;
|
||||||
|
this.saved_only = saved_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPostsResponse {
|
export class GetPostsResponse {
|
||||||
posts: PostView[];
|
posts: PostView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreatePostLike {
|
export class CreatePostLike {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,107 +145,228 @@ export interface CreatePostLike {
|
||||||
*/
|
*/
|
||||||
score: number;
|
score: number;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, score: number, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.score = score;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditPost {
|
export class EditPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
name?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
url?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
body?: string;
|
@Expose()
|
||||||
nsfw?: boolean;
|
name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
url: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
body: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
nsfw: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
post_id: number,
|
||||||
|
name: Option<string>,
|
||||||
|
url: Option<string>,
|
||||||
|
body: Option<string>,
|
||||||
|
nsfw: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.name = name;
|
||||||
|
this.url = url;
|
||||||
|
this.body = body;
|
||||||
|
this.nsfw = nsfw;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeletePost {
|
export class DeletePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, deleted: boolean, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.deleted = deleted;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can remove a post.
|
* Only admins and mods can remove a post.
|
||||||
*/
|
*/
|
||||||
export interface RemovePost {
|
export class RemovePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
post_id: number,
|
||||||
|
removed: boolean,
|
||||||
|
reason: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.removed = removed;
|
||||||
|
this.reason = reason;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks a post as read.
|
* Marks a post as read.
|
||||||
*/
|
*/
|
||||||
export interface MarkPostAsRead {
|
export class MarkPostAsRead {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, read: boolean, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.read = read;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can lock a post.
|
* Only admins and mods can lock a post.
|
||||||
*/
|
*/
|
||||||
export interface LockPost {
|
export class LockPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
locked: boolean;
|
locked: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, locked: boolean, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.locked = locked;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only admins and mods can sticky a post.
|
* Only admins and mods can sticky a post.
|
||||||
*/
|
*/
|
||||||
export interface StickyPost {
|
export class StickyPost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
stickied: boolean;
|
stickied: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, stickied: boolean, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.stickied = stickied;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SavePost {
|
export class SavePost {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
save: boolean;
|
save: boolean;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, save: boolean, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.save = save;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreatePostReport {
|
export class CreatePostReport {
|
||||||
post_id: number;
|
post_id: number;
|
||||||
reason: string;
|
reason: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(post_id: number, reason: string, auth: string) {
|
||||||
|
this.post_id = post_id;
|
||||||
|
this.reason = reason;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostReportResponse {
|
export class PostReportResponse {
|
||||||
post_report_view: PostReportView;
|
post_report_view: PostReportView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolvePostReport {
|
export class 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(report_id: number, resolved: boolean, auth: string) {
|
||||||
|
this.report_id = report_id;
|
||||||
|
this.resolved = resolved;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListPostReports {
|
export class ListPostReports {
|
||||||
page?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
limit?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(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.
|
||||||
*/
|
*/
|
||||||
community_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
/**
|
/**
|
||||||
* Only shows the unresolved reports.
|
* Only shows the unresolved reports.
|
||||||
*/
|
*/
|
||||||
unresolved_only?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
unresolved_only: Option<boolean>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
unresolved_only: Option<boolean>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.unresolved_only = unresolved_only;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListPostReportsResponse {
|
export class ListPostReportsResponse {
|
||||||
post_reports: PostReportView[];
|
post_reports: PostReportView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSiteMetadata {
|
export class GetSiteMetadata {
|
||||||
url: string;
|
url: string;
|
||||||
|
|
||||||
|
constructor(url: string) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSiteMetadataResponse {
|
export class GetSiteMetadataResponse {
|
||||||
metadata: SiteMetadata;
|
metadata: SiteMetadata;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { Option } from "option-t/esm/PlainOption";
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../../utils";
|
||||||
import { ListingType, SearchType, SortType } from "../others";
|
import { ListingType, SearchType, SortType } from "../others";
|
||||||
import {
|
import {
|
||||||
CommentView,
|
CommentView,
|
||||||
|
@ -27,23 +29,74 @@ import {
|
||||||
/**
|
/**
|
||||||
* Search lemmy for different types of data.
|
* Search lemmy for different types of data.
|
||||||
*/
|
*/
|
||||||
export interface Search {
|
export class Search {
|
||||||
/**
|
/**
|
||||||
* The search query string.
|
* The search query string.
|
||||||
*/
|
*/
|
||||||
q: string;
|
q: string;
|
||||||
type_?: SearchType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
community_id?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
community_name?: string;
|
@Expose()
|
||||||
creator_id?: number;
|
type_: Option<SearchType>;
|
||||||
sort?: SortType;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
listing_type?: ListingType;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
community_id: Option<number>;
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
creator_id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
sort: Option<SortType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
listing_type: Option<ListingType>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
q: string,
|
||||||
|
type_: Option<SearchType>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
community_name: Option<string>,
|
||||||
|
creator_id: Option<number>,
|
||||||
|
sort: Option<SortType>,
|
||||||
|
listing_type: Option<ListingType>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.q = q;
|
||||||
|
this.type_ = type_;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.community_name = community_name;
|
||||||
|
this.creator_id = creator_id;
|
||||||
|
this.sort = sort;
|
||||||
|
this.listing_type = listing_type;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchResponse {
|
export class SearchResponse {
|
||||||
/**
|
/**
|
||||||
* The [[SearchType]].
|
* The [[SearchType]].
|
||||||
*/
|
*/
|
||||||
|
@ -54,15 +107,44 @@ export interface SearchResponse {
|
||||||
users: PersonViewSafe[];
|
users: PersonViewSafe[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetModlog {
|
export class GetModlog {
|
||||||
mod_person_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
community_id?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
page?: number;
|
@Expose()
|
||||||
limit?: number;
|
mod_person_id: Option<number>;
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
mod_person_id: Option<number>,
|
||||||
|
community_id: Option<number>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
auth: Option<string>
|
||||||
|
) {
|
||||||
|
this.mod_person_id = mod_person_id;
|
||||||
|
this.community_id = community_id;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetModlogResponse {
|
export class GetModlogResponse {
|
||||||
removed_posts: ModRemovePostView[];
|
removed_posts: ModRemovePostView[];
|
||||||
locked_posts: ModLockPostView[];
|
locked_posts: ModLockPostView[];
|
||||||
stickied_posts: ModStickyPostView[];
|
stickied_posts: ModStickyPostView[];
|
||||||
|
@ -75,66 +157,246 @@ export interface GetModlogResponse {
|
||||||
added: ModAddView[];
|
added: ModAddView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateSite {
|
export class CreateSite {
|
||||||
name: string;
|
name: string;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
description?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
icon?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
banner?: string;
|
@Expose()
|
||||||
enable_downvotes?: boolean;
|
description: Option<string>;
|
||||||
open_registration?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
enable_nsfw?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
community_creation_admin_only?: boolean;
|
@Expose()
|
||||||
require_email_verification?: boolean;
|
icon: Option<string>;
|
||||||
require_application?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
application_question?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
private_instance?: boolean;
|
@Expose()
|
||||||
default_theme?: string;
|
banner: Option<string>;
|
||||||
default_post_listing_type?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
enable_downvotes: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
open_registration: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
enable_nsfw: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_creation_admin_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
require_email_verification: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
require_application: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
application_question: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
private_instance: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
default_theme: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
default_post_listing_type: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
name: string,
|
||||||
|
sidebar: Option<string>,
|
||||||
|
description: Option<string>,
|
||||||
|
icon: Option<string>,
|
||||||
|
banner: Option<string>,
|
||||||
|
enable_downvotes: Option<boolean>,
|
||||||
|
open_registration: Option<boolean>,
|
||||||
|
enable_nsfw: Option<boolean>,
|
||||||
|
community_creation_admin_only: Option<boolean>,
|
||||||
|
require_email_verification: Option<boolean>,
|
||||||
|
require_application: Option<boolean>,
|
||||||
|
application_question: Option<string>,
|
||||||
|
private_instance: Option<boolean>,
|
||||||
|
default_theme: Option<string>,
|
||||||
|
default_post_listing_type: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.name = name;
|
||||||
|
this.sidebar = sidebar;
|
||||||
|
this.description = description;
|
||||||
|
this.icon = icon;
|
||||||
|
this.banner = banner;
|
||||||
|
this.enable_downvotes = enable_downvotes;
|
||||||
|
this.open_registration = open_registration;
|
||||||
|
this.enable_nsfw = enable_nsfw;
|
||||||
|
this.community_creation_admin_only = community_creation_admin_only;
|
||||||
|
this.require_email_verification = require_email_verification;
|
||||||
|
this.require_application = require_application;
|
||||||
|
this.application_question = application_question;
|
||||||
|
this.private_instance = private_instance;
|
||||||
|
this.default_theme = default_theme;
|
||||||
|
this.default_post_listing_type = default_post_listing_type;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditSite {
|
export class EditSite {
|
||||||
name?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
description?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
icon?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
banner?: string;
|
@Expose()
|
||||||
enable_downvotes?: boolean;
|
description: Option<string>;
|
||||||
open_registration?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
enable_nsfw?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
community_creation_admin_only?: boolean;
|
@Expose()
|
||||||
require_email_verification?: boolean;
|
icon: Option<string>;
|
||||||
require_application?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
application_question?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
private_instance?: boolean;
|
@Expose()
|
||||||
default_theme?: string;
|
banner: Option<string>;
|
||||||
legal_information?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
default_post_listing_type?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
enable_downvotes: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
open_registration: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
enable_nsfw: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community_creation_admin_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
require_email_verification: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
require_application: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
application_question: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
private_instance: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
default_theme: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
legal_information: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
default_post_listing_type: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
name: Option<string>,
|
||||||
|
sidebar: Option<string>,
|
||||||
|
description: Option<string>,
|
||||||
|
icon: Option<string>,
|
||||||
|
banner: Option<string>,
|
||||||
|
enable_downvotes: Option<boolean>,
|
||||||
|
open_registration: Option<boolean>,
|
||||||
|
enable_nsfw: Option<boolean>,
|
||||||
|
community_creation_admin_only: Option<boolean>,
|
||||||
|
require_email_verification: Option<boolean>,
|
||||||
|
require_application: Option<boolean>,
|
||||||
|
application_question: Option<string>,
|
||||||
|
private_instance: Option<boolean>,
|
||||||
|
default_theme: Option<string>,
|
||||||
|
legal_information: Option<string>,
|
||||||
|
default_post_listing_type: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.name = name;
|
||||||
|
this.sidebar = sidebar;
|
||||||
|
this.description = description;
|
||||||
|
this.icon = icon;
|
||||||
|
this.banner = banner;
|
||||||
|
this.enable_downvotes = enable_downvotes;
|
||||||
|
this.open_registration = open_registration;
|
||||||
|
this.enable_nsfw = enable_nsfw;
|
||||||
|
this.community_creation_admin_only = community_creation_admin_only;
|
||||||
|
this.require_email_verification = require_email_verification;
|
||||||
|
this.require_application = require_application;
|
||||||
|
this.application_question = application_question;
|
||||||
|
this.private_instance = private_instance;
|
||||||
|
this.default_theme = default_theme;
|
||||||
|
this.legal_information = legal_information;
|
||||||
|
this.default_post_listing_type = default_post_listing_type;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSite {
|
export class GetSite {
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(auth: Option<string>) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SiteResponse {
|
export class SiteResponse {
|
||||||
site_view: SiteView;
|
site_view: SiteView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSiteResponse {
|
export class GetSiteResponse {
|
||||||
/**
|
/**
|
||||||
* Optional, because the site might not be set up yet.
|
* Optional, because the site might not be set up yet.
|
||||||
*/
|
*/
|
||||||
site_view?: SiteView;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
site_view: Option<SiteView>;
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
my_user?: MyUserInfo;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
federated_instances?: FederatedInstances;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_user: Option<MyUserInfo>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
federated_instances: Option<FederatedInstances>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,70 +410,149 @@ export interface MyUserInfo {
|
||||||
person_blocks: PersonBlockView[];
|
person_blocks: PersonBlockView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LeaveAdmin {
|
export class LeaveAdmin {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSiteConfig {
|
export class GetSiteConfig {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetSiteConfigResponse {
|
export class GetSiteConfigResponse {
|
||||||
config_hjson: string;
|
config_hjson: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SaveSiteConfig {
|
export class SaveSiteConfig {
|
||||||
config_hjson: string;
|
config_hjson: string;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(config_hjson: string, auth: string) {
|
||||||
|
this.config_hjson = config_hjson;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FederatedInstances {
|
export class FederatedInstances {
|
||||||
linked: string[];
|
linked: string[];
|
||||||
allowed?: string[];
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
blocked?: string[];
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
allowed: Option<string[]>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
blocked: Option<string[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolveObject {
|
export class ResolveObject {
|
||||||
q: string;
|
q: string;
|
||||||
auth?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
auth: Option<string>;
|
||||||
|
|
||||||
|
constructor(q: string, auth: Option<string>) {
|
||||||
|
this.q = q;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResolveObjectResponse {
|
export class ResolveObjectResponse {
|
||||||
comment?: CommentView;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
post?: PostView;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
community?: CommunityView;
|
@Expose()
|
||||||
person?: PersonViewSafe;
|
comment: Option<CommentView>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
post: Option<PostView>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
community: Option<CommunityView>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
person: Option<PersonViewSafe>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListRegistrationApplications {
|
export class ListRegistrationApplications {
|
||||||
/**
|
/**
|
||||||
* Only shows the unread applications (IE those without an admin actor)
|
* Only shows the unread applications (IE those without an admin actor)
|
||||||
*/
|
*/
|
||||||
unread_only?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
page?: number;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
limit?: number;
|
@Expose()
|
||||||
|
unread_only: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
page: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
limit: Option<number>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
unread_only: Option<boolean>,
|
||||||
|
page: Option<number>,
|
||||||
|
limit: Option<number>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.unread_only = unread_only;
|
||||||
|
this.page = page;
|
||||||
|
this.limit = limit;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListRegistrationApplicationsResponse {
|
export class ListRegistrationApplicationsResponse {
|
||||||
registration_applications: RegistrationApplicationView[];
|
registration_applications: RegistrationApplicationView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApproveRegistrationApplication {
|
export class ApproveRegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
approve: boolean;
|
approve: boolean;
|
||||||
deny_reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
deny_reason: Option<string>;
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
id: number,
|
||||||
|
approve: boolean,
|
||||||
|
deny_reason: Option<string>,
|
||||||
|
auth: string
|
||||||
|
) {
|
||||||
|
this.id = id;
|
||||||
|
this.approve = approve;
|
||||||
|
this.deny_reason = deny_reason;
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegistrationApplicationResponse {
|
export class RegistrationApplicationResponse {
|
||||||
registration_application: RegistrationApplicationView;
|
registration_application: RegistrationApplicationView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetUnreadRegistrationApplicationCount {
|
export class GetUnreadRegistrationApplicationCount {
|
||||||
auth: string;
|
auth: string;
|
||||||
|
|
||||||
|
constructor(auth: string) {
|
||||||
|
this.auth = auth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetUnreadRegistrationApplicationCountResponse {
|
export class GetUnreadRegistrationApplicationCountResponse {
|
||||||
registration_applications: number;
|
registration_applications: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../utils";
|
||||||
export const VERSION = "v3";
|
export const VERSION = "v3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,48 +151,24 @@ export enum SearchType {
|
||||||
Url = "Url",
|
Url = "Url",
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A websocket response. Includes the return type.
|
|
||||||
* Can be used like:
|
|
||||||
*
|
|
||||||
* ```ts
|
|
||||||
* if (op == UserOperation.Search) {
|
|
||||||
* let data = wsJsonToRes<SearchResponse>(msg).data;
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export interface WebSocketResponse<ResponseType> {
|
|
||||||
op: UserOperation;
|
|
||||||
/**
|
|
||||||
* This contains the data for a websocket response.
|
|
||||||
*
|
|
||||||
* The correct response type if given is in [[LemmyHttp]].
|
|
||||||
*/
|
|
||||||
data: ResponseType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A websocket JSON response that includes the errors.
|
|
||||||
*/
|
|
||||||
export interface WebSocketJsonResponse<ResponseType> {
|
|
||||||
op?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This contains the data for a websocket response.
|
|
||||||
*
|
|
||||||
* The correct response type if given is in [[LemmyHttp]].
|
|
||||||
*/
|
|
||||||
data?: ResponseType;
|
|
||||||
error?: string;
|
|
||||||
reconnect?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 interface SiteMetadata {
|
export class SiteMetadata {
|
||||||
title?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
description?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
image?: string;
|
@Expose()
|
||||||
html?: string;
|
title: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
description: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
image: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
html: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
import { Option } from "option-t/esm/PlainOption";
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../utils";
|
||||||
|
|
||||||
export interface LocalUserSettings {
|
export class LocalUserSettings {
|
||||||
id: number;
|
id: number;
|
||||||
person_id: number;
|
person_id: number;
|
||||||
email?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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;
|
||||||
|
@ -19,43 +24,82 @@ export interface LocalUserSettings {
|
||||||
accepted_application: boolean;
|
accepted_application: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonSafe {
|
export class PersonSafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
display_name?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
avatar?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
display_name: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
avatar: Option<string>;
|
||||||
banned: boolean;
|
banned: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
actor_id: string;
|
actor_id: string;
|
||||||
bio?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
bio: Option<string>;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
banner?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
shared_inbox_url: string;
|
shared_inbox_url: string;
|
||||||
matrix_user_id?: string;
|
@Transform(({ value }) => Some(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;
|
||||||
ban_expires?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
ban_expires: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Site {
|
export class Site {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
sidebar: Option<string>;
|
sidebar: Option<string>;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
enable_downvotes: boolean;
|
enable_downvotes: boolean;
|
||||||
open_registration: boolean;
|
open_registration: boolean;
|
||||||
enable_nsfw: boolean;
|
enable_nsfw: boolean;
|
||||||
icon?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
banner?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
description?: string;
|
@Expose()
|
||||||
|
icon: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
description: Option<string>;
|
||||||
community_creation_admin_only: boolean;
|
community_creation_admin_only: boolean;
|
||||||
require_email_verification: boolean;
|
require_email_verification: boolean;
|
||||||
require_application: boolean;
|
require_application: boolean;
|
||||||
application_question?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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;
|
||||||
|
@ -63,10 +107,13 @@ export interface Site {
|
||||||
last_refreshed_at: string;
|
last_refreshed_at: string;
|
||||||
inbox_url: string;
|
inbox_url: string;
|
||||||
public_key: string;
|
public_key: string;
|
||||||
legal_information?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
legal_information: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrivateMessage {
|
export class PrivateMessage {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
|
@ -74,190 +121,304 @@ export interface PrivateMessage {
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostReport {
|
export class 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;
|
||||||
original_post_url?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
original_post_body?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
original_post_url: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
original_post_body: Option<string>;
|
||||||
reason: string;
|
reason: string;
|
||||||
resolved: boolean;
|
resolved: boolean;
|
||||||
resolver_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
resolver_id: Option<number>;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Post {
|
export class Post {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
url?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
body?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
url: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(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;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
nsfw: boolean;
|
nsfw: boolean;
|
||||||
stickied: boolean;
|
stickied: boolean;
|
||||||
embed_title?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
embed_description?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
embed_html?: string;
|
@Expose()
|
||||||
thumbnail_url?: string;
|
embed_title: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
embed_description: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
embed_html: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
thumbnail_url: Option<string>;
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PasswordResetRequest {
|
export class PasswordResetRequest {
|
||||||
id: number;
|
id: number;
|
||||||
local_user_id: number;
|
local_user_id: number;
|
||||||
token_encrypted: string;
|
token_encrypted: string;
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemovePost {
|
export class ModRemovePost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
removed?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModLockPost {
|
export class ModLockPost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
locked?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
locked: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModStickyPost {
|
export class ModStickyPost {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
stickied?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
stickied: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemoveComment {
|
export class ModRemoveComment {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
removed?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemoveCommunity {
|
export class ModRemoveCommunity {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
community_id: number;
|
community_id: number;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
removed?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
expires?: string;
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<string>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModBanFromCommunity {
|
export class 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;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
banned?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
expires?: string;
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banned: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<string>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModBan {
|
export class ModBan {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
reason?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
banned?: boolean;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
expires?: string;
|
@Expose()
|
||||||
|
reason: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banned: Option<boolean>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
expires: Option<string>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModAddCommunity {
|
export class 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;
|
||||||
removed?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModTransferCommunity {
|
export class 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;
|
||||||
removed?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModAdd {
|
export class ModAdd {
|
||||||
id: number;
|
id: number;
|
||||||
mod_person_id: number;
|
mod_person_id: number;
|
||||||
other_person_id: number;
|
other_person_id: number;
|
||||||
removed?: boolean;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
removed: Option<boolean>;
|
||||||
when_: string;
|
when_: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunitySafe {
|
export class CommunitySafe {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
description: Option<string>;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@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;
|
||||||
icon?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
banner?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
icon: Option<string>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
banner: Option<string>;
|
||||||
posting_restricted_to_mods: boolean;
|
posting_restricted_to_mods: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentReport {
|
export class 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;
|
||||||
resolver_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
resolver_id: Option<number>;
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Comment {
|
export class Comment {
|
||||||
id: number;
|
id: number;
|
||||||
creator_id: number;
|
creator_id: number;
|
||||||
post_id: number;
|
post_id: number;
|
||||||
parent_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
parent_id: Option<number>;
|
||||||
content: string;
|
content: string;
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
read: boolean; // Whether the recipient has read the comment or not
|
read: boolean; // Whether the recipient has read the comment or not
|
||||||
published: string;
|
published: string;
|
||||||
updated?: string;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
updated: Option<string>;
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
ap_id: string;
|
ap_id: string;
|
||||||
local: boolean;
|
local: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMention {
|
export class PersonMention {
|
||||||
id: number;
|
id: number;
|
||||||
recipient_id: number;
|
recipient_id: number;
|
||||||
comment_id: number;
|
comment_id: number;
|
||||||
|
@ -265,11 +426,17 @@ export interface PersonMention {
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegistrationApplication {
|
export class RegistrationApplication {
|
||||||
id: number;
|
id: number;
|
||||||
local_user_id: number;
|
local_user_id: number;
|
||||||
answer: string;
|
answer: string;
|
||||||
admin_id?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
deny_reason?: string;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
admin_id: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
deny_reason: Option<string>;
|
||||||
published: string;
|
published: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import { Option, Some } from "@sniptt/monads";
|
||||||
|
import { Expose, Transform } from "class-transformer";
|
||||||
|
import { toUndefined } from "../utils";
|
||||||
import {
|
import {
|
||||||
CommentAggregates,
|
CommentAggregates,
|
||||||
CommunityAggregates,
|
CommunityAggregates,
|
||||||
|
@ -29,12 +32,12 @@ import {
|
||||||
Site,
|
Site,
|
||||||
} from "./source";
|
} from "./source";
|
||||||
|
|
||||||
export interface PersonViewSafe {
|
export class PersonViewSafe {
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
counts: PersonAggregates;
|
counts: PersonAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonMentionView {
|
export class PersonMentionView {
|
||||||
person_mention: PersonMention;
|
person_mention: PersonMention;
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
|
@ -46,27 +49,30 @@ export interface PersonMentionView {
|
||||||
subscribed: boolean;
|
subscribed: boolean;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
my_vote?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_vote: Option<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LocalUserSettingsView {
|
export class LocalUserSettingsView {
|
||||||
local_user: LocalUserSettings;
|
local_user: LocalUserSettings;
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
counts: PersonAggregates;
|
counts: PersonAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SiteView {
|
export class SiteView {
|
||||||
site: Site;
|
site: Site;
|
||||||
counts: SiteAggregates;
|
counts: SiteAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PrivateMessageView {
|
export class PrivateMessageView {
|
||||||
private_message: PrivateMessage;
|
private_message: PrivateMessage;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
recipient: PersonSafe;
|
recipient: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostView {
|
export class PostView {
|
||||||
post: Post;
|
post: Post;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
|
@ -76,25 +82,37 @@ export interface PostView {
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
read: boolean;
|
read: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
my_vote?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_vote: Option<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostReportView {
|
export class PostReportView {
|
||||||
post_report: PostReport;
|
post_report: PostReport;
|
||||||
post: Post;
|
post: Post;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
post_creator: PersonSafe;
|
post_creator: PersonSafe;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
my_vote?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_vote: Option<number>;
|
||||||
counts: PostAggregates;
|
counts: PostAggregates;
|
||||||
resolver?: PersonSafe;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
resolver: Option<PersonSafe>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentView {
|
export class CommentView {
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
recipient?: PersonSafe;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
recipient: Option<PersonSafe>;
|
||||||
post: Post;
|
post: Post;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
|
@ -102,10 +120,13 @@ export interface CommentView {
|
||||||
subscribed: boolean;
|
subscribed: boolean;
|
||||||
saved: boolean;
|
saved: boolean;
|
||||||
creator_blocked: boolean;
|
creator_blocked: boolean;
|
||||||
my_vote?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_vote: Option<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommentReportView {
|
export class CommentReportView {
|
||||||
comment_report: CommentReport;
|
comment_report: CommentReport;
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
post: Post;
|
post: Post;
|
||||||
|
@ -114,51 +135,57 @@ export interface CommentReportView {
|
||||||
comment_creator: PersonSafe;
|
comment_creator: PersonSafe;
|
||||||
counts: CommentAggregates;
|
counts: CommentAggregates;
|
||||||
creator_banned_from_community: boolean;
|
creator_banned_from_community: boolean;
|
||||||
my_vote?: number;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
resolver?: PersonSafe;
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
my_vote: Option<number>;
|
||||||
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
resolver: Option<PersonSafe>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModAddCommunityView {
|
export class ModAddCommunityView {
|
||||||
mod_add_community: ModAddCommunity;
|
mod_add_community: ModAddCommunity;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModTransferCommunityView {
|
export class ModTransferCommunityView {
|
||||||
mod_transfer_community: ModTransferCommunity;
|
mod_transfer_community: ModTransferCommunity;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModAddView {
|
export class ModAddView {
|
||||||
mod_add: ModAdd;
|
mod_add: ModAdd;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
modded_person: PersonSafe;
|
modded_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModBanFromCommunityView {
|
export class ModBanFromCommunityView {
|
||||||
mod_ban_from_community: ModBanFromCommunity;
|
mod_ban_from_community: ModBanFromCommunity;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
banned_person: PersonSafe;
|
banned_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModBanView {
|
export class ModBanView {
|
||||||
mod_ban: ModBan;
|
mod_ban: ModBan;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
banned_person: PersonSafe;
|
banned_person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModLockPostView {
|
export class ModLockPostView {
|
||||||
mod_lock_post: ModLockPost;
|
mod_lock_post: ModLockPost;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
post: Post;
|
post: Post;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemoveCommentView {
|
export class ModRemoveCommentView {
|
||||||
mod_remove_comment: ModRemoveComment;
|
mod_remove_comment: ModRemoveComment;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
|
@ -167,61 +194,64 @@ export interface ModRemoveCommentView {
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemoveCommunityView {
|
export class ModRemoveCommunityView {
|
||||||
mod_remove_community: ModRemoveCommunity;
|
mod_remove_community: ModRemoveCommunity;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModRemovePostView {
|
export class ModRemovePostView {
|
||||||
mod_remove_post: ModRemovePost;
|
mod_remove_post: ModRemovePost;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
post: Post;
|
post: Post;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModStickyPostView {
|
export class ModStickyPostView {
|
||||||
mod_sticky_post: ModStickyPost;
|
mod_sticky_post: ModStickyPost;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
post: Post;
|
post: Post;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityFollowerView {
|
export class CommunityFollowerView {
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
follower: PersonSafe;
|
follower: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityBlockView {
|
export class CommunityBlockView {
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityModeratorView {
|
export class CommunityModeratorView {
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
moderator: PersonSafe;
|
moderator: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityPersonBanView {
|
export class CommunityPersonBanView {
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PersonBlockView {
|
export class PersonBlockView {
|
||||||
person: PersonSafe;
|
person: PersonSafe;
|
||||||
target: PersonSafe;
|
target: PersonSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommunityView {
|
export class CommunityView {
|
||||||
community: CommunitySafe;
|
community: CommunitySafe;
|
||||||
subscribed: boolean;
|
subscribed: boolean;
|
||||||
blocked: boolean;
|
blocked: boolean;
|
||||||
counts: CommunityAggregates;
|
counts: CommunityAggregates;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegistrationApplicationView {
|
export class RegistrationApplicationView {
|
||||||
registration_application: RegistrationApplication;
|
registration_application: RegistrationApplication;
|
||||||
creator_local_user: LocalUserSettings;
|
creator_local_user: LocalUserSettings;
|
||||||
creator: PersonSafe;
|
creator: PersonSafe;
|
||||||
admin?: PersonSafe;
|
@Transform(({ value }) => Some(value), { toClassOnly: true })
|
||||||
|
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||||
|
@Expose()
|
||||||
|
admin: Option<PersonSafe>;
|
||||||
}
|
}
|
||||||
|
|
8
src/utils.ts
Normal file
8
src/utils.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { Option } 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;
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { ClassConstructor, deserialize, serialize } from "class-transformer";
|
||||||
import {
|
import {
|
||||||
CreateComment,
|
CreateComment,
|
||||||
CreateCommentLike,
|
CreateCommentLike,
|
||||||
|
@ -499,7 +500,7 @@ export class LemmyWebsocket {
|
||||||
/**
|
/**
|
||||||
* Gets the site, and your user data.
|
* Gets the site, and your user data.
|
||||||
*/
|
*/
|
||||||
getSite(form: GetSite = {}) {
|
getSite(form: GetSite) {
|
||||||
return wrapper(UserOperation.GetSite, form);
|
return wrapper(UserOperation.GetSite, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +646,38 @@ export class LemmyWebsocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
function wrapper<MessageType>(op: UserOperation, data: MessageType) {
|
||||||
let send = { op: UserOperation[op], data: data };
|
let send = { op: UserOperation[op], data: serialize(data) };
|
||||||
console.log(send);
|
console.log(send);
|
||||||
return JSON.stringify(send);
|
return JSON.stringify(send);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A websocket JSON response that includes the errors.
|
||||||
|
*/
|
||||||
|
// interface WebSocketJsonResponse {
|
||||||
|
// op?: string;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * This contains the data for a websocket response.
|
||||||
|
// *
|
||||||
|
// * The correct response type if given is in [[LemmyHttp]].
|
||||||
|
// */
|
||||||
|
// data?: ResponseType;
|
||||||
|
// error?: string;
|
||||||
|
// reconnect?: boolean;
|
||||||
|
// }
|
||||||
|
|
||||||
|
export function wsUserOp(msg: any): UserOperation {
|
||||||
|
let opStr: string = msg.op;
|
||||||
|
return UserOperation[opStr as keyof typeof UserOperation];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a websocket string response to a usable result
|
||||||
|
*/
|
||||||
|
export function wsJsonToRes<ResponseType>(
|
||||||
|
msg: any,
|
||||||
|
responseClass: ClassConstructor<ResponseType>
|
||||||
|
): ResponseType {
|
||||||
|
return deserialize(responseClass, msg.data);
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
"lib": ["es2017", "es7", "es6", "dom"],
|
"lib": ["es2017", "es7", "es6", "dom"],
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"target": "ES5",
|
"target": "ES5",
|
||||||
|
"experimentalDecorators": true,
|
||||||
"moduleResolution": "Node"
|
"moduleResolution": "Node"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|
15
yarn.lock
15
yarn.lock
|
@ -251,6 +251,11 @@
|
||||||
"@nodelib/fs.scandir" "2.1.4"
|
"@nodelib/fs.scandir" "2.1.4"
|
||||||
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"
|
||||||
|
@ -539,6 +544,11 @@ 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"
|
||||||
|
@ -1583,11 +1593,6 @@ onigasm@^2.2.5:
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache "^5.1.1"
|
lru-cache "^5.1.1"
|
||||||
|
|
||||||
option-t@^32.2.0:
|
|
||||||
version "32.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/option-t/-/option-t-32.2.0.tgz#9f24f5f36a1237a1302c37c7fef4489f4333eeb2"
|
|
||||||
integrity sha512-dff/0MN6ckHoKVeGNNFYGyWunwFAvKI9FqKDIJlzh7gZ0EZD0hVflTWs7DzznsTPVhV6F+TSSaSIe3bzWi0Z7Q==
|
|
||||||
|
|
||||||
optionator@^0.9.1:
|
optionator@^0.9.1:
|
||||||
version "0.9.1"
|
version "0.9.1"
|
||||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
|
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
|
||||||
|
|
Loading…
Reference in a new issue