forked from sonda2208/gpass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
48 lines (39 loc) · 874 Bytes
/
message.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
package gpass
import "github.com/sonda2208/gpass/walletobjects"
type Message struct {
Body string
Header string
}
func (m *Message) toWO() *walletobjects.Message {
return &walletobjects.Message{
Body: m.Body,
Header: m.Header,
Kind: "walletobjects#walletObjectMessage",
MessageType: "TEXT",
}
}
func woToMessage(m *walletobjects.Message) *Message {
if m == nil {
return nil
}
return &Message{
Body: m.Body,
Header: m.Header,
}
}
type AddMessageRequest struct {
Message *Message
}
func (amr *AddMessageRequest) toWO() *walletobjects.AddMessageRequest {
return &walletobjects.AddMessageRequest{
Message: amr.Message.toWO(),
}
}
func woToAddMessageRequest(amr *walletobjects.AddMessageRequest) *AddMessageRequest {
if amr == nil {
return nil
}
return &AddMessageRequest{
Message: woToMessage(amr.Message),
}
}