mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-12-04 18:21:12 +00:00
Merge branch 'main' into person_post_unread_comments
This commit is contained in:
commit
a9af07e8c8
8 changed files with 145 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "lemmy-js-client",
|
||||
"description": "A javascript / typescript client for Lemmy",
|
||||
"version": "0.17.0-rc.42",
|
||||
"version": "0.17.0-rc.44",
|
||||
"author": "Dessalines <tyhou13@gmx.com>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "./dist/index.js",
|
||||
|
|
|
@ -11,6 +11,10 @@ export class CreateComment {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
parent_id: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
language_id: Option<number>;
|
||||
post_id: number;
|
||||
/**
|
||||
* An optional front end ID, to tell which is comment is coming back.
|
||||
|
@ -27,8 +31,22 @@ export class CreateComment {
|
|||
}
|
||||
|
||||
export class EditComment {
|
||||
content: string;
|
||||
comment_id: number;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
content: Option<string>;
|
||||
/**
|
||||
* "Distinguishes" a comment, or speak officially. Only doable by community mods or admins.
|
||||
*/
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
distinguished: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
language_id: Option<number>;
|
||||
/**
|
||||
* An optional front end ID, to tell which is comment is coming back.
|
||||
*/
|
||||
|
|
|
@ -136,7 +136,7 @@ export class SaveUserSettings {
|
|||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
lang: Option<string>;
|
||||
interface_language: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
|
@ -189,6 +189,10 @@ export class SaveUserSettings {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
show_new_post_notifs: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
discussion_languages: Option<number[]>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: SaveUserSettings) {
|
||||
|
|
|
@ -24,6 +24,10 @@ export class CreatePost {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
nsfw: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
language_id: Option<number>;
|
||||
community_id: number;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
|
@ -149,6 +153,10 @@ export class EditPost {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
nsfw: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
language_id: Option<number>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: EditPost) {
|
||||
|
|
|
@ -2,7 +2,8 @@ import { Option } from "@sniptt/monads";
|
|||
import { Expose, Transform, Type } from "class-transformer";
|
||||
import "reflect-metadata";
|
||||
import { toOption, toUndefined } from "../../utils";
|
||||
import { ListingType, SearchType, SortType } from "../others";
|
||||
import { ListingType, ModlogActionType, SearchType, SortType } from "../others";
|
||||
import { Language } from "../source";
|
||||
import {
|
||||
AdminPurgeCommentView,
|
||||
AdminPurgeCommunityView,
|
||||
|
@ -117,7 +118,11 @@ export class GetModlog {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
auth: Option<string>;
|
||||
|
||||
type_: ModlogActionType;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
other_person_id: Option<number>;
|
||||
constructor(init: GetModlog) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
@ -212,8 +217,11 @@ export class CreateSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
default_post_listing_type: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: CreateSite) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
@ -284,6 +292,10 @@ export class EditSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
default_post_listing_type: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: EditSite) {
|
||||
|
@ -333,6 +345,8 @@ export class GetSiteResponse {
|
|||
@Expose()
|
||||
@Type(() => FederatedInstances)
|
||||
federated_instances: Option<FederatedInstances>;
|
||||
@Type(() => Language)
|
||||
all_languages: Language[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,6 +363,8 @@ export class MyUserInfo {
|
|||
community_blocks: CommunityBlockView[];
|
||||
@Type(() => PersonBlockView)
|
||||
person_blocks: PersonBlockView[];
|
||||
@Type(() => Language)
|
||||
discussion_languages: Language[];
|
||||
}
|
||||
|
||||
export class LeaveAdmin {
|
||||
|
|
|
@ -182,6 +182,28 @@ export enum SearchType {
|
|||
Url = "Url",
|
||||
}
|
||||
|
||||
/**
|
||||
* Mod log action types
|
||||
*/
|
||||
export enum ModlogActionType {
|
||||
All = "All",
|
||||
ModRemovePost = "ModRemovePost",
|
||||
ModLockPost = "ModLockPost",
|
||||
ModStickyPost = "ModStickyPost",
|
||||
ModRemoveComment = "ModRemoveComment",
|
||||
ModRemoveCommunity = "ModRemoveCommunity",
|
||||
ModBanFromCommunity = "ModBanFromCommunity",
|
||||
ModAddCommunity = "ModAddCommunity",
|
||||
ModTransferCommunity = "ModTransferCommunity",
|
||||
ModAdd = "ModAdd",
|
||||
ModBan = "ModBan",
|
||||
ModHideCommunity = "ModHideCommunity",
|
||||
AdminPurgePerson = "AdminPurgePerson",
|
||||
AdminPurgeCommunity = "AdminPurgeCommunity",
|
||||
AdminPurgePost = "AdminPurgePost",
|
||||
AdminPurgeComment = "AdminPurgeComment",
|
||||
}
|
||||
|
||||
/**
|
||||
* Different Subscribed states
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@ export class LocalUserSettings {
|
|||
theme: string;
|
||||
default_sort_type: number;
|
||||
default_listing_type: number;
|
||||
lang: string;
|
||||
interface_language: string;
|
||||
show_avatars: boolean;
|
||||
send_notifications_to_email: boolean;
|
||||
show_bot_accounts: boolean;
|
||||
|
@ -111,6 +111,10 @@ export class Site {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
legal_information: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
}
|
||||
|
||||
export class PrivateMessage {
|
||||
|
@ -189,13 +193,14 @@ export class Post {
|
|||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
embed_html: Option<string>;
|
||||
embed_video_url: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
thumbnail_url: Option<string>;
|
||||
ap_id: string;
|
||||
local: boolean;
|
||||
language_id: number;
|
||||
}
|
||||
|
||||
export class PasswordResetRequest {
|
||||
|
@ -454,6 +459,8 @@ export class Comment {
|
|||
ap_id: string;
|
||||
local: boolean;
|
||||
path: string;
|
||||
distinguished: boolean;
|
||||
language_id: number;
|
||||
}
|
||||
|
||||
export class PersonMention {
|
||||
|
@ -486,3 +493,9 @@ export class RegistrationApplication {
|
|||
deny_reason: Option<string>;
|
||||
published: string;
|
||||
}
|
||||
|
||||
export class Language {
|
||||
id: number;
|
||||
code: string;
|
||||
name: string;
|
||||
}
|
||||
|
|
|
@ -209,8 +209,11 @@ export class CommentReportView {
|
|||
export class ModAddCommunityView {
|
||||
@Type(() => ModAddCommunity)
|
||||
mod_add_community: ModAddCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -220,8 +223,11 @@ export class ModAddCommunityView {
|
|||
export class ModTransferCommunityView {
|
||||
@Type(() => ModTransferCommunity)
|
||||
mod_transfer_community: ModTransferCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -231,8 +237,11 @@ export class ModTransferCommunityView {
|
|||
export class ModAddView {
|
||||
@Type(() => ModAdd)
|
||||
mod_add: ModAdd;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => PersonSafe)
|
||||
modded_person: PersonSafe;
|
||||
}
|
||||
|
@ -240,8 +249,11 @@ export class ModAddView {
|
|||
export class ModBanFromCommunityView {
|
||||
@Type(() => ModBanFromCommunity)
|
||||
mod_ban_from_community: ModBanFromCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -251,8 +263,11 @@ export class ModBanFromCommunityView {
|
|||
export class ModBanView {
|
||||
@Type(() => ModBan)
|
||||
mod_ban: ModBan;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => PersonSafe)
|
||||
banned_person: PersonSafe;
|
||||
}
|
||||
|
@ -260,8 +275,11 @@ export class ModBanView {
|
|||
export class ModLockPostView {
|
||||
@Type(() => ModLockPost)
|
||||
mod_lock_post: ModLockPost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -271,8 +289,11 @@ export class ModLockPostView {
|
|||
export class ModRemoveCommentView {
|
||||
@Type(() => ModRemoveComment)
|
||||
mod_remove_comment: ModRemoveComment;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Comment)
|
||||
comment: Comment;
|
||||
@Type(() => PersonSafe)
|
||||
|
@ -286,8 +307,11 @@ export class ModRemoveCommentView {
|
|||
export class ModRemoveCommunityView {
|
||||
@Type(() => ModRemoveCommunity)
|
||||
mod_remove_community: ModRemoveCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
}
|
||||
|
@ -295,8 +319,11 @@ export class ModRemoveCommunityView {
|
|||
export class ModRemovePostView {
|
||||
@Type(() => ModRemovePost)
|
||||
mod_remove_post: ModRemovePost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -306,8 +333,11 @@ export class ModRemovePostView {
|
|||
export class ModStickyPostView {
|
||||
@Type(() => ModStickyPost)
|
||||
mod_sticky_post: ModStickyPost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
moderator: PersonSafe;
|
||||
moderator: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
@Type(() => CommunitySafe)
|
||||
|
@ -317,22 +347,31 @@ export class ModStickyPostView {
|
|||
export class AdminPurgeCommunityView {
|
||||
@Type(() => AdminPurgeCommunity)
|
||||
admin_purge_community: AdminPurgeCommunity;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
export class AdminPurgePersonView {
|
||||
@Type(() => AdminPurgePerson)
|
||||
admin_purge_person: AdminPurgePerson;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
}
|
||||
|
||||
export class AdminPurgePostView {
|
||||
@Type(() => AdminPurgePost)
|
||||
admin_purge_post: AdminPurgePost;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
@Type(() => CommunitySafe)
|
||||
community: CommunitySafe;
|
||||
}
|
||||
|
@ -340,8 +379,11 @@ export class AdminPurgePostView {
|
|||
export class AdminPurgeCommentView {
|
||||
@Type(() => AdminPurgeComment)
|
||||
admin_purge_comment: AdminPurgeComment;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => PersonSafe)
|
||||
admin: PersonSafe;
|
||||
admin: Option<PersonSafe>;
|
||||
@Type(() => Post)
|
||||
post: Post;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue