Using init constructors.

This commit is contained in:
Dessalines 2022-06-13 22:54:20 -04:00
parent 13a16764af
commit 736dac1462
7 changed files with 159 additions and 615 deletions

View file

@ -1097,10 +1097,8 @@ export class LemmyHttp {
}
function encodeGetParams<BodyType>(p: BodyType): string {
console.log(p);
// Necessary to remove the Options
let serialized = JSON.parse(serialize(p));
console.log(serialized);
return (
Object.entries(serialized)
// TODO test this, it might serialize the undefineds

View file

@ -20,18 +20,8 @@ export class CreateComment {
form_id: Option<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;
constructor(init: CreateComment) {
Object.assign(this, init);
}
}
@ -47,16 +37,8 @@ export class EditComment {
form_id: Option<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;
constructor(init: EditComment) {
Object.assign(this, init);
}
}
@ -68,10 +50,8 @@ export class DeleteComment {
deleted: boolean;
auth: string;
constructor(comment_id: number, deleted: boolean, auth: string) {
this.comment_id = comment_id;
this.deleted = deleted;
this.auth = auth;
constructor(init: DeleteComment) {
Object.assign(this, init);
}
}
@ -87,16 +67,8 @@ export class RemoveComment {
reason: Option<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;
constructor(init: RemoveComment) {
Object.assign(this, init);
}
}
@ -108,10 +80,8 @@ export class MarkCommentAsRead {
read: boolean;
auth: string;
constructor(comment_id: number, read: boolean, auth: string) {
this.comment_id = comment_id;
this.read = read;
this.auth = auth;
constructor(init: MarkCommentAsRead) {
Object.assign(this, init);
}
}
@ -120,10 +90,8 @@ export class SaveComment {
save: boolean;
auth: string;
constructor(comment_id: number, save: boolean, auth: string) {
this.comment_id = comment_id;
this.save = save;
this.auth = auth;
constructor(init: SaveComment) {
Object.assign(this, init);
}
}
@ -144,10 +112,8 @@ export class CreateCommentLike {
score: number;
auth: string;
constructor(comment_id: number, score: number, auth: string) {
this.comment_id = comment_id;
this.score = score;
this.auth = auth;
constructor(init: CreateCommentLike) {
Object.assign(this, init);
}
}
@ -191,24 +157,8 @@ export class GetComments {
@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;
constructor(init: GetComments) {
Object.assign(this, init);
}
}
@ -221,10 +171,8 @@ export class CreateCommentReport {
reason: string;
auth: string;
constructor(comment_id: number, reason: string, auth: string) {
this.comment_id = comment_id;
this.reason = reason;
this.auth = auth;
constructor(init: CreateCommentReport) {
Object.assign(this, init);
}
}
@ -240,10 +188,8 @@ export class ResolveCommentReport {
resolved: boolean;
auth: string;
constructor(report_id: number, resolved: boolean, auth: string) {
this.report_id = report_id;
this.resolved = resolved;
this.auth = auth;
constructor(init: ResolveCommentReport) {
Object.assign(this, init);
}
}
@ -273,18 +219,8 @@ export class ListCommentReports {
unresolved_only: Option<boolean>;
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;
constructor(init: ListCommentReports) {
Object.assign(this, init);
}
}

View file

@ -28,10 +28,8 @@ export class GetCommunity {
@Expose()
auth: Option<string>;
constructor(id: Option<number>, name: Option<string>, auth: Option<string>) {
this.id = id;
this.name = name;
this.auth = auth;
constructor(init: GetCommunity) {
Object.assign(this, init);
}
}
@ -70,24 +68,8 @@ export class CreateCommunity {
posting_restricted_to_mods: Option<boolean>;
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;
constructor(init: CreateCommunity) {
Object.assign(this, init);
}
}
@ -117,18 +99,8 @@ export class ListCommunities {
@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;
constructor(init: ListCommunities) {
Object.assign(this, init);
}
}
@ -161,22 +133,8 @@ export class BanFromCommunity {
expires: Option<number>;
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;
constructor(init: BanFromCommunity) {
Object.assign(this, init);
}
}
@ -191,16 +149,8 @@ export class AddModToCommunity {
added: boolean;
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;
constructor(init: AddModToCommunity) {
Object.assign(this, init);
}
}
@ -239,24 +189,8 @@ export class EditCommunity {
posting_restricted_to_mods: Option<boolean>;
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;
constructor(init: EditCommunity) {
Object.assign(this, init);
}
}
@ -265,10 +199,8 @@ export class DeleteCommunity {
deleted: boolean;
auth: string;
constructor(community_id: number, deleted: boolean, auth: string) {
this.community_id = community_id;
this.deleted = deleted;
this.auth = auth;
constructor(init: DeleteCommunity) {
Object.assign(this, init);
}
}
@ -291,18 +223,8 @@ export class RemoveCommunity {
expires: Option<number>;
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;
constructor(init: RemoveCommunity) {
Object.assign(this, init);
}
}
@ -311,10 +233,8 @@ export class FollowCommunity {
follow: boolean;
auth: string;
constructor(community_id: number, follow: boolean, auth: string) {
this.community_id = community_id;
this.follow = follow;
this.auth = auth;
constructor(init: FollowCommunity) {
Object.assign(this, init);
}
}
@ -323,10 +243,8 @@ export class TransferCommunity {
person_id: number;
auth: string;
constructor(community_id: number, person_id: number, auth: string) {
this.community_id = community_id;
this.person_id = person_id;
this.auth = auth;
constructor(init: TransferCommunity) {
Object.assign(this, init);
}
}
@ -335,10 +253,8 @@ export class BlockCommunity {
block: boolean;
auth: string;
constructor(community_id: number, block: boolean, auth: string) {
this.community_id = community_id;
this.block = block;
this.auth = auth;
constructor(init: BlockCommunity) {
Object.assign(this, init);
}
}

View file

@ -15,9 +15,8 @@ export class Login {
username_or_email: string;
password: string;
constructor(username_or_email: string, password: string) {
this.username_or_email = username_or_email;
this.password = password;
constructor(init: Login) {
Object.assign(this, init);
}
}
@ -61,26 +60,8 @@ export class Register {
@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;
constructor(init: Register) {
Object.assign(this, init);
}
}
@ -207,46 +188,8 @@ export class SaveUserSettings {
show_new_post_notifs: Option<boolean>;
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;
constructor(init: SaveUserSettings) {
Object.assign(this, init);
}
}
@ -256,16 +199,8 @@ export class ChangePassword {
old_password: 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;
constructor(init: ChangePassword) {
Object.assign(this, init);
}
}
@ -321,24 +256,8 @@ export class GetPersonDetails {
@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;
constructor(init: GetPersonDetails) {
Object.assign(this, init);
}
}
@ -370,10 +289,8 @@ export class AddAdmin {
added: boolean;
auth: string;
constructor(person_id: number, added: boolean, auth: string) {
this.person_id = person_id;
this.added = added;
this.auth = auth;
constructor(init: AddAdmin) {
Object.assign(this, init);
}
}
@ -405,20 +322,8 @@ export class BanPerson {
expires: Option<number>;
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;
constructor(init: BanPerson) {
Object.assign(this, init);
}
}
@ -446,18 +351,8 @@ export class GetReplies {
unread_only: Option<boolean>;
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;
constructor(init: GetReplies) {
Object.assign(this, init);
}
}
@ -480,18 +375,8 @@ export class GetPersonMentions {
unread_only: Option<boolean>;
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;
constructor(init: GetPersonMentions) {
Object.assign(this, init);
}
}
@ -500,10 +385,8 @@ export class MarkPersonMentionAsRead {
read: boolean;
auth: string;
constructor(person_mention_id: number, read: boolean, auth: string) {
this.person_mention_id = person_mention_id;
this.read = read;
this.auth = auth;
constructor(init: MarkPersonMentionAsRead) {
Object.assign(this, init);
}
}
@ -518,9 +401,8 @@ export class DeleteAccount {
password: string;
auth: string;
constructor(password: string, auth: string) {
this.password = password;
this.auth = auth;
constructor(init: DeleteAccount) {
Object.assign(this, init);
}
}
@ -529,8 +411,8 @@ export class DeleteAccountResponse {}
export class PasswordReset {
email: string;
constructor(email: string) {
this.email = email;
constructor(init: PasswordReset) {
Object.assign(this, init);
}
}
@ -541,10 +423,8 @@ export class PasswordChange {
password: string;
password_verify: string;
constructor(token: string, password: string, password_verify: string) {
this.token = token;
this.password = password;
this.password_verify = password_verify;
constructor(init: PasswordChange) {
Object.assign(this, init);
}
}
@ -553,10 +433,8 @@ export class CreatePrivateMessage {
recipient_id: number;
auth: string;
constructor(content: string, recipient_id: number, auth: string) {
this.content = content;
this.recipient_id = recipient_id;
this.auth = auth;
constructor(init: CreatePrivateMessage) {
Object.assign(this, init);
}
}
@ -565,10 +443,8 @@ export class EditPrivateMessage {
content: 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;
constructor(init: EditPrivateMessage) {
Object.assign(this, init);
}
}
@ -577,10 +453,8 @@ export class DeletePrivateMessage {
deleted: boolean;
auth: string;
constructor(private_message_id: number, deleted: boolean, auth: string) {
this.private_message_id = private_message_id;
this.deleted = deleted;
this.auth = auth;
constructor(init: DeletePrivateMessage) {
Object.assign(this, init);
}
}
@ -589,10 +463,8 @@ export class MarkPrivateMessageAsRead {
read: boolean;
auth: string;
constructor(private_message_id: number, read: boolean, auth: string) {
this.private_message_id = private_message_id;
this.read = read;
this.auth = auth;
constructor(init: MarkPrivateMessageAsRead) {
Object.assign(this, init);
}
}
@ -610,6 +482,10 @@ export class GetPrivateMessages {
@Expose()
limit: Option<number>;
auth: string;
constructor(init: GetPrivateMessages) {
Object.assign(this, init);
}
}
export class PrivateMessagesResponse {
@ -630,9 +506,8 @@ export class GetReportCount {
community_id: Option<number>;
auth: string;
constructor(community_id: Option<number>, auth: string) {
this.community_id = community_id;
this.auth = auth;
constructor(init: GetReportCount) {
Object.assign(this, init);
}
}
@ -648,8 +523,8 @@ export class GetReportCountResponse {
export class GetUnreadCount {
auth: string;
constructor(auth: string) {
this.auth = auth;
constructor(init: GetUnreadCount) {
Object.assign(this, init);
}
}
@ -662,8 +537,8 @@ export class GetUnreadCountResponse {
export class VerifyEmail {
token: string;
constructor(token: string) {
this.token = token;
constructor(init: VerifyEmail) {
Object.assign(this, init);
}
}
@ -674,10 +549,8 @@ export class BlockPerson {
block: boolean;
auth: string;
constructor(person_id: number, block: boolean, auth: string) {
this.person_id = person_id;
this.block = block;
this.auth = auth;
constructor(init: BlockPerson) {
Object.assign(this, init);
}
}
@ -689,8 +562,8 @@ export class BlockPersonResponse {
export class GetBannedPersons {
auth: string;
constructor(auth: string) {
this.auth = auth;
constructor(init: GetBannedPersons) {
Object.assign(this, init);
}
}

View file

@ -31,22 +31,8 @@ export class CreatePost {
honeypot: Option<string>;
auth: 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;
constructor(init: CreatePost) {
Object.assign(this, init);
}
}
@ -61,9 +47,8 @@ export class GetPost {
@Expose()
auth: Option<string>;
constructor(id: number, auth: Option<string>) {
this.id = id;
this.auth = auth;
constructor(init: GetPost) {
Object.assign(this, init);
}
}
@ -112,24 +97,8 @@ export class GetPosts {
@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;
constructor(init: GetPosts) {
Object.assign(this, init);
}
}
@ -146,10 +115,8 @@ export class CreatePostLike {
score: number;
auth: string;
constructor(post_id: number, score: number, auth: string) {
this.post_id = post_id;
this.score = score;
this.auth = auth;
constructor(init: CreatePostLike) {
Object.assign(this, init);
}
}
@ -173,20 +140,8 @@ export class EditPost {
nsfw: Option<boolean>;
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;
constructor(init: EditPost) {
Object.assign(this, init);
}
}
@ -195,10 +150,8 @@ export class DeletePost {
deleted: boolean;
auth: string;
constructor(post_id: number, deleted: boolean, auth: string) {
this.post_id = post_id;
this.deleted = deleted;
this.auth = auth;
constructor(init: DeletePost) {
Object.assign(this, init);
}
}
@ -214,16 +167,8 @@ export class RemovePost {
reason: Option<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;
constructor(init: RemovePost) {
Object.assign(this, init);
}
}
@ -235,10 +180,8 @@ export class MarkPostAsRead {
read: boolean;
auth: string;
constructor(post_id: number, read: boolean, auth: string) {
this.post_id = post_id;
this.read = read;
this.auth = auth;
constructor(init: MarkPostAsRead) {
Object.assign(this, init);
}
}
@ -250,10 +193,8 @@ export class LockPost {
locked: boolean;
auth: string;
constructor(post_id: number, locked: boolean, auth: string) {
this.post_id = post_id;
this.locked = locked;
this.auth = auth;
constructor(init: LockPost) {
Object.assign(this, init);
}
}
@ -265,10 +206,8 @@ export class StickyPost {
stickied: boolean;
auth: string;
constructor(post_id: number, stickied: boolean, auth: string) {
this.post_id = post_id;
this.stickied = stickied;
this.auth = auth;
constructor(init: StickyPost) {
Object.assign(this, init);
}
}
@ -277,10 +216,8 @@ export class SavePost {
save: boolean;
auth: string;
constructor(post_id: number, save: boolean, auth: string) {
this.post_id = post_id;
this.save = save;
this.auth = auth;
constructor(init: SavePost) {
Object.assign(this, init);
}
}
@ -289,10 +226,8 @@ export class CreatePostReport {
reason: string;
auth: string;
constructor(post_id: number, reason: string, auth: string) {
this.post_id = post_id;
this.reason = reason;
this.auth = auth;
constructor(init: CreatePostReport) {
Object.assign(this, init);
}
}
@ -308,10 +243,8 @@ export class ResolvePostReport {
resolved: boolean;
auth: string;
constructor(report_id: number, resolved: boolean, auth: string) {
this.report_id = report_id;
this.resolved = resolved;
this.auth = auth;
constructor(init: ResolvePostReport) {
Object.assign(this, init);
}
}
@ -340,18 +273,8 @@ export class ListPostReports {
unresolved_only: Option<boolean>;
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;
constructor(init: ListPostReports) {
Object.assign(this, init);
}
}
@ -362,8 +285,8 @@ export class ListPostReportsResponse {
export class GetSiteMetadata {
url: string;
constructor(url: string) {
this.url = url;
constructor(init: GetSiteMetadata) {
Object.assign(this, init);
}
}

View file

@ -71,28 +71,8 @@ export class Search {
@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;
constructor(init: Search) {
Object.assign(this, init);
}
}
@ -129,18 +109,8 @@ export class GetModlog {
@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;
constructor(init: GetModlog) {
Object.assign(this, init);
}
}
@ -217,40 +187,8 @@ export class CreateSite {
default_post_listing_type: Option<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;
constructor(init: CreateSite) {
Object.assign(this, init);
}
}
@ -321,42 +259,8 @@ export class EditSite {
default_post_listing_type: Option<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;
constructor(init: EditSite) {
Object.assign(this, init);
}
}
@ -366,8 +270,8 @@ export class GetSite {
@Expose()
auth: Option<string>;
constructor(auth: Option<string>) {
this.auth = auth;
constructor(init: GetSite) {
Object.assign(this, init);
}
}
@ -402,27 +306,31 @@ export class GetSiteResponse {
/**
* Your user info, such as blocks, follows, etc.
*/
export interface MyUserInfo {
export class MyUserInfo {
local_user_view: LocalUserSettingsView;
follows: CommunityFollowerView[];
moderates: CommunityModeratorView[];
community_blocks: CommunityBlockView[];
person_blocks: PersonBlockView[];
constructor(init: MyUserInfo) {
Object.assign(this, init);
}
}
export class LeaveAdmin {
auth: string;
constructor(auth: string) {
this.auth = auth;
constructor(init: LeaveAdmin) {
Object.assign(this, init);
}
}
export class GetSiteConfig {
auth: string;
constructor(auth: string) {
this.auth = auth;
constructor(init: GetSiteConfig) {
Object.assign(this, init);
}
}
@ -434,9 +342,8 @@ export class SaveSiteConfig {
config_hjson: string;
auth: string;
constructor(config_hjson: string, auth: string) {
this.config_hjson = config_hjson;
this.auth = auth;
constructor(init: SaveSiteConfig) {
Object.assign(this, init);
}
}
@ -450,6 +357,10 @@ export class FederatedInstances {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
blocked: Option<string[]>;
constructor(init: FederatedInstances) {
Object.assign(this, init);
}
}
export class ResolveObject {
@ -459,9 +370,8 @@ export class ResolveObject {
@Expose()
auth: Option<string>;
constructor(q: string, auth: Option<string>) {
this.q = q;
this.auth = auth;
constructor(init: ResolveObject) {
Object.assign(this, init);
}
}
@ -502,16 +412,8 @@ export class ListRegistrationApplications {
limit: Option<number>;
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;
constructor(init: ListRegistrationApplications) {
Object.assign(this, init);
}
}
@ -528,16 +430,8 @@ export class ApproveRegistrationApplication {
deny_reason: Option<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;
constructor(init: ApproveRegistrationApplication) {
Object.assign(this, init);
}
}
@ -548,8 +442,8 @@ export class RegistrationApplicationResponse {
export class GetUnreadRegistrationApplicationCount {
auth: string;
constructor(auth: string) {
this.auth = auth;
constructor(init: GetUnreadRegistrationApplicationCount) {
Object.assign(this, init);
}
}

View file

@ -171,4 +171,8 @@ export class SiteMetadata {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
html: Option<string>;
constructor(init: SiteMetadata) {
Object.assign(this, init);
}
}