-
Notifications
You must be signed in to change notification settings - Fork 41
/
team_secondary_mails.stone
287 lines (186 loc) · 8.25 KB
/
team_secondary_mails.stone
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
namespace team
import common
import secondary_emails
alias SecondaryEmail = secondary_emails.SecondaryEmail
struct UserSecondaryEmailsArg
"User and a list of secondary emails."
user UserSelectorArg
secondary_emails List(common.EmailAddress)
example default
user = default
secondary_emails = ["bob2@hotmail.com", "bob@inst.gov"]
#
# add secondary emails
#
union AddSecondaryEmailResult
"Result of trying to add a secondary email to a user.
'success' is the only value indicating that a secondary email was successfully added to a user.
The other values explain the type of error that occurred, and include the email for which the error occurred."
success SecondaryEmail
"Describes a secondary email that was successfully added to a user."
unavailable common.EmailAddress
"Secondary email is not available to be claimed by the user."
already_pending common.EmailAddress
"Secondary email is already a pending email for the user."
already_owned_by_user common.EmailAddress
"Secondary email is already a verified email for the user."
reached_limit common.EmailAddress
"User already has the maximum number of secondary emails allowed."
transient_error common.EmailAddress
"A transient error occurred. Please try again later."
too_many_updates common.EmailAddress
"An error occurred due to conflicting updates. Please try again later."
unknown_error common.EmailAddress
"An unknown error occurred."
rate_limited common.EmailAddress
"Too many emails are being sent to this email address. Please try again later."
example default
success = default
example unavailable
unavailable = "alice@example.com"
struct UserSecondaryEmailsResult
user UserSelectorArg
results List(AddSecondaryEmailResult)
example default
user = default
results = [default, unavailable]
union UserAddResult
"Result of trying to add secondary emails to a user.
'success' is the only value indicating that a user was successfully retrieved for adding secondary emails.
The other values explain the type of error that occurred, and include the user for which the error occurred."
success UserSecondaryEmailsResult
"Describes a user and the results for each attempt to add a secondary email."
invalid_user UserSelectorArg
"Specified user is not a valid target for adding secondary emails."
unverified UserSelectorArg
"Secondary emails can only be added to verified users."
placeholder_user UserSelectorArg
"Secondary emails cannot be added to placeholder users."
example default
success = default
example invalid
invalid_user = default
struct AddSecondaryEmailsArg
new_secondary_emails List(UserSecondaryEmailsArg)
"List of users and secondary emails to add."
example default
new_secondary_emails = [default]
struct AddSecondaryEmailsResult
results List(UserAddResult)
"List of users and secondary email results."
example default
results = [default, invalid]
union AddSecondaryEmailsError
"Error returned when adding secondary emails fails."
secondary_emails_disabled
"Secondary emails are disabled for the team."
too_many_emails
"A maximum of 20 secondary emails can be added in a single call."
route members/secondary_emails/add(AddSecondaryEmailsArg, AddSecondaryEmailsResult, AddSecondaryEmailsError)
"Add secondary emails to users.
Permission : Team member management.
Emails that are on verified domains will be verified automatically.
For each email address not on a verified domain a verification email will be sent."
attrs
auth = "team"
scope = "members.write"
#
# resend verification emails
#
struct ResendVerificationEmailArg
emails_to_resend List(UserSecondaryEmailsArg)
"List of users and secondary emails to resend verification emails to."
example default
emails_to_resend = [default]
union ResendSecondaryEmailResult
"Result of trying to resend verification email to a secondary email address.
'success' is the only value indicating that a verification email was successfully sent.
The other values explain the type of error that occurred, and include the email for which the error occurred."
success common.EmailAddress
"A verification email was successfully sent to the secondary email address."
not_pending common.EmailAddress
"This secondary email address is not pending for the user."
rate_limited common.EmailAddress
"Too many emails are being sent to this email address. Please try again later."
example default
success = "alice@example.com"
struct UserResendEmailsResult
user UserSelectorArg
results List(ResendSecondaryEmailResult)
example default
user = default
results = [default]
union UserResendResult
"Result of trying to resend verification emails to a user.
'success' is the only value indicating that a user was successfully retrieved for sending verification emails.
The other values explain the type of error that occurred, and include the user for which the error occurred."
success UserResendEmailsResult
"Describes a user and the results for each attempt to resend verification emails."
invalid_user UserSelectorArg
"Specified user is not a valid target for resending verification emails."
example default
success = default
example invalid
invalid_user = default
struct ResendVerificationEmailResult
"List of users and resend results."
results List(UserResendResult)
example default
results = [default]
route members/secondary_emails/resend_verification_emails(ResendVerificationEmailArg, ResendVerificationEmailResult, Void)
"Resend secondary email verification emails.
Permission : Team member management."
attrs
auth = "team"
scope = "members.write"
#
# delete secondary emails
#
struct DeleteSecondaryEmailsArg
emails_to_delete List(UserSecondaryEmailsArg)
"List of users and their secondary emails to delete."
example default
emails_to_delete = [default]
union DeleteSecondaryEmailResult
"Result of trying to delete a secondary email address.
'success' is the only value indicating that a secondary email was successfully deleted.
The other values explain the type of error that occurred, and include the email for which the error occurred."
success common.EmailAddress
"The secondary email was successfully deleted."
not_found common.EmailAddress
"The email address was not found for the user."
cannot_remove_primary common.EmailAddress
"The email address is the primary email address of the user, and cannot be removed."
example default
success = "alice@example.com"
example not_found
not_found = "alic@example.com"
struct UserDeleteEmailsResult
user UserSelectorArg
results List(DeleteSecondaryEmailResult)
example default
user = default
results = [default, not_found]
union UserDeleteResult
"Result of trying to delete a user's secondary emails.
'success' is the only value indicating that a user was successfully retrieved for deleting secondary emails.
The other values explain the type of error that occurred, and include the user for which the error occurred."
success UserDeleteEmailsResult
"Describes a user and the results for each attempt to delete a secondary email."
invalid_user UserSelectorArg
"Specified user is not a valid target for deleting secondary emails."
example default
success = default
example invalid_user
invalid_user = default
struct DeleteSecondaryEmailsResult
results List(UserDeleteResult)
example default
results = [default]
route members/secondary_emails/delete(DeleteSecondaryEmailsArg, DeleteSecondaryEmailsResult, Void)
"Delete secondary emails from users
Permission : Team member management.
Users will be notified of deletions of verified secondary emails at both the secondary email and their primary email."
attrs
auth = "team"
scope = "members.write"