-
Notifications
You must be signed in to change notification settings - Fork 13
/
recordingemailmessage.go
174 lines (117 loc) · 3.64 KB
/
recordingemailmessage.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package platformclientv2
import (
"time"
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Recordingemailmessage
type Recordingemailmessage struct {
// HtmlBody
HtmlBody *string `json:"htmlBody,omitempty"`
// TextBody
TextBody *string `json:"textBody,omitempty"`
// Id
Id *string `json:"id,omitempty"`
// To
To *[]Emailaddress `json:"to,omitempty"`
// Cc
Cc *[]Emailaddress `json:"cc,omitempty"`
// Bcc
Bcc *[]Emailaddress `json:"bcc,omitempty"`
// From
From *Emailaddress `json:"from,omitempty"`
// Subject
Subject *string `json:"subject,omitempty"`
// Attachments
Attachments *[]Emailattachment `json:"attachments,omitempty"`
// Time - Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z
Time *time.Time `json:"time,omitempty"`
}
func (o *Recordingemailmessage) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Recordingemailmessage
Time := new(string)
if o.Time != nil {
*Time = timeutil.Strftime(o.Time, "%Y-%m-%dT%H:%M:%S.%fZ")
} else {
Time = nil
}
return json.Marshal(&struct {
HtmlBody *string `json:"htmlBody,omitempty"`
TextBody *string `json:"textBody,omitempty"`
Id *string `json:"id,omitempty"`
To *[]Emailaddress `json:"to,omitempty"`
Cc *[]Emailaddress `json:"cc,omitempty"`
Bcc *[]Emailaddress `json:"bcc,omitempty"`
From *Emailaddress `json:"from,omitempty"`
Subject *string `json:"subject,omitempty"`
Attachments *[]Emailattachment `json:"attachments,omitempty"`
Time *string `json:"time,omitempty"`
*Alias
}{
HtmlBody: o.HtmlBody,
TextBody: o.TextBody,
Id: o.Id,
To: o.To,
Cc: o.Cc,
Bcc: o.Bcc,
From: o.From,
Subject: o.Subject,
Attachments: o.Attachments,
Time: Time,
Alias: (*Alias)(o),
})
}
func (o *Recordingemailmessage) UnmarshalJSON(b []byte) error {
var RecordingemailmessageMap map[string]interface{}
err := json.Unmarshal(b, &RecordingemailmessageMap)
if err != nil {
return err
}
if HtmlBody, ok := RecordingemailmessageMap["htmlBody"].(string); ok {
o.HtmlBody = &HtmlBody
}
if TextBody, ok := RecordingemailmessageMap["textBody"].(string); ok {
o.TextBody = &TextBody
}
if Id, ok := RecordingemailmessageMap["id"].(string); ok {
o.Id = &Id
}
if To, ok := RecordingemailmessageMap["to"].([]interface{}); ok {
ToString, _ := json.Marshal(To)
json.Unmarshal(ToString, &o.To)
}
if Cc, ok := RecordingemailmessageMap["cc"].([]interface{}); ok {
CcString, _ := json.Marshal(Cc)
json.Unmarshal(CcString, &o.Cc)
}
if Bcc, ok := RecordingemailmessageMap["bcc"].([]interface{}); ok {
BccString, _ := json.Marshal(Bcc)
json.Unmarshal(BccString, &o.Bcc)
}
if From, ok := RecordingemailmessageMap["from"].(map[string]interface{}); ok {
FromString, _ := json.Marshal(From)
json.Unmarshal(FromString, &o.From)
}
if Subject, ok := RecordingemailmessageMap["subject"].(string); ok {
o.Subject = &Subject
}
if Attachments, ok := RecordingemailmessageMap["attachments"].([]interface{}); ok {
AttachmentsString, _ := json.Marshal(Attachments)
json.Unmarshal(AttachmentsString, &o.Attachments)
}
if timeString, ok := RecordingemailmessageMap["time"].(string); ok {
Time, _ := time.Parse("2006-01-02T15:04:05.999999Z", timeString)
o.Time = &Time
}
return nil
}
// String returns a JSON representation of the model
func (o *Recordingemailmessage) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}