-
Notifications
You must be signed in to change notification settings - Fork 12
/
chatmessage.go
126 lines (74 loc) · 2.47 KB
/
chatmessage.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Chatmessage
type Chatmessage struct {
// Body - The message body
Body *string `json:"body,omitempty"`
// Id
Id *string `json:"id,omitempty"`
// To - The message recipient
To *string `json:"to,omitempty"`
// From - The message sender
From *string `json:"from,omitempty"`
// Utc
Utc *string `json:"utc,omitempty"`
// Chat - The interaction id (if available)
Chat *string `json:"chat,omitempty"`
// Message - The message id
Message *string `json:"message,omitempty"`
// VarType
VarType *string `json:"type,omitempty"`
// BodyType - Type of the message body (v2 chats only)
BodyType *string `json:"bodyType,omitempty"`
// SenderCommunicationId - Communication of sender (v2 chats only)
SenderCommunicationId *string `json:"senderCommunicationId,omitempty"`
// ParticipantPurpose - Participant purpose of sender (v2 chats only)
ParticipantPurpose *string `json:"participantPurpose,omitempty"`
// User - The user information for the sender (if available)
User *Chatmessageuser `json:"user,omitempty"`
}
func (u *Chatmessage) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Chatmessage
return json.Marshal(&struct {
Body *string `json:"body,omitempty"`
Id *string `json:"id,omitempty"`
To *string `json:"to,omitempty"`
From *string `json:"from,omitempty"`
Utc *string `json:"utc,omitempty"`
Chat *string `json:"chat,omitempty"`
Message *string `json:"message,omitempty"`
VarType *string `json:"type,omitempty"`
BodyType *string `json:"bodyType,omitempty"`
SenderCommunicationId *string `json:"senderCommunicationId,omitempty"`
ParticipantPurpose *string `json:"participantPurpose,omitempty"`
User *Chatmessageuser `json:"user,omitempty"`
*Alias
}{
Body: u.Body,
Id: u.Id,
To: u.To,
From: u.From,
Utc: u.Utc,
Chat: u.Chat,
Message: u.Message,
VarType: u.VarType,
BodyType: u.BodyType,
SenderCommunicationId: u.SenderCommunicationId,
ParticipantPurpose: u.ParticipantPurpose,
User: u.User,
Alias: (*Alias)(u),
})
}
// String returns a JSON representation of the model
func (o *Chatmessage) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}