1 | interface BaseAPIOptions {
|
2 | |
3 |
|
4 |
|
5 |
|
6 |
|
7 | serverURL: string;
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 | lang: string;
|
14 | }
|
15 | interface ErrorStatusResponse {
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | errno: number;
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 | errmsg: string;
|
28 | }
|
29 |
|
30 | interface GetArticleCounterOptions extends BaseAPIOptions {
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | paths: string[];
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 | type: string[];
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 | signal?: AbortSignal;
|
49 | }
|
50 | type GetArticleCounterResponse = Record<string, number>[] | Record<string, number> | number[] | number;
|
51 | declare const getArticleCounter: ({ serverURL, lang, paths, type, signal, }: GetArticleCounterOptions) => Promise<GetArticleCounterResponse>;
|
52 | interface UpdateArticleCounterOptions extends BaseAPIOptions {
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 | path: string;
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 | type: string;
|
65 | |
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | action?: 'inc' | 'desc';
|
73 | }
|
74 | declare const updateArticleCounter: ({ serverURL, lang, path, type, action, }: UpdateArticleCounterOptions) => Promise<number>;
|
75 |
|
76 | interface WalineCommentData {
|
77 | |
78 |
|
79 |
|
80 | nick: string;
|
81 | |
82 |
|
83 |
|
84 | mail: string;
|
85 | |
86 |
|
87 |
|
88 | link?: string;
|
89 | |
90 |
|
91 |
|
92 | comment: string;
|
93 | |
94 |
|
95 |
|
96 | ua: string;
|
97 | |
98 |
|
99 |
|
100 | pid?: string;
|
101 | |
102 |
|
103 |
|
104 | rid?: string;
|
105 | |
106 |
|
107 |
|
108 | at?: string;
|
109 | |
110 |
|
111 |
|
112 | url: string;
|
113 | |
114 |
|
115 |
|
116 | recaptchaV3?: string;
|
117 | }
|
118 | type WalineCommentStatus = 'approved' | 'waiting' | 'spam';
|
119 | interface WalineComment extends Exclude<WalineCommentData, 'ua'> {
|
120 | |
121 |
|
122 |
|
123 | avatar: string;
|
124 | |
125 |
|
126 |
|
127 | type?: 'administrator' | 'guest' | `verify:${string}`;
|
128 | objectId: string;
|
129 | |
130 |
|
131 |
|
132 | createdAt: string;
|
133 | insertedAt: string;
|
134 | updatedAt: string;
|
135 | children: WalineComment[];
|
136 | sticky?: boolean;
|
137 | browser?: string;
|
138 | os?: string;
|
139 | level?: number;
|
140 | addr?: string;
|
141 | label?: string;
|
142 | user_id?: string | number;
|
143 | status?: WalineCommentStatus;
|
144 | like?: number;
|
145 | orig?: string;
|
146 | }
|
147 |
|
148 | interface GetCommentOptions extends BaseAPIOptions {
|
149 | |
150 |
|
151 |
|
152 |
|
153 |
|
154 | path: string;
|
155 | |
156 |
|
157 |
|
158 |
|
159 |
|
160 | page: number;
|
161 | |
162 |
|
163 |
|
164 |
|
165 |
|
166 | pageSize: number;
|
167 | |
168 |
|
169 |
|
170 |
|
171 |
|
172 | sortBy: string;
|
173 | |
174 |
|
175 |
|
176 |
|
177 |
|
178 | token?: string;
|
179 | |
180 |
|
181 |
|
182 |
|
183 |
|
184 | signal?: AbortSignal;
|
185 | }
|
186 | interface GetCommentResponse extends ErrorStatusResponse {
|
187 | |
188 |
|
189 |
|
190 |
|
191 |
|
192 | count: number;
|
193 | |
194 |
|
195 |
|
196 |
|
197 |
|
198 | page: number;
|
199 | |
200 |
|
201 |
|
202 |
|
203 |
|
204 | pageSize: number;
|
205 | |
206 |
|
207 |
|
208 |
|
209 |
|
210 | data: WalineComment[];
|
211 | |
212 |
|
213 |
|
214 |
|
215 |
|
216 | totalPages: number;
|
217 | }
|
218 | declare const getComment: ({ serverURL, lang, path, page, pageSize, sortBy, signal, token, }: GetCommentOptions) => Promise<GetCommentResponse>;
|
219 | interface AddCommentOptions extends BaseAPIOptions {
|
220 | |
221 |
|
222 |
|
223 |
|
224 |
|
225 | token?: string;
|
226 | |
227 |
|
228 |
|
229 |
|
230 |
|
231 | comment: WalineCommentData;
|
232 | }
|
233 | interface AddCommentResponse extends ErrorStatusResponse {
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 | data?: WalineComment;
|
240 | }
|
241 | declare const addComment: ({ serverURL, lang, token, comment, }: AddCommentOptions) => Promise<AddCommentResponse>;
|
242 | interface DeleteCommentOptions extends BaseAPIOptions {
|
243 | token: string;
|
244 | objectId: string | number;
|
245 | }
|
246 | interface DeleteCommentResponse extends ErrorStatusResponse {
|
247 | data: '';
|
248 | }
|
249 | declare const deleteComment: ({ serverURL, lang, token, objectId, }: DeleteCommentOptions) => Promise<DeleteCommentResponse>;
|
250 | interface UpdateWalineCommentData extends Partial<WalineCommentData> {
|
251 | |
252 |
|
253 |
|
254 |
|
255 |
|
256 | like?: boolean;
|
257 | |
258 |
|
259 |
|
260 |
|
261 |
|
262 | status?: 'approved' | 'waiting' | 'spam';
|
263 | |
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 | sticky?: 0 | 1;
|
271 | }
|
272 | interface UpdateCommentOptions extends BaseAPIOptions {
|
273 | |
274 |
|
275 |
|
276 |
|
277 |
|
278 | token: string;
|
279 | |
280 |
|
281 |
|
282 |
|
283 |
|
284 | objectId: number | string;
|
285 | |
286 |
|
287 |
|
288 |
|
289 |
|
290 | comment?: UpdateWalineCommentData;
|
291 | }
|
292 | interface UpdateCommentResponse extends ErrorStatusResponse {
|
293 | |
294 |
|
295 |
|
296 |
|
297 |
|
298 | data: WalineComment;
|
299 | }
|
300 | declare const updateComment: ({ serverURL, lang, token, objectId, comment, }: UpdateCommentOptions) => Promise<UpdateCommentResponse>;
|
301 |
|
302 | interface GetCommentCountOptions extends BaseAPIOptions {
|
303 | |
304 |
|
305 |
|
306 |
|
307 |
|
308 | paths: string[];
|
309 | |
310 |
|
311 |
|
312 |
|
313 |
|
314 | signal?: AbortSignal;
|
315 | }
|
316 | declare const fetchCommentCount: ({ serverURL, lang, paths, signal, }: GetCommentCountOptions) => Promise<number[]>;
|
317 |
|
318 | interface UserInfo {
|
319 | |
320 |
|
321 |
|
322 |
|
323 |
|
324 | display_name: string;
|
325 | |
326 |
|
327 |
|
328 |
|
329 |
|
330 | email: string;
|
331 | |
332 |
|
333 |
|
334 |
|
335 |
|
336 | url: string;
|
337 | |
338 |
|
339 |
|
340 |
|
341 |
|
342 | token: string;
|
343 | |
344 |
|
345 |
|
346 |
|
347 |
|
348 | avatar: string;
|
349 | |
350 |
|
351 |
|
352 |
|
353 |
|
354 | mailMd5: string;
|
355 | |
356 |
|
357 |
|
358 |
|
359 |
|
360 | objectId: string | number;
|
361 | |
362 |
|
363 |
|
364 |
|
365 |
|
366 | type: 'administrator' | 'guest';
|
367 | }
|
368 | declare const login: ({ lang, serverURL, }: BaseAPIOptions) => Promise<UserInfo & {
|
369 | remember: boolean;
|
370 | }>;
|
371 |
|
372 | interface GetPageviewOptions extends BaseAPIOptions {
|
373 | |
374 |
|
375 |
|
376 |
|
377 |
|
378 | paths: string[];
|
379 | |
380 |
|
381 |
|
382 |
|
383 |
|
384 | signal?: AbortSignal;
|
385 | }
|
386 | declare const getPageview: ({ serverURL, lang, paths, signal, }: GetPageviewOptions) => Promise<number[]>;
|
387 | interface UpdatePageviewOptions extends BaseAPIOptions {
|
388 | |
389 |
|
390 |
|
391 |
|
392 |
|
393 | path: string;
|
394 | }
|
395 | declare const updatePageview: (options: UpdatePageviewOptions) => Promise<number>;
|
396 |
|
397 | interface GetRecentCommentOptions extends BaseAPIOptions {
|
398 | |
399 |
|
400 |
|
401 |
|
402 |
|
403 | count: number;
|
404 | |
405 |
|
406 |
|
407 |
|
408 |
|
409 | signal?: AbortSignal;
|
410 | |
411 |
|
412 |
|
413 |
|
414 |
|
415 | token?: string;
|
416 | }
|
417 | declare const getRecentComment: ({ serverURL, lang, count, signal, token, }: GetRecentCommentOptions) => Promise<WalineComment[]>;
|
418 |
|
419 | interface GetUserListOptions extends BaseAPIOptions {
|
420 | |
421 |
|
422 |
|
423 |
|
424 |
|
425 | pageSize: number;
|
426 | |
427 |
|
428 |
|
429 |
|
430 |
|
431 | signal?: AbortSignal;
|
432 | }
|
433 | interface WalineUser extends Pick<WalineComment, 'nick' | 'link' | 'avatar' | 'label' | 'level'> {
|
434 | count: number;
|
435 | }
|
436 | interface GetUserListResponse extends ErrorStatusResponse {
|
437 | data: WalineUser[];
|
438 | }
|
439 | declare const getUserList: ({ serverURL, signal, pageSize, lang, }: GetUserListOptions) => Promise<WalineUser[]>;
|
440 |
|
441 | export { AddCommentOptions, AddCommentResponse, DeleteCommentOptions, DeleteCommentResponse, GetArticleCounterOptions, GetArticleCounterResponse, GetCommentCountOptions, GetCommentOptions, GetCommentResponse, GetRecentCommentOptions, GetUserListOptions, GetUserListResponse, UpdateArticleCounterOptions, UpdateCommentOptions, UpdateCommentResponse, UpdatePageviewOptions, UserInfo, WalineUser, addComment, deleteComment, fetchCommentCount, getArticleCounter, getComment, getPageview, getRecentComment, getUserList, login, updateArticleCounter, updateComment, updatePageview };
|