-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
61 lines (50 loc) · 1.67 KB
/
types.go
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
// AGPL License
// Copyright (c) 2023 ysicing <[email protected]>
package xuanim
type ContentType string
const (
ContentTypePlain ContentType = "plain" // 纯文本
ContentTypeText ContentType = "text" // Markdown
)
type ActionType string
const (
ActionTypePrimary ActionType = "primary"
ActionTypeSuccess ActionType = "success"
ActionTypeDanger ActionType = "danger"
ActionTypeWarning ActionType = "warning"
ActionTypeInfo ActionType = "info"
ActionTypeImportant ActionType = "important"
ActionTypeSpecial ActionType = "special"
)
type Actions struct {
Label string `json:"label"`
Icon string `json:"icon,omitempty"`
URL string `json:"url,omitempty"`
ActionType ActionType `json:"actionType,omitempty"`
}
type Sender struct {
ID any `json:"id"` // 标识发送方唯一身份的字符串或数字
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
}
type SendBody struct {
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
Content string `json:"content,omitempty"`
ContentType ContentType `json:"contentType"`
URL string `json:"url,omitempty"`
Actions []Actions `json:"actions,omitempty"`
Sender Sender `json:"sender,omitempty"`
}
type SendUserNotification struct {
SendBody
Users any `json:"users"` // 使用一个用户 ID 数组指定通知发送给哪些用户 [1,4] 或者 ["ysicing"]
}
type SendGroupNotification struct {
SendBody
Gid string `json:"gid"` // 讨论组的全局唯一字符串
}
type MessageResp struct {
Result string `json:"result,omitempty"`
Message string `json:"message,omitempty"`
}