2019-03-23 01:42:57 +00:00
|
|
|
export enum UserOperation {
|
2019-04-23 22:05:50 +00:00
|
|
|
Login, Register, CreateCommunity, CreatePost, ListCommunities, ListCategories, GetPost, GetCommunity, CreateComment, EditComment, SaveComment, CreateCommentLike, GetPosts, CreatePostLike, EditPost, SavePost, EditCommunity, FollowCommunity, GetFollowedCommunities, GetUserDetails, GetReplies, GetModlog, BanFromCommunity, AddModToCommunity, CreateSite, EditSite, GetSite, AddAdmin, BanUser, Search
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum CommentSortType {
|
|
|
|
Hot, Top, New
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum ListingType {
|
|
|
|
All, Subscribed, Community
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum SortType {
|
|
|
|
Hot, New, TopDay, TopWeek, TopMonth, TopYear, TopAll
|
2019-03-23 01:42:57 +00:00
|
|
|
}
|
|
|
|
|
2019-04-23 22:05:50 +00:00
|
|
|
export enum SearchType {
|
|
|
|
Both, Comments, Posts
|
|
|
|
}
|
|
|
|
|
2019-03-23 01:42:57 +00:00
|
|
|
export interface User {
|
2019-03-25 03:51:27 +00:00
|
|
|
id: number;
|
2019-03-29 04:56:23 +00:00
|
|
|
iss: string;
|
2019-03-21 01:22:31 +00:00
|
|
|
username: string;
|
2019-03-23 01:42:57 +00:00
|
|
|
}
|
|
|
|
|
2019-04-08 05:19:02 +00:00
|
|
|
export interface UserView {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
fedi_name: string;
|
|
|
|
published: string;
|
|
|
|
number_of_posts: number;
|
|
|
|
post_score: number;
|
|
|
|
number_of_comments: number;
|
|
|
|
comment_score: number;
|
|
|
|
}
|
|
|
|
|
2019-04-04 20:53:32 +00:00
|
|
|
export interface CommunityUser {
|
|
|
|
id: number;
|
|
|
|
user_id: number;
|
|
|
|
user_name: string;
|
|
|
|
community_id: number;
|
|
|
|
community_name: string;
|
|
|
|
published: string;
|
|
|
|
}
|
|
|
|
|
2019-03-25 03:51:27 +00:00
|
|
|
export interface Community {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
2019-04-03 23:01:20 +00:00
|
|
|
title: string;
|
|
|
|
description?: string;
|
2019-04-20 04:06:25 +00:00
|
|
|
category_id: number;
|
2019-04-03 23:01:20 +00:00
|
|
|
creator_id: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
removed: boolean;
|
|
|
|
published: string;
|
|
|
|
updated?: string;
|
2019-04-03 23:01:20 +00:00
|
|
|
creator_name: string;
|
|
|
|
category_name: string;
|
|
|
|
number_of_subscribers: number;
|
|
|
|
number_of_posts: number;
|
2019-04-04 20:00:19 +00:00
|
|
|
number_of_comments: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
user_id?: number;
|
|
|
|
subscribed?: boolean;
|
2019-03-26 18:00:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-15 23:12:06 +00:00
|
|
|
export interface Post {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
|
|
|
creator_id: number;
|
|
|
|
community_id: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
removed: boolean;
|
|
|
|
locked: boolean;
|
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
creator_name: string;
|
2019-04-15 23:12:06 +00:00
|
|
|
community_name: string;
|
2019-04-21 20:52:55 +00:00
|
|
|
community_removed: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
number_of_comments: number;
|
|
|
|
score: number;
|
|
|
|
upvotes: number;
|
|
|
|
downvotes: number;
|
|
|
|
hot_rank: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
user_id?: number;
|
|
|
|
my_vote?: number;
|
|
|
|
subscribed?: boolean;
|
|
|
|
read?: boolean;
|
|
|
|
saved?: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Comment {
|
|
|
|
id: number;
|
|
|
|
creator_id: number;
|
|
|
|
post_id: number,
|
|
|
|
parent_id?: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
content: string;
|
|
|
|
removed: boolean;
|
|
|
|
read: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
published: string;
|
|
|
|
updated?: string;
|
2019-04-20 04:06:25 +00:00
|
|
|
community_id: number,
|
|
|
|
banned: boolean;
|
|
|
|
banned_from_community: boolean;
|
|
|
|
creator_name: string;
|
2019-04-15 23:12:06 +00:00
|
|
|
score: number;
|
|
|
|
upvotes: number;
|
|
|
|
downvotes: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
user_id?: number;
|
2019-04-15 23:12:06 +00:00
|
|
|
my_vote?: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
saved?: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Category {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
2019-04-16 23:04:23 +00:00
|
|
|
export interface Site {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
description?: string;
|
|
|
|
creator_id: number;
|
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
creator_name: string;
|
|
|
|
number_of_users: number;
|
|
|
|
number_of_posts: number;
|
|
|
|
number_of_comments: number;
|
|
|
|
}
|
|
|
|
|
2019-04-15 23:12:06 +00:00
|
|
|
export interface FollowCommunityForm {
|
|
|
|
community_id: number;
|
|
|
|
follow: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetFollowedCommunitiesResponse {
|
|
|
|
op: string;
|
|
|
|
communities: Array<CommunityUser>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetUserDetailsForm {
|
2019-04-25 21:52:18 +00:00
|
|
|
user_id?: number;
|
|
|
|
username?: string;
|
|
|
|
sort: string;
|
2019-04-17 18:30:13 +00:00
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
2019-04-15 23:12:06 +00:00
|
|
|
community_id?: number;
|
2019-04-20 04:06:25 +00:00
|
|
|
saved_only: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface UserDetailsResponse {
|
|
|
|
op: string;
|
|
|
|
user: UserView;
|
|
|
|
follows: Array<CommunityUser>;
|
|
|
|
moderates: Array<CommunityUser>;
|
|
|
|
comments: Array<Comment>;
|
|
|
|
posts: Array<Post>;
|
|
|
|
}
|
|
|
|
|
2019-04-20 18:17:00 +00:00
|
|
|
export interface GetRepliesForm {
|
|
|
|
sort: string; // TODO figure this one out
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
unread_only: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetRepliesResponse {
|
|
|
|
op: string;
|
|
|
|
replies: Array<Comment>;
|
|
|
|
}
|
|
|
|
|
2019-04-15 23:12:06 +00:00
|
|
|
export interface BanFromCommunityForm {
|
|
|
|
community_id: number;
|
|
|
|
user_id: number;
|
|
|
|
ban: boolean;
|
|
|
|
reason?: string,
|
|
|
|
expires?: number,
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BanFromCommunityResponse {
|
|
|
|
op: string;
|
|
|
|
user: UserView,
|
|
|
|
banned: boolean,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddModToCommunityForm {
|
|
|
|
community_id: number;
|
|
|
|
user_id: number;
|
|
|
|
added: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddModToCommunityResponse {
|
|
|
|
op: string;
|
|
|
|
moderators: Array<CommunityUser>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetModlogForm {
|
|
|
|
mod_user_id?: number;
|
|
|
|
community_id?: number;
|
|
|
|
page?: number;
|
2019-04-17 18:30:13 +00:00
|
|
|
limit?: number;
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetModlogResponse {
|
|
|
|
op: string;
|
|
|
|
removed_posts: Array<ModRemovePost>,
|
|
|
|
locked_posts: Array<ModLockPost>,
|
|
|
|
removed_comments: Array<ModRemoveComment>,
|
|
|
|
removed_communities: Array<ModRemoveCommunity>,
|
|
|
|
banned_from_community: Array<ModBanFromCommunity>,
|
|
|
|
banned: Array<ModBan>,
|
|
|
|
added_to_community: Array<ModAddCommunity>,
|
|
|
|
added: Array<ModAdd>,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModRemovePost {
|
|
|
|
id: number;
|
|
|
|
mod_user_id: number;
|
|
|
|
post_id: number;
|
|
|
|
reason?: string;
|
|
|
|
removed?: boolean;
|
|
|
|
when_: string
|
|
|
|
mod_user_name: string;
|
|
|
|
post_name: string;
|
|
|
|
community_id: number;
|
|
|
|
community_name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModLockPost {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
post_id: number,
|
|
|
|
locked?: boolean,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
post_name: string,
|
|
|
|
community_id: number,
|
|
|
|
community_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModRemoveComment {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
comment_id: number,
|
|
|
|
reason?: string,
|
|
|
|
removed?: boolean,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
comment_user_id: number,
|
|
|
|
comment_user_name: string,
|
|
|
|
comment_content: string,
|
|
|
|
post_id: number,
|
|
|
|
post_name: string,
|
|
|
|
community_id: number,
|
|
|
|
community_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModRemoveCommunity {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
community_id: number,
|
|
|
|
reason?: string,
|
|
|
|
removed?: boolean,
|
|
|
|
expires?: number,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
community_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModBanFromCommunity {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
other_user_id: number,
|
|
|
|
community_id: number,
|
|
|
|
reason?: string,
|
|
|
|
banned?: boolean,
|
|
|
|
expires?: number,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
other_user_name: string,
|
|
|
|
community_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModBan {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
other_user_id: number,
|
|
|
|
reason?: string,
|
|
|
|
banned?: boolean,
|
|
|
|
expires?: number,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
other_user_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModAddCommunity {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
other_user_id: number,
|
|
|
|
community_id: number,
|
|
|
|
removed?: boolean,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
other_user_name: string,
|
|
|
|
community_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ModAdd {
|
|
|
|
id: number,
|
|
|
|
mod_user_id: number,
|
|
|
|
other_user_id: number,
|
|
|
|
removed?: boolean,
|
|
|
|
when_: string,
|
|
|
|
mod_user_name: string,
|
|
|
|
other_user_name: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface LoginForm {
|
|
|
|
username_or_email: string;
|
|
|
|
password: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RegisterForm {
|
|
|
|
username: string;
|
|
|
|
email?: string;
|
|
|
|
password: string;
|
|
|
|
password_verify: string;
|
2019-04-16 23:04:23 +00:00
|
|
|
admin: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface LoginResponse {
|
|
|
|
op: string;
|
|
|
|
jwt: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
export interface CommunityForm {
|
|
|
|
name: string;
|
2019-04-03 23:01:20 +00:00
|
|
|
title: string;
|
|
|
|
description?: string,
|
|
|
|
category_id: number,
|
2019-04-04 22:29:14 +00:00
|
|
|
edit_id?: number;
|
2019-04-21 21:38:57 +00:00
|
|
|
removed?: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
reason?: string;
|
|
|
|
expires?: number;
|
2019-03-26 18:00:18 +00:00
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-04-04 22:29:14 +00:00
|
|
|
export interface GetCommunityResponse {
|
2019-03-26 18:00:18 +00:00
|
|
|
op: string;
|
|
|
|
community: Community;
|
2019-04-04 20:53:32 +00:00
|
|
|
moderators: Array<CommunityUser>;
|
2019-04-21 20:52:55 +00:00
|
|
|
admins: Array<UserView>;
|
2019-03-26 18:00:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-04 22:29:14 +00:00
|
|
|
|
|
|
|
export interface CommunityResponse {
|
|
|
|
op: string;
|
|
|
|
community: Community;
|
|
|
|
}
|
|
|
|
|
2019-04-10 06:19:12 +00:00
|
|
|
export interface ListCommunitiesForm {
|
|
|
|
sort: string;
|
2019-04-17 18:30:13 +00:00
|
|
|
page?: number;
|
2019-04-10 06:19:12 +00:00
|
|
|
limit?: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
export interface ListCommunitiesResponse {
|
|
|
|
op: string;
|
|
|
|
communities: Array<Community>;
|
|
|
|
}
|
|
|
|
|
2019-04-03 23:01:20 +00:00
|
|
|
export interface ListCategoriesResponse {
|
|
|
|
op: string;
|
|
|
|
categories: Array<Category>;
|
|
|
|
}
|
2019-04-17 18:30:13 +00:00
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
export interface PostForm {
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
|
|
|
community_id: number;
|
|
|
|
updated?: number;
|
2019-04-03 20:59:37 +00:00
|
|
|
edit_id?: number;
|
2019-04-15 23:12:06 +00:00
|
|
|
creator_id: number;
|
2019-04-20 07:24:59 +00:00
|
|
|
removed?: boolean;
|
|
|
|
locked?: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
reason?: string;
|
2019-03-26 18:00:18 +00:00
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
2019-04-03 20:59:37 +00:00
|
|
|
export interface GetPostResponse {
|
2019-03-26 18:00:18 +00:00
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
comments: Array<Comment>;
|
2019-04-03 23:01:20 +00:00
|
|
|
community: Community;
|
2019-04-04 20:53:32 +00:00
|
|
|
moderators: Array<CommunityUser>;
|
2019-04-20 04:06:25 +00:00
|
|
|
admins: Array<UserView>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SavePostForm {
|
|
|
|
post_id: number;
|
|
|
|
save: boolean;
|
|
|
|
auth?: string;
|
2019-03-26 18:00:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 20:59:37 +00:00
|
|
|
export interface PostResponse {
|
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
export interface CommentForm {
|
|
|
|
content: string;
|
|
|
|
post_id: number;
|
|
|
|
parent_id?: number;
|
2019-03-29 04:56:23 +00:00
|
|
|
edit_id?: number;
|
2019-04-15 23:12:06 +00:00
|
|
|
creator_id: number;
|
2019-04-20 07:24:59 +00:00
|
|
|
removed?: boolean;
|
2019-04-15 23:12:06 +00:00
|
|
|
reason?: string;
|
2019-04-20 18:17:00 +00:00
|
|
|
read?: boolean;
|
2019-03-26 18:00:18 +00:00
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
2019-04-20 04:06:25 +00:00
|
|
|
export interface SaveCommentForm {
|
|
|
|
comment_id: number;
|
|
|
|
save: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
export interface CommentResponse {
|
|
|
|
op: string;
|
|
|
|
comment: Comment;
|
2019-03-25 03:51:27 +00:00
|
|
|
}
|
|
|
|
|
2019-03-28 19:32:08 +00:00
|
|
|
export interface CommentLikeForm {
|
|
|
|
comment_id: number;
|
|
|
|
post_id: number;
|
|
|
|
score: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-04-08 05:19:02 +00:00
|
|
|
export interface CommentNode {
|
|
|
|
comment: Comment;
|
|
|
|
children?: Array<CommentNode>;
|
|
|
|
}
|
|
|
|
|
2019-04-03 06:49:32 +00:00
|
|
|
export interface GetPostsForm {
|
|
|
|
type_: string;
|
|
|
|
sort: string;
|
2019-04-17 18:30:13 +00:00
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
2019-04-03 06:49:32 +00:00
|
|
|
community_id?: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetPostsResponse {
|
|
|
|
op: string;
|
|
|
|
posts: Array<Post>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CreatePostLikeForm {
|
|
|
|
post_id: number;
|
|
|
|
score: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CreatePostLikeResponse {
|
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
}
|
|
|
|
|
2019-04-16 23:04:23 +00:00
|
|
|
export interface SiteForm {
|
|
|
|
name: string;
|
|
|
|
description?: string,
|
|
|
|
removed?: boolean;
|
|
|
|
reason?: string;
|
|
|
|
expires?: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GetSiteResponse {
|
|
|
|
op: string;
|
|
|
|
site: Site;
|
|
|
|
admins: Array<UserView>;
|
|
|
|
banned: Array<UserView>;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:00:18 +00:00
|
|
|
|
2019-04-16 23:04:23 +00:00
|
|
|
export interface SiteResponse {
|
|
|
|
op: string;
|
|
|
|
site: Site;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BanUserForm {
|
|
|
|
user_id: number;
|
|
|
|
ban: boolean;
|
|
|
|
reason?: string,
|
|
|
|
expires?: number,
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface BanUserResponse {
|
|
|
|
op: string;
|
|
|
|
user: UserView,
|
|
|
|
banned: boolean,
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddAdminForm {
|
|
|
|
user_id: number;
|
|
|
|
added: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AddAdminResponse {
|
|
|
|
op: string;
|
|
|
|
admins: Array<UserView>;
|
|
|
|
}
|
2019-04-23 22:05:50 +00:00
|
|
|
|
|
|
|
export interface SearchForm {
|
|
|
|
q: string;
|
|
|
|
type_: string;
|
|
|
|
community_id?: number;
|
|
|
|
sort: string;
|
|
|
|
page?: number;
|
|
|
|
limit?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface SearchResponse {
|
|
|
|
op: string;
|
|
|
|
posts?: Array<Post>;
|
|
|
|
comments?: Array<Comment>;
|
|
|
|
}
|