-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
233 lines (218 loc) · 7.75 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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
package addyapi
import (
"strings"
"time"
)
// Time format returned by Addy.
type UnixTime struct {
time.Time
}
func (ut *UnixTime) UnmarshalJSON(b []byte) error {
s := strings.Trim(string(b), `"`)
t, err := time.Parse(time.DateTime, s)
if err != nil {
}
ut.Time = t
return nil
}
type AccountDetailsWrap struct {
Data AccountDetails `json:"data"`
}
type AccountDetails struct {
ID string `json:"id"`
Username string `json:"username"`
FromName string `json:"from_name"`
EmailSubject string `json:"email_subject"`
BannerLocation string `json:"banner_location"`
Bandwidth uint `json:"bandwidth"`
UsernameCount uint `json:"username_count"`
UsernameLimit uint `json:"username_limit"`
DefaultRecipientID string `json:"default_recipient_id"`
DefaultAliasDomain string `json:"default_alias_domain"`
DefaultAliasFormat string `json:"default_alias_format"`
Subscription string `json:"subscription"`
SubscriptionEndsAt *UnixTime `json:"subscription_ends_at"`
BandwidthLimit uint `json:"bandwidth_limit"`
RecipientCount uint `json:"recipient_count"`
RecipientLimit uint `json:"recipient_limit"`
ActiveDomainCount uint `json:"active_domain_count"`
ActiveDomainLimit uint `json:"active_domain_limit"`
ActiveSharedDomainAliasCount uint `json:"active_shared_domain_alias_count"`
ActiveSharedDomainAliasLimit uint `json:"active_shared_domain_alias_limit"`
TotalEmailsForwarded uint `json:"total_emails_forwarded"`
TotalEmailsBlocked uint `json:"total_emails_blocked"`
TotalEmailsReplied uint `json:"total_emails_replied"`
TotalEmailsSent uint `json:"total_emails_sent"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
type AliasWrap struct {
Data Alias `json:"data"`
}
type AliasesWrap struct {
Data []Alias `json:"data"`
}
type Alias struct {
ID string `json:"id"`
UserID string `json:"user_id"`
AliasableID string `json:"aliasable_id"`
AliasableType string `json:"aliasable_type"`
LocalPart string `json:"local_part"`
Extension string `json:"extension"`
Domain string `json:"domain"`
Email string `json:"email"`
Active bool `json:"active"`
Description string `json:"description"`
EmailsForwarded uint `json:"emails_forwarded"`
EmailsBlocked uint `json:"emails_blocked"`
EmailsReplied uint `json:"emails_replied"`
EmailsSent uint `json:"emails_sent"`
Recipients []Recipient `json:"recipients"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
DeletedAt *UnixTime `json:"deleted_at"`
}
type RecipientWrap struct {
Data Recipient `json:"data"`
}
type RecipientsWrap struct {
Data []Recipient `json:"data"`
}
type Recipient struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Email string `json:"email"`
CanReplySend bool `json:"can_reply_send"`
ShouldEncrypt bool `json:"should_encrypt"`
InlineEncryption bool `json:"inline_encryption"`
ProtectedHeaders bool `json:"protected_headers"`
Fingerprint string `json:"fingerprint"`
EmailVerifiedAt *UnixTime `json:"email_verified_at"`
Aliases []Alias `json:"aliases"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
type DomainWrap struct {
Data Domain `json:"data"`
}
type DomainsWrap struct {
Data []Domain `json:"data"`
}
type Domain struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Domain string `json:"domain"`
Description string `json:"description"`
Aliases []Alias `json:"aliases"`
DefaultRecipient Recipient `json:"default_recipient"`
Active bool `json:"active"`
CatchAll bool `json:"catch_all"`
DomainVerifiedAt *UnixTime `json:"domain_verified_at"`
DomainMxValidatedAt *UnixTime `json:"domain_mx_validated_at"`
DomainSendingVerifiedAt *UnixTime `json:"domain_sending_verified_at"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
type FailedDeliveryWrap struct {
Data FailedDelivery `json:"data"`
}
type FailedDeliveriesWrap struct {
Data []FailedDelivery `json:"data"`
}
type FailedDelivery struct {
ID string `json:"id"`
UserID string `json:"user_id"`
RecipientID string `json:"recipient_id"`
RecipientEmail string `json:"recipient_email"`
AliasID string `json:"alias_id"`
AliasEmail string `json:"alias_email"`
BounceType string `json:"bounce_type"`
RemoteMta string `json:"remote_mta"`
Sender string `json:"sender"`
EmailType string `json:"email_type"`
Status string `json:"status"`
Code string `json:"code"`
AttemptedAt UnixTime `json:"attempted_at"`
CreatedAt *UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
type RuleWrap struct {
Data Rule `json:"data"`
}
type RulesWrap struct {
Data []Rule `json:"data"`
}
type Rule struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
Order int `json:"order"`
Conditions []Conditions `json:"conditions"`
Actions []Actions `json:"actions"`
Operator string `json:"operator"`
Forwards bool `json:"forwards"`
Replies bool `json:"replies"`
Sends bool `json:"sends"`
Active bool `json:"active"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
type Conditions struct {
Type string `json:"type"`
Match string `json:"match"`
Values []string `json:"values"`
}
type Actions struct {
Type string `json:"type"`
Value string `json:"value"`
}
type TokenAPIDetails struct {
Name string `json:"name"`
CreatedAt UnixTime `json:"created_at"`
ExpiresAt *UnixTime `json:"expires_at"`
}
type AppVersion struct {
Version string `json:"version"`
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
}
type DomainOptions struct {
Data []string `json:"data"`
DefaultAliasDomain string `json:"defaultAliasDomain"`
DefaultAliasFormat string `json:"defaultAliasFormat"`
}
type UserWrap struct {
Data User `json:"data"`
}
type UsersWrap struct {
Data []User `json:"data"`
}
type User struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Username string `json:"username"`
Description string `json:"description"`
Aliases []Alias `json:"aliases"`
DefaultRecipient string `json:"default_recipient"`
Active bool `json:"active"`
CatchAll bool `json:"catch_all"`
CanLogin bool `json:"can_login"`
CreatedAt UnixTime `json:"created_at"`
UpdatedAt *UnixTime `json:"updated_at"`
}
// Multiple methods require either ID or an array of IDs as arguments.
type IDGeneric struct {
ID string `json:"id"`
}
type IDsGeneric struct {
IDs []string `json:"ids"`
}
// Responce from bulk actions.
type BulkWrap struct {
Data Bulk `json:"data"`
}
type Bulk struct {
Message string `json:"message"`
IDs []string `json:"ids"`
}