-
Notifications
You must be signed in to change notification settings - Fork 56
/
post.ts
166 lines (144 loc) · 2.78 KB
/
post.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import { ListingType, SiteMetadata, SortType } from "../others";
import {
CommentView,
CommunityModeratorView,
CommunityView,
PostReportView,
PostView,
} from "../views";
export interface CreatePost {
name: string;
url?: string;
body?: string;
nsfw?: boolean;
community_id: number;
auth: string;
honeypot?: string;
}
export interface PostResponse {
post_view: PostView;
}
export interface GetPost {
id: number;
auth?: string;
}
export interface GetPostResponse {
post_view: PostView;
community_view: CommunityView;
comments: CommentView[];
moderators: CommunityModeratorView[];
online: number;
}
export interface GetPosts {
type_?: ListingType;
sort?: SortType;
page?: number;
limit?: number;
community_id?: number;
/**
* To get posts for a federated community by name, use `name@instance.tld` .
*/
community_name?: string;
saved_only?: boolean;
auth?: string;
}
export interface GetPostsResponse {
posts: PostView[];
}
export interface CreatePostLike {
post_id: number;
/**
* `score` can be 0, -1, or 1. Anything else will be rejected.
*/
score: number;
auth: string;
}
export interface EditPost {
post_id: number;
name?: string;
url?: string;
body?: string;
nsfw?: boolean;
auth: string;
}
export interface DeletePost {
post_id: number;
deleted: boolean;
auth: string;
}
/**
* Only admins and mods can remove a post.
*/
export interface RemovePost {
post_id: number;
removed: boolean;
reason?: string;
auth: string;
}
/**
* Marks a post as read.
*/
export interface MarkPostAsRead {
post_id: number;
read: boolean;
auth: string;
}
/**
* Only admins and mods can lock a post.
*/
export interface LockPost {
post_id: number;
locked: boolean;
auth: string;
}
/**
* Only admins and mods can sticky a post.
*/
export interface StickyPost {
post_id: number;
stickied: boolean;
auth: string;
}
export interface SavePost {
post_id: number;
save: boolean;
auth: string;
}
export interface CreatePostReport {
post_id: number;
reason: string;
auth: string;
}
export interface PostReportResponse {
post_report_view: PostReportView;
}
export interface ResolvePostReport {
report_id: number;
/**
* Either resolve or unresolve a report.
*/
resolved: boolean;
auth: string;
}
export interface ListPostReports {
page?: number;
limit?: number;
/**
* if no community is given, it returns reports for all communities moderated by the auth user.
*/
community_id?: number;
/**
* Only shows the unresolved reports.
*/
unresolved_only?: boolean;
auth: string;
}
export interface ListPostReportsResponse {
post_reports: PostReportView[];
}
export interface GetSiteMetadata {
url: string;
}
export interface GetSiteMetadataResponse {
metadata: SiteMetadata;
}