forked from mxx1111/mdlook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshare-types.ts
More file actions
57 lines (51 loc) · 1.26 KB
/
Copy pathshare-types.ts
File metadata and controls
57 lines (51 loc) · 1.26 KB
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
export interface ShareRow {
id: string
post_id: string
user_id: string
title: string
html: string
password_hash: string | null
created_at: number
expires_at: number | null
view_count: number
}
export interface ShareHtmlSnapshot {
bodyHtml: string
stylesHtml: string
}
export type SharePasswordMode = `none` | `custom` | `auto`
export interface CreateShareRequest {
/** 前端文章 id,同一用户同一篇文章重复分享时链接不变 */
postId: string
title?: string
htmlSnapshot: ShareHtmlSnapshot
/** 无密码 / 自定义密码 / 系统随机生成 */
passwordMode?: SharePasswordMode
/** passwordMode=custom 时必填 */
password?: string
}
export interface CreateShareResponse {
id: string
url: string
expiresAt: number | null
/** true 表示更新了已有分享,false 表示首次创建 */
updated: boolean
/** 是否启用了访问密码 */
protected: boolean
/** 仅 passwordMode=auto 时返回系统生成的明文密码 */
password?: string
}
export interface ShareListItem {
id: string
postId: string
title: string
url: string
createdAt: number
expiresAt: number | null
viewCount: number
protected: boolean
expired: boolean
}
export interface ListSharesResponse {
shares: ShareListItem[]
}