-
Notifications
You must be signed in to change notification settings - Fork 0
/
notification.go
64 lines (57 loc) · 1.95 KB
/
notification.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
62
63
64
package vcago
import (
"github.com/Viva-con-Agua/vcago/vmod"
)
type (
NotificationData struct {
To string `json:"to" bson:"to"`
Service string `json:"service" bson:"service"`
Scope string `json:"scope" bson:"scope"`
Lang string `json:"lang" bson:"lang"`
Name string `json:"name" bson:"name"`
Content vmod.Content `json:"content" bson:"content"`
User vmod.User `json:"user" bson:"user"`
OriginUserID string `json:"origin_user_id" bson:"origin_user_id"`
}
NotificationResponse struct {
To string `json:"to" bson:"to"`
Service string `json:"service" bson:"service"`
Scope string `json:"scope" bson:"scope"`
Lang string `json:"lang" bson:"lang"`
Name string `json:"name" bson:"name"`
Content vmod.Content `json:"content" bson:"content"`
User vmod.User `json:"user" bson:"user"`
OriginUserID string `json:"origin_user_id" bson:"origin_user_id"`
From string `json:"from" bson:"from"`
Subject string `json:"subject" bson:"subject"`
Body string `json:"body" bson:"body"`
}
)
func NewMNotificationData(to string, service string, name string, scope string, lang string, user_id string) *NotificationData {
return &NotificationData{
To: to,
Service: service,
Name: name,
Scope: scope,
Lang: lang,
OriginUserID: user_id,
}
}
func (i *NotificationData) Response() *NotificationResponse {
return &NotificationResponse{
To: i.To,
Service: i.Service,
Name: i.Name,
Scope: i.Scope,
Lang: i.Lang,
Content: i.Content,
User: i.User,
OriginUserID: i.OriginUserID,
}
}
func (i *NotificationData) AddUser(user *vmod.User) {
i.User = *user
}
func (i *NotificationData) AddContent(content *vmod.Content) {
i.Content = *content
}