DeleteAccount,
PasswordReset,
PasswordChange,
+ CreatePrivateMessage,
+ EditPrivateMessage,
+ GetPrivateMessages,
+ UserJoin,
+ GetComments,
+ GetSiteConfig,
+ SaveSiteConfig,
}
export enum CommentSortType {
Hot,
Top,
New,
+ Old,
}
export enum ListingType {
Community,
}
+export enum DataType {
+ Post,
+ Comment,
+}
+
export enum SortType {
Hot,
New,
lang: string;
avatar?: string;
show_avatars: boolean;
+ unreadCount?: number;
}
export interface UserView {
id: number;
+ actor_id: string;
name: string;
avatar?: string;
email?: string;
- fedi_name: string;
+ matrix_user_id?: string;
+ bio?: string;
+ local: boolean;
published: string;
number_of_posts: number;
post_score: number;
export interface CommunityUser {
id: number;
user_id: number;
+ user_actor_id: string;
+ user_local: boolean;
user_name: string;
avatar?: string;
community_id: number;
+ community_actor_id: string;
+ community_local: boolean;
community_name: string;
published: string;
}
export interface Community {
id: number;
+ actor_id: string;
+ local: boolean;
name: string;
title: string;
description?: string;
nsfw: boolean;
published: string;
updated?: string;
+ creator_actor_id: string;
+ creator_local: boolean;
+ last_refreshed_at: string;
creator_name: string;
creator_avatar?: string;
category_name: string;
deleted: boolean;
locked: boolean;
stickied: boolean;
+ embed_title?: string;
+ embed_description?: string;
+ embed_html?: string;
+ thumbnail_url?: string;
+ ap_id: string;
+ local: boolean;
nsfw: boolean;
banned: boolean;
banned_from_community: boolean;
published: string;
updated?: string;
+ creator_actor_id: string;
+ creator_local: boolean;
creator_name: string;
creator_avatar?: string;
+ community_actor_id: string;
+ community_local: boolean;
community_name: string;
community_removed: boolean;
community_deleted: boolean;
upvotes: number;
downvotes: number;
hot_rank: number;
+ newest_activity_time: string;
user_id?: number;
my_vote?: number;
subscribed?: boolean;
read?: boolean;
saved?: boolean;
+ duplicates?: Array<Post>;
}
export interface Comment {
id: number;
+ ap_id: string;
+ local: boolean;
creator_id: number;
post_id: number;
parent_id?: number;
published: string;
updated?: string;
community_id: number;
+ community_actor_id: string;
+ community_local: boolean;
+ community_name: string;
banned: boolean;
banned_from_community: boolean;
+ creator_actor_id: string;
+ creator_local: boolean;
creator_name: string;
creator_avatar?: string;
score: number;
upvotes: number;
downvotes: number;
+ hot_rank: number;
user_id?: number;
my_vote?: number;
+ subscribed?: number;
saved?: boolean;
user_mention_id?: number; // For mention type
recipient_id?: number;
+ recipient_actor_id?: string;
+ recipient_local?: boolean;
+ depth?: number;
}
export interface Category {
enable_nsfw: boolean;
}
+export interface PrivateMessage {
+ id: number;
+ creator_id: number;
+ recipient_id: number;
+ content: string;
+ deleted: boolean;
+ read: boolean;
+ published: string;
+ updated?: string;
+ creator_name: string;
+ creator_avatar?: string;
+ recipient_name: string;
+ recipient_avatar?: string;
+}
+
export enum BanType {
Community,
Site,
auth?: string;
}
+export interface GetFollowedCommunitiesForm {
+ auth: string;
+}
+
export interface GetFollowedCommunitiesResponse {
communities: Array<CommunityUser>;
}
lang: string;
avatar?: string;
email?: string;
+ matrix_user_id?: string;
new_password?: string;
new_password_verify?: string;
old_password?: string;
auth?: string;
}
+export interface GetCommunityForm {
+ id?: number;
+ name?: string;
+ auth?: string;
+}
+
export interface GetCommunityResponse {
community: Community;
moderators: Array<CommunityUser>;
admins: Array<UserView>;
+ online: number;
}
export interface CommunityResponse {
community?: string;
}
+export interface GetPostForm {
+ id: number;
+ auth?: string;
+}
+
export interface GetPostResponse {
post: Post;
comments: Array<Comment>;
community: Community;
moderators: Array<CommunityUser>;
admins: Array<UserView>;
+ online: number;
}
export interface SavePostForm {
export interface CommentResponse {
comment: Comment;
+ recipient_ids: Array<number>;
}
export interface CommentLikeForm {
posts: Array<Post>;
}
+export interface GetCommentsForm {
+ type_: string;
+ sort: string;
+ page?: number;
+ limit: number;
+ community_id?: number;
+ auth?: string;
+}
+
+export interface GetCommentsResponse {
+ comments: Array<Comment>;
+}
+
export interface CreatePostLikeForm {
post_id: number;
score: number;
auth?: string;
}
-export interface CreatePostLikeResponse {
- post: Post;
-}
-
export interface SiteForm {
name: string;
description?: string;
auth?: string;
}
+export interface GetSiteConfig {
+ auth?: string;
+}
+
+export interface GetSiteConfigResponse {
+ config_hjson: string;
+}
+
+export interface SiteConfigForm {
+ config_hjson: string;
+ auth?: string;
+}
+
export interface GetSiteResponse {
site: Site;
admins: Array<UserView>;
sort: string;
page?: number;
limit?: number;
+ auth?: string;
}
export interface SearchResponse {
password_verify: string;
}
+export interface PrivateMessageForm {
+ content: string;
+ recipient_id: number;
+ auth?: string;
+}
+
+export interface PrivateMessageFormParams {
+ recipient_id: number;
+}
+
+export interface EditPrivateMessageForm {
+ edit_id: number;
+ content?: string;
+ deleted?: boolean;
+ read?: boolean;
+ auth?: string;
+}
+
+export interface GetPrivateMessagesForm {
+ unread_only: boolean;
+ page?: number;
+ limit?: number;
+ auth?: string;
+}
+
+export interface PrivateMessagesResponse {
+ messages: Array<PrivateMessage>;
+}
+
+export interface PrivateMessageResponse {
+ message: PrivateMessage;
+}
+
+export interface UserJoinForm {
+ auth: string;
+}
+
+export interface UserJoinResponse {
+ user_id: number;
+}
+
+export type MessageType =
+ | EditPrivateMessageForm
+ | LoginForm
+ | RegisterForm
+ | CommunityForm
+ | FollowCommunityForm
+ | ListCommunitiesForm
+ | GetFollowedCommunitiesForm
+ | PostForm
+ | GetPostForm
+ | GetPostsForm
+ | GetCommunityForm
+ | CommentForm
+ | CommentLikeForm
+ | SaveCommentForm
+ | CreatePostLikeForm
+ | BanFromCommunityForm
+ | AddAdminForm
+ | AddModToCommunityForm
+ | TransferCommunityForm
+ | TransferSiteForm
+ | SaveCommentForm
+ | BanUserForm
+ | AddAdminForm
+ | GetUserDetailsForm
+ | GetRepliesForm
+ | GetUserMentionsForm
+ | EditUserMentionForm
+ | GetModlogForm
+ | SiteForm
+ | SearchForm
+ | UserSettingsForm
+ | DeleteAccountForm
+ | PasswordResetForm
+ | PasswordChangeForm
+ | PrivateMessageForm
+ | EditPrivateMessageForm
+ | GetPrivateMessagesForm
+ | SiteConfigForm;
+
type ResponseType =
| SiteResponse
| GetFollowedCommunitiesResponse
| ListCommunitiesResponse
| GetPostsResponse
- | CreatePostLikeResponse
+ | PostResponse
| GetRepliesResponse
| GetUserMentionsResponse
| ListCategoriesResponse
| BanFromCommunityResponse
| AddModToCommunityResponse
| BanUserResponse
- | AddAdminResponse;
+ | AddAdminResponse
+ | PrivateMessageResponse
+ | PrivateMessagesResponse
+ | GetSiteConfigResponse;
export interface WebSocketResponse {
op: UserOperation;
data: ResponseType;
+}
+
+export interface WebSocketJsonResponse {
+ op?: string;
+ data?: ResponseType;
error?: string;
+ reconnect?: boolean;
}