2020-12-20 17:33:14 +00:00
|
|
|
import {
|
|
|
|
CommentView,
|
|
|
|
CommunityFollowerView,
|
|
|
|
CommunityModeratorView,
|
|
|
|
PostView,
|
|
|
|
PrivateMessageView,
|
|
|
|
UserMentionView,
|
|
|
|
UserViewSafe,
|
|
|
|
} from '../views';
|
|
|
|
|
|
|
|
export interface Login {
|
|
|
|
username_or_email: string;
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
|
2021-01-18 19:32:18 +00:00
|
|
|
/**
|
|
|
|
* Only the first user will be able to be the admin.
|
|
|
|
*/
|
2020-12-20 17:33:14 +00:00
|
|
|
export interface Register {
|
|
|
|
username: string;
|
|
|
|
email?: string;
|
|
|
|
password: string;
|
|
|
|
password_verify: string;
|
|
|
|
show_nsfw: boolean;
|
2021-01-18 19:32:18 +00:00
|
|
|
captcha_uuid?: string; // Only checked if these are enabled in the server
|
2020-12-20 17:33:14 +00:00
|
|
|
captcha_answer?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetCaptcha {}
|
|
|
|
|
|
|
|
export interface GetCaptchaResponse {
|
2021-01-18 19:32:18 +00:00
|
|
|
ok?: CaptchaResponse; // Will be undefined if captchas are disabled
|
2020-12-20 17:33:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface CaptchaResponse {
|
|
|
|
png: string; // A Base64 encoded png
|
|
|
|
wav?: string; // A Base64 encoded wav aud,
|
|
|
|
uuid: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SaveUserSettings {
|
|
|
|
show_nsfw: boolean;
|
2021-01-29 15:11:11 +00:00
|
|
|
theme: string; // Default 'browser'
|
2021-01-18 19:32:18 +00:00
|
|
|
default_sort_type: number; // The Sort types from above, zero indexed as a number
|
|
|
|
default_listing_type: number; // Post listing types are `All, Subscribed, Community`
|
2020-12-20 17:33:14 +00:00
|
|
|
lang: string;
|
|
|
|
avatar?: string;
|
|
|
|
banner?: string;
|
2021-01-29 15:11:11 +00:00
|
|
|
preferred_username?: string; // The display name
|
2020-12-20 17:33:14 +00:00
|
|
|
email?: string;
|
|
|
|
bio?: string;
|
|
|
|
matrix_user_id?: string;
|
2021-01-29 15:11:11 +00:00
|
|
|
new_password?: string; // If setting a new password, you need all 3 password fields
|
2020-12-20 17:33:14 +00:00
|
|
|
new_password_verify?: string;
|
|
|
|
old_password?: string;
|
|
|
|
show_avatars: boolean;
|
|
|
|
send_notifications_to_email: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
2021-01-18 19:32:18 +00:00
|
|
|
/**
|
|
|
|
* The `jwt` string should be stored and used anywhere `auth` is called for.
|
|
|
|
*/
|
2020-12-20 17:33:14 +00:00
|
|
|
export interface LoginResponse {
|
|
|
|
jwt: string;
|
|
|
|
}
|
|
|
|
|
2021-01-18 19:32:18 +00:00
|
|
|
/**
|
|
|
|
* `username` can only be used for local users. To get details for a federated user, pass `user_id` instead.
|
|
|
|
*/
|
2020-12-20 17:33:14 +00:00
|
|
|
export interface GetUserDetails {
|
|
|
|
user_id?: number;
|
|
|
|
username?: string;
|
|
|
|
sort: string;
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
community_id?: number;
|
|
|
|
saved_only: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetUserDetailsResponse {
|
2021-01-18 21:45:43 +00:00
|
|
|
user_view: UserViewSafe;
|
2020-12-20 17:33:14 +00:00
|
|
|
follows: CommunityFollowerView[];
|
|
|
|
moderates: CommunityModeratorView[];
|
|
|
|
comments: CommentView[];
|
|
|
|
posts: PostView[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetRepliesResponse {
|
|
|
|
replies: CommentView[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetUserMentionsResponse {
|
|
|
|
mentions: UserMentionView[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MarkAllAsRead {
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddAdmin {
|
|
|
|
user_id: number;
|
|
|
|
added: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddAdminResponse {
|
|
|
|
admins: UserViewSafe[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BanUser {
|
|
|
|
user_id: number;
|
|
|
|
ban: boolean;
|
2021-01-18 19:32:18 +00:00
|
|
|
remove_data: boolean; // Removes/Restores their comments, posts, and communities
|
2020-12-20 17:33:14 +00:00
|
|
|
reason?: string;
|
|
|
|
expires?: number;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BanUserResponse {
|
|
|
|
user_view: UserViewSafe;
|
|
|
|
banned: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetReplies {
|
|
|
|
sort: string;
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
unread_only: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetUserMentions {
|
|
|
|
sort: string;
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
unread_only: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MarkUserMentionAsRead {
|
|
|
|
user_mention_id: number;
|
|
|
|
read: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface UserMentionResponse {
|
|
|
|
user_mention_view: UserMentionView;
|
|
|
|
}
|
|
|
|
|
2021-01-18 19:32:18 +00:00
|
|
|
/**
|
|
|
|
* Permanently deletes your posts and comments
|
|
|
|
*/
|
2020-12-20 17:33:14 +00:00
|
|
|
export interface DeleteAccount {
|
|
|
|
password: string;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PasswordReset {
|
|
|
|
email: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PasswordResetResponse {}
|
|
|
|
|
|
|
|
export interface PasswordChange {
|
|
|
|
token: string;
|
|
|
|
password: string;
|
|
|
|
password_verify: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CreatePrivateMessage {
|
|
|
|
content: string;
|
|
|
|
recipient_id: number;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface EditPrivateMessage {
|
2021-01-18 21:45:43 +00:00
|
|
|
private_message_id: number;
|
2020-12-20 17:33:14 +00:00
|
|
|
content: string;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DeletePrivateMessage {
|
2021-01-18 21:45:43 +00:00
|
|
|
private_message_id: number;
|
2020-12-20 17:33:14 +00:00
|
|
|
deleted: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface MarkPrivateMessageAsRead {
|
2021-01-18 21:45:43 +00:00
|
|
|
private_message_id: number;
|
2020-12-20 17:33:14 +00:00
|
|
|
read: boolean;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetPrivateMessages {
|
|
|
|
unread_only: boolean;
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PrivateMessagesResponse {
|
|
|
|
private_messages: PrivateMessageView[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PrivateMessageResponse {
|
|
|
|
private_message_view: PrivateMessageView;
|
|
|
|
}
|
|
|
|
|
2021-01-18 19:32:18 +00:00
|
|
|
/**
|
|
|
|
* If a community is supplied, returns the report count for only that community, otherwise returns the report count for all communities the user moderates.
|
|
|
|
*/
|
2020-12-20 17:33:14 +00:00
|
|
|
export interface GetReportCount {
|
|
|
|
community?: number;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetReportCountResponse {
|
|
|
|
community?: number;
|
|
|
|
comment_reports: number;
|
|
|
|
post_reports: number;
|
|
|
|
}
|