2019-03-22 21:42:57 -04:00
|
|
|
export enum UserOperation {
|
2019-04-08 01:19:02 -04:00
|
|
|
Login, Register, CreateCommunity, CreatePost, ListCommunities, ListCategories, GetPost, GetCommunity, CreateComment, EditComment, CreateCommentLike, GetPosts, CreatePostLike, EditPost, EditCommunity, FollowCommunity, GetFollowedCommunities, GetUserDetails
|
2019-03-22 21:42:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface User {
|
2019-03-24 23:51:27 -04:00
|
|
|
id: number;
|
2019-03-29 00:56:23 -04:00
|
|
|
iss: string;
|
2019-03-20 21:22:31 -04:00
|
|
|
username: string;
|
2019-03-22 21:42:57 -04:00
|
|
|
}
|
|
|
|
|
2019-04-08 01:19:02 -04: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 16:53:32 -04:00
|
|
|
export interface CommunityUser {
|
|
|
|
id: number;
|
|
|
|
user_id: number;
|
|
|
|
user_name: string;
|
|
|
|
community_id: number;
|
|
|
|
community_name: string;
|
|
|
|
published: string;
|
|
|
|
}
|
|
|
|
|
2019-03-24 23:51:27 -04:00
|
|
|
export interface Community {
|
2019-04-05 02:26:38 -04:00
|
|
|
user_id?: number;
|
|
|
|
subscribed?: boolean;
|
2019-03-24 23:51:27 -04:00
|
|
|
id: number;
|
|
|
|
name: string;
|
2019-04-03 19:01:20 -04:00
|
|
|
title: string;
|
|
|
|
description?: string;
|
|
|
|
creator_id: number;
|
|
|
|
creator_name: string;
|
|
|
|
category_id: number;
|
|
|
|
category_name: string;
|
|
|
|
number_of_subscribers: number;
|
|
|
|
number_of_posts: number;
|
2019-04-04 16:00:19 -04:00
|
|
|
number_of_comments: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommunityForm {
|
|
|
|
name: string;
|
2019-04-03 19:01:20 -04:00
|
|
|
title: string;
|
|
|
|
description?: string,
|
|
|
|
category_id: number,
|
2019-04-04 18:29:14 -04:00
|
|
|
edit_id?: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-04-04 18:29:14 -04:00
|
|
|
export interface GetCommunityResponse {
|
2019-03-26 14:00:18 -04:00
|
|
|
op: string;
|
|
|
|
community: Community;
|
2019-04-04 16:53:32 -04:00
|
|
|
moderators: Array<CommunityUser>;
|
2019-03-26 14:00:18 -04:00
|
|
|
}
|
|
|
|
|
2019-04-04 18:29:14 -04:00
|
|
|
|
|
|
|
export interface CommunityResponse {
|
|
|
|
op: string;
|
|
|
|
community: Community;
|
|
|
|
}
|
|
|
|
|
2019-04-10 02:19:12 -04:00
|
|
|
export interface ListCommunitiesForm {
|
|
|
|
sort: string;
|
|
|
|
limit?: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:00:18 -04:00
|
|
|
export interface ListCommunitiesResponse {
|
|
|
|
op: string;
|
|
|
|
communities: Array<Community>;
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:01:20 -04:00
|
|
|
export interface ListCategoriesResponse {
|
|
|
|
op: string;
|
|
|
|
categories: Array<Category>;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:00:18 -04:00
|
|
|
export interface Post {
|
2019-04-03 02:49:32 -04:00
|
|
|
user_id?: number;
|
|
|
|
my_vote?: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
2019-04-03 02:49:32 -04:00
|
|
|
creator_id: number;
|
|
|
|
creator_name: string;
|
2019-03-26 14:00:18 -04:00
|
|
|
community_id: number;
|
2019-04-03 02:49:32 -04:00
|
|
|
community_name: string;
|
|
|
|
number_of_comments: number;
|
|
|
|
score: number;
|
|
|
|
upvotes: number;
|
|
|
|
downvotes: number;
|
|
|
|
hot_rank: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PostForm {
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
|
|
|
community_id: number;
|
|
|
|
updated?: number;
|
2019-04-03 16:59:37 -04:00
|
|
|
edit_id?: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
2019-04-03 16:59:37 -04:00
|
|
|
export interface GetPostResponse {
|
2019-03-26 14:00:18 -04:00
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
comments: Array<Comment>;
|
2019-04-03 19:01:20 -04:00
|
|
|
community: Community;
|
2019-04-04 16:53:32 -04:00
|
|
|
moderators: Array<CommunityUser>;
|
2019-03-26 14:00:18 -04:00
|
|
|
}
|
|
|
|
|
2019-04-03 16:59:37 -04:00
|
|
|
export interface PostResponse {
|
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
}
|
|
|
|
|
2019-03-26 14:00:18 -04:00
|
|
|
export interface Comment {
|
|
|
|
id: number;
|
|
|
|
content: string;
|
2019-04-03 02:49:32 -04:00
|
|
|
creator_id: number;
|
2019-04-03 16:59:37 -04:00
|
|
|
creator_name: string;
|
2019-03-26 14:00:18 -04:00
|
|
|
post_id: number,
|
|
|
|
parent_id?: number;
|
|
|
|
published: string;
|
|
|
|
updated?: string;
|
2019-03-28 15:32:08 -04:00
|
|
|
score: number;
|
|
|
|
upvotes: number;
|
|
|
|
downvotes: number;
|
|
|
|
my_vote?: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommentForm {
|
|
|
|
content: string;
|
|
|
|
post_id: number;
|
|
|
|
parent_id?: number;
|
2019-03-29 00:56:23 -04:00
|
|
|
edit_id?: number;
|
2019-03-26 14:00:18 -04:00
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommentResponse {
|
|
|
|
op: string;
|
|
|
|
comment: Comment;
|
2019-03-24 23:51:27 -04:00
|
|
|
}
|
|
|
|
|
2019-03-28 15:32:08 -04:00
|
|
|
export interface CommentLikeForm {
|
|
|
|
comment_id: number;
|
|
|
|
post_id: number;
|
|
|
|
score: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-04-08 01:19:02 -04:00
|
|
|
export interface CommentNode {
|
|
|
|
comment: Comment;
|
|
|
|
children?: Array<CommentNode>;
|
|
|
|
}
|
|
|
|
|
2019-04-03 02:49:32 -04:00
|
|
|
export interface GetPostsForm {
|
|
|
|
type_: string;
|
|
|
|
sort: string;
|
|
|
|
limit: number;
|
|
|
|
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-03 19:01:20 -04:00
|
|
|
export interface Category {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
2019-04-05 02:26:38 -04:00
|
|
|
export interface FollowCommunityForm {
|
|
|
|
community_id: number;
|
|
|
|
follow: boolean;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
2019-04-05 15:14:54 -04:00
|
|
|
export interface GetFollowedCommunitiesResponse {
|
|
|
|
op: string;
|
|
|
|
communities: Array<CommunityUser>;
|
|
|
|
}
|
|
|
|
|
2019-04-08 01:19:02 -04:00
|
|
|
export interface GetUserDetailsForm {
|
|
|
|
user_id: number;
|
|
|
|
sort: string; // TODO figure this one out
|
|
|
|
limit: number;
|
|
|
|
community_id?: number;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface UserDetailsResponse {
|
|
|
|
op: string;
|
|
|
|
user: UserView;
|
|
|
|
follows: Array<CommunityUser>;
|
|
|
|
moderates: Array<CommunityUser>;
|
|
|
|
comments: Array<Comment>;
|
|
|
|
posts: Array<Post>;
|
|
|
|
saved?: Array<Post>;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-22 21:42:57 -04:00
|
|
|
export interface LoginForm {
|
|
|
|
username_or_email: string;
|
2019-03-20 21:22:31 -04:00
|
|
|
password: string;
|
|
|
|
}
|
2019-03-22 21:42:57 -04:00
|
|
|
|
2019-03-20 21:22:31 -04:00
|
|
|
export interface RegisterForm {
|
|
|
|
username: string;
|
|
|
|
email?: string;
|
|
|
|
password: string;
|
|
|
|
password_verify: string;
|
|
|
|
}
|
|
|
|
|
2019-04-03 02:49:32 -04:00
|
|
|
|
2019-03-26 14:00:18 -04:00
|
|
|
export interface LoginResponse {
|
|
|
|
op: string;
|
|
|
|
jwt: string;
|
2019-03-22 21:42:57 -04:00
|
|
|
}
|
|
|
|
|
2019-03-30 02:08:02 -04:00
|
|
|
export enum CommentSortType {
|
|
|
|
Hot, Top, New
|
|
|
|
}
|
|
|
|
|
2019-04-03 02:49:32 -04:00
|
|
|
export enum ListingType {
|
|
|
|
All, Subscribed, Community
|
|
|
|
}
|
|
|
|
|
2019-04-08 01:19:02 -04:00
|
|
|
export enum SortType {
|
2019-04-03 02:49:32 -04:00
|
|
|
Hot, New, TopDay, TopWeek, TopMonth, TopYear, TopAll
|
|
|
|
}
|
2019-03-26 14:00:18 -04:00
|
|
|
|