2019-03-22 21:42:57 -04:00
|
|
|
export enum UserOperation {
|
2019-03-29 00:56:23 -04:00
|
|
|
Login, Register, CreateCommunity, CreatePost, ListCommunities, GetPost, GetCommunity, CreateComment, EditComment, CreateCommentLike
|
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-03-24 23:51:27 -04:00
|
|
|
export interface Community {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
2019-03-26 14:00:18 -04:00
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommunityForm {
|
|
|
|
name: string;
|
|
|
|
auth?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommunityResponse {
|
|
|
|
op: string;
|
|
|
|
community: Community;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ListCommunitiesResponse {
|
|
|
|
op: string;
|
|
|
|
communities: Array<Community>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Post {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
|
|
|
attributed_to: string;
|
|
|
|
community_id: number;
|
|
|
|
published: string;
|
|
|
|
updated?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PostForm {
|
|
|
|
name: string;
|
|
|
|
url?: string;
|
|
|
|
body?: string;
|
|
|
|
community_id: number;
|
|
|
|
updated?: number;
|
|
|
|
auth: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PostResponse {
|
|
|
|
op: string;
|
|
|
|
post: Post;
|
|
|
|
comments: Array<Comment>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Comment {
|
|
|
|
id: number;
|
|
|
|
content: string;
|
|
|
|
attributed_to: string;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CreateCommentLikeResponse {
|
|
|
|
op: string;
|
|
|
|
comment: Comment;
|
|
|
|
}
|
|
|
|
|
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-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-03-26 14:00:18 -04:00
|
|
|
|