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 { function encodeGetParams<BodyType>(p: BodyType): string {
console.log(p);
// Necessary to remove the Options // Necessary to remove the Options
let serialized = JSON.parse(serialize(p)); let serialized = JSON.parse(serialize(p));
console.log(serialized);
return ( return (
Object.entries(serialized) Object.entries(serialized)
// TODO test this, it might serialize the undefineds // TODO test this, it might serialize the undefineds

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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