mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-12-22 19:01:27 +00:00
Move settings to database (#79)
* Adding site settings to DB. * v0.17.0-rc.47 * Forgot some fields * v0.17.0-rc.48 * Fixing some missing fields. * v0.17.0-rc.49 * Fixing some missing fields. * v0.17.0-rc.50 * Fixing some missing fields 3. * v0.17.0-rc.51
This commit is contained in:
parent
00189a6462
commit
ad5be5ce3a
4 changed files with 271 additions and 20 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "lemmy-js-client",
|
||||
"description": "A javascript / typescript client for Lemmy",
|
||||
"version": "0.17.0-rc.46",
|
||||
"version": "0.17.0-rc.51",
|
||||
"author": "Dessalines <tyhou13@gmx.com>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "./dist/index.js",
|
||||
|
|
|
@ -221,8 +221,111 @@ export class CreateSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
application_email_admins: Option<boolean>;
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
auth: string;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
discussion_languages: Option<number[]>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
legal_information: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
slur_filter_regex: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
actor_name_max_length: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_message: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_message_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_post: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_post_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_register: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_register_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_image: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_image_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_comment: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_comment_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_search: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_search_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_enabled: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_debug: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_strict_allowlist: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_http_fetch_retry_limit: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_worker_count: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
captcha_enabled: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
captcha_difficulty: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
allowed_instances: Option<string[]>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
blocked_instances: Option<string[]>;
|
||||
constructor(init: CreateSite) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
|
@ -288,11 +391,11 @@ export class EditSite {
|
|||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
legal_information: Option<string>;
|
||||
default_post_listing_type: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
default_post_listing_type: Option<string>;
|
||||
legal_information: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
|
@ -301,6 +404,102 @@ export class EditSite {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
discussion_languages: Option<number[]>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
slur_filter_regex: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
actor_name_max_length: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_message: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_message_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_post: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_post_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_register: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_register_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_image: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_image_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_comment: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_comment_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_search: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
rate_limit_search_per_second: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_enabled: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_debug: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_strict_allowlist: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_http_fetch_retry_limit: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
federation_worker_count: Option<number>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
captcha_enabled: Option<boolean>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
captcha_difficulty: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
allowed_instances: Option<string[]>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
blocked_instances: Option<string[]>;
|
||||
auth: string;
|
||||
|
||||
constructor(init: EditSite) {
|
||||
|
@ -325,14 +524,8 @@ export class SiteResponse {
|
|||
}
|
||||
|
||||
export class GetSiteResponse {
|
||||
/**
|
||||
* Optional, because the site might not be set up yet.
|
||||
*/
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
@Type(() => SiteView)
|
||||
site_view: Option<SiteView>;
|
||||
site_view: SiteView;
|
||||
@Type(() => PersonViewSafe)
|
||||
admins: PersonViewSafe[];
|
||||
online: number;
|
||||
|
@ -352,6 +545,7 @@ export class GetSiteResponse {
|
|||
federated_instances: Option<FederatedInstances>;
|
||||
@Type(() => Language)
|
||||
all_languages: Language[];
|
||||
discussion_languages: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ export class LocalUserSettings {
|
|||
interface_language: string;
|
||||
show_avatars: boolean;
|
||||
send_notifications_to_email: boolean;
|
||||
validator_time: string;
|
||||
show_bot_accounts: boolean;
|
||||
show_scores: boolean;
|
||||
show_read_posts: boolean;
|
||||
|
@ -53,7 +54,10 @@ export class PersonSafe {
|
|||
banner: Option<string>;
|
||||
deleted: boolean;
|
||||
inbox_url: string;
|
||||
shared_inbox_url: string;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
shared_inbox_url: Option<string>;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
|
@ -64,6 +68,7 @@ export class PersonSafe {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
ban_expires: Option<string>;
|
||||
instance_id: number;
|
||||
}
|
||||
|
||||
export class Site {
|
||||
|
@ -78,9 +83,6 @@ export class Site {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
updated: Option<string>;
|
||||
enable_downvotes: boolean;
|
||||
open_registration: boolean;
|
||||
enable_nsfw: boolean;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
|
@ -93,6 +95,21 @@ export class Site {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
description: Option<string>;
|
||||
actor_id: string;
|
||||
last_refreshed_at: string;
|
||||
inbox_url: string;
|
||||
private_key: Option<string>;
|
||||
public_key: string;
|
||||
instance_id: number;
|
||||
}
|
||||
|
||||
export class LocalSite {
|
||||
id: number;
|
||||
site_id: number;
|
||||
site_setup: boolean;
|
||||
enable_downvotes: boolean;
|
||||
open_registration: boolean;
|
||||
enable_nsfw: boolean;
|
||||
community_creation_admin_only: boolean;
|
||||
require_email_verification: boolean;
|
||||
require_application: boolean;
|
||||
|
@ -103,19 +120,51 @@ export class Site {
|
|||
private_instance: boolean;
|
||||
default_theme: string;
|
||||
default_post_listing_type: string;
|
||||
actor_id: string;
|
||||
last_refreshed_at: string;
|
||||
inbox_url: string;
|
||||
public_key: string;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
legal_information: Option<string>;
|
||||
hide_modlog_mod_names: boolean;
|
||||
application_email_admins: boolean;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
hide_modlog_mod_names: Option<boolean>;
|
||||
slur_filter_regex: Option<string>;
|
||||
actor_name_max_length: number;
|
||||
federation_enabled: boolean;
|
||||
federation_debug: boolean;
|
||||
federation_strict_allowlist: boolean;
|
||||
federation_http_fetch_retry_limit: number;
|
||||
federation_worker_count: number;
|
||||
captcha_enabled: boolean;
|
||||
captcha_difficulty: string;
|
||||
published: string;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
updated: Option<string>;
|
||||
}
|
||||
|
||||
export class LocalSiteRateLimit {
|
||||
id: number;
|
||||
local_site_id: number;
|
||||
message: number;
|
||||
message_per_second: number;
|
||||
post: number;
|
||||
post_per_second: number;
|
||||
register: number;
|
||||
register_per_second: number;
|
||||
image: number;
|
||||
image_per_second: number;
|
||||
comment: number;
|
||||
comment_per_second: number;
|
||||
search: number;
|
||||
search_per_second: number;
|
||||
published: string;
|
||||
@Transform(({ value }) => toOption(value), { toClassOnly: true })
|
||||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
updated: Option<string>;
|
||||
}
|
||||
|
||||
export class PrivateMessage {
|
||||
|
@ -424,7 +473,9 @@ export class CommunitySafe {
|
|||
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
|
||||
@Expose()
|
||||
banner: Option<string>;
|
||||
hidden: boolean;
|
||||
posting_restricted_to_mods: boolean;
|
||||
instance_id: number;
|
||||
}
|
||||
|
||||
export class CommentReport {
|
||||
|
|
|
@ -19,6 +19,8 @@ import {
|
|||
CommentReply,
|
||||
CommentReport,
|
||||
CommunitySafe,
|
||||
LocalSite,
|
||||
LocalSiteRateLimit,
|
||||
LocalUserSettings,
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
|
@ -81,6 +83,10 @@ export class LocalUserSettingsView {
|
|||
export class SiteView {
|
||||
@Type(() => Site)
|
||||
site: Site;
|
||||
@Type(() => LocalSite)
|
||||
local_site: LocalSite;
|
||||
@Type(() => LocalSiteRateLimit)
|
||||
local_site_rate_limit: LocalSiteRateLimit;
|
||||
counts: SiteAggregates;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue