-
Notifications
You must be signed in to change notification settings - Fork 32
/
invitation.go
458 lines (456 loc) · 18.4 KB
/
invitation.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
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
type Invitation struct {
Entity
}
// NewInvitation instantiates a new Invitation and sets the default values.
func NewInvitation()(*Invitation) {
m := &Invitation{
Entity: *NewEntity(),
}
return m
}
// CreateInvitationFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateInvitationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewInvitation(), nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *Invitation) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.Entity.GetFieldDeserializers()
res["invitedUser"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateUserFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetInvitedUser(val.(Userable))
}
return nil
}
res["invitedUserDisplayName"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetInvitedUserDisplayName(val)
}
return nil
}
res["invitedUserEmailAddress"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetInvitedUserEmailAddress(val)
}
return nil
}
res["invitedUserMessageInfo"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateInvitedUserMessageInfoFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetInvitedUserMessageInfo(val.(InvitedUserMessageInfoable))
}
return nil
}
res["invitedUserSponsors"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreateDirectoryObjectFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]DirectoryObjectable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(DirectoryObjectable)
}
}
m.SetInvitedUserSponsors(res)
}
return nil
}
res["invitedUserType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetInvitedUserType(val)
}
return nil
}
res["inviteRedeemUrl"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetInviteRedeemUrl(val)
}
return nil
}
res["inviteRedirectUrl"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetInviteRedirectUrl(val)
}
return nil
}
res["resetRedemption"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetResetRedemption(val)
}
return nil
}
res["sendInvitationMessage"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetSendInvitationMessage(val)
}
return nil
}
res["status"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetStatus(val)
}
return nil
}
return res
}
// GetInvitedUser gets the invitedUser property value. The user created as part of the invitation creation. Read-Only
// returns a Userable when successful
func (m *Invitation) GetInvitedUser()(Userable) {
val, err := m.GetBackingStore().Get("invitedUser")
if err != nil {
panic(err)
}
if val != nil {
return val.(Userable)
}
return nil
}
// GetInvitedUserDisplayName gets the invitedUserDisplayName property value. The display name of the user being invited.
// returns a *string when successful
func (m *Invitation) GetInvitedUserDisplayName()(*string) {
val, err := m.GetBackingStore().Get("invitedUserDisplayName")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetInvitedUserEmailAddress gets the invitedUserEmailAddress property value. The email address of the user being invited. Required. The following special characters aren't permitted in the email address:Tilde (~)Exclamation point (!)Number sign (#)Dollar sign ($)Percent (%)Circumflex (^)Ampersand (&)Asterisk (*)Parentheses (( ))Plus sign (+)Equal sign (=)Brackets ([ ])Braces ({ })Backslash (/)Slash mark (/)Pipe (/|)Semicolon (;)Colon (:)Quotation marks (')Angle brackets (< >)Question mark (?)Comma (,)However, the following exceptions apply:A period (.) or a hyphen (-) is permitted anywhere in the user name, except at the beginning or end of the name.An underscore (_) is permitted anywhere in the user name, including at the beginning or end of the name.
// returns a *string when successful
func (m *Invitation) GetInvitedUserEmailAddress()(*string) {
val, err := m.GetBackingStore().Get("invitedUserEmailAddress")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetInvitedUserMessageInfo gets the invitedUserMessageInfo property value. Additional configuration for the message being sent to the invited user, including customizing message text, language, and cc recipient list.
// returns a InvitedUserMessageInfoable when successful
func (m *Invitation) GetInvitedUserMessageInfo()(InvitedUserMessageInfoable) {
val, err := m.GetBackingStore().Get("invitedUserMessageInfo")
if err != nil {
panic(err)
}
if val != nil {
return val.(InvitedUserMessageInfoable)
}
return nil
}
// GetInvitedUserSponsors gets the invitedUserSponsors property value. The users or groups who are sponsors of the invited user. Sponsors are users and groups that are responsible for guest users' privileges in the tenant and for keeping the guest users' information and access up to date.
// returns a []DirectoryObjectable when successful
func (m *Invitation) GetInvitedUserSponsors()([]DirectoryObjectable) {
val, err := m.GetBackingStore().Get("invitedUserSponsors")
if err != nil {
panic(err)
}
if val != nil {
return val.([]DirectoryObjectable)
}
return nil
}
// GetInvitedUserType gets the invitedUserType property value. The userType of the user being invited. By default, this is Guest. You can invite as Member if you're a company administrator.
// returns a *string when successful
func (m *Invitation) GetInvitedUserType()(*string) {
val, err := m.GetBackingStore().Get("invitedUserType")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetInviteRedeemUrl gets the inviteRedeemUrl property value. The URL the user can use to redeem their invitation. Read-only.
// returns a *string when successful
func (m *Invitation) GetInviteRedeemUrl()(*string) {
val, err := m.GetBackingStore().Get("inviteRedeemUrl")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetInviteRedirectUrl gets the inviteRedirectUrl property value. The URL the user should be redirected to once the invitation is redeemed. Required.
// returns a *string when successful
func (m *Invitation) GetInviteRedirectUrl()(*string) {
val, err := m.GetBackingStore().Get("inviteRedirectUrl")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetResetRedemption gets the resetRedemption property value. Reset the user's redemption status and reinvite a user while retaining their user identifier, group memberships, and app assignments. This property allows you to enable a user to sign-in using a different email address from the one in the previous invitation. For more information about using this property, see Reset redemption status for a guest user.
// returns a *bool when successful
func (m *Invitation) GetResetRedemption()(*bool) {
val, err := m.GetBackingStore().Get("resetRedemption")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
}
// GetSendInvitationMessage gets the sendInvitationMessage property value. Indicates whether an email should be sent to the user being invited. The default is false.
// returns a *bool when successful
func (m *Invitation) GetSendInvitationMessage()(*bool) {
val, err := m.GetBackingStore().Get("sendInvitationMessage")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
}
// GetStatus gets the status property value. The status of the invitation. Possible values are: PendingAcceptance, Completed, InProgress, and Error.
// returns a *string when successful
func (m *Invitation) GetStatus()(*string) {
val, err := m.GetBackingStore().Get("status")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// Serialize serializes information the current object
func (m *Invitation) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Entity.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteObjectValue("invitedUser", m.GetInvitedUser())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("invitedUserDisplayName", m.GetInvitedUserDisplayName())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("invitedUserEmailAddress", m.GetInvitedUserEmailAddress())
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("invitedUserMessageInfo", m.GetInvitedUserMessageInfo())
if err != nil {
return err
}
}
if m.GetInvitedUserSponsors() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetInvitedUserSponsors()))
for i, v := range m.GetInvitedUserSponsors() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err = writer.WriteCollectionOfObjectValues("invitedUserSponsors", cast)
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("invitedUserType", m.GetInvitedUserType())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("inviteRedeemUrl", m.GetInviteRedeemUrl())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("inviteRedirectUrl", m.GetInviteRedirectUrl())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("resetRedemption", m.GetResetRedemption())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("sendInvitationMessage", m.GetSendInvitationMessage())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("status", m.GetStatus())
if err != nil {
return err
}
}
return nil
}
// SetInvitedUser sets the invitedUser property value. The user created as part of the invitation creation. Read-Only
func (m *Invitation) SetInvitedUser(value Userable)() {
err := m.GetBackingStore().Set("invitedUser", value)
if err != nil {
panic(err)
}
}
// SetInvitedUserDisplayName sets the invitedUserDisplayName property value. The display name of the user being invited.
func (m *Invitation) SetInvitedUserDisplayName(value *string)() {
err := m.GetBackingStore().Set("invitedUserDisplayName", value)
if err != nil {
panic(err)
}
}
// SetInvitedUserEmailAddress sets the invitedUserEmailAddress property value. The email address of the user being invited. Required. The following special characters aren't permitted in the email address:Tilde (~)Exclamation point (!)Number sign (#)Dollar sign ($)Percent (%)Circumflex (^)Ampersand (&)Asterisk (*)Parentheses (( ))Plus sign (+)Equal sign (=)Brackets ([ ])Braces ({ })Backslash (/)Slash mark (/)Pipe (/|)Semicolon (;)Colon (:)Quotation marks (')Angle brackets (< >)Question mark (?)Comma (,)However, the following exceptions apply:A period (.) or a hyphen (-) is permitted anywhere in the user name, except at the beginning or end of the name.An underscore (_) is permitted anywhere in the user name, including at the beginning or end of the name.
func (m *Invitation) SetInvitedUserEmailAddress(value *string)() {
err := m.GetBackingStore().Set("invitedUserEmailAddress", value)
if err != nil {
panic(err)
}
}
// SetInvitedUserMessageInfo sets the invitedUserMessageInfo property value. Additional configuration for the message being sent to the invited user, including customizing message text, language, and cc recipient list.
func (m *Invitation) SetInvitedUserMessageInfo(value InvitedUserMessageInfoable)() {
err := m.GetBackingStore().Set("invitedUserMessageInfo", value)
if err != nil {
panic(err)
}
}
// SetInvitedUserSponsors sets the invitedUserSponsors property value. The users or groups who are sponsors of the invited user. Sponsors are users and groups that are responsible for guest users' privileges in the tenant and for keeping the guest users' information and access up to date.
func (m *Invitation) SetInvitedUserSponsors(value []DirectoryObjectable)() {
err := m.GetBackingStore().Set("invitedUserSponsors", value)
if err != nil {
panic(err)
}
}
// SetInvitedUserType sets the invitedUserType property value. The userType of the user being invited. By default, this is Guest. You can invite as Member if you're a company administrator.
func (m *Invitation) SetInvitedUserType(value *string)() {
err := m.GetBackingStore().Set("invitedUserType", value)
if err != nil {
panic(err)
}
}
// SetInviteRedeemUrl sets the inviteRedeemUrl property value. The URL the user can use to redeem their invitation. Read-only.
func (m *Invitation) SetInviteRedeemUrl(value *string)() {
err := m.GetBackingStore().Set("inviteRedeemUrl", value)
if err != nil {
panic(err)
}
}
// SetInviteRedirectUrl sets the inviteRedirectUrl property value. The URL the user should be redirected to once the invitation is redeemed. Required.
func (m *Invitation) SetInviteRedirectUrl(value *string)() {
err := m.GetBackingStore().Set("inviteRedirectUrl", value)
if err != nil {
panic(err)
}
}
// SetResetRedemption sets the resetRedemption property value. Reset the user's redemption status and reinvite a user while retaining their user identifier, group memberships, and app assignments. This property allows you to enable a user to sign-in using a different email address from the one in the previous invitation. For more information about using this property, see Reset redemption status for a guest user.
func (m *Invitation) SetResetRedemption(value *bool)() {
err := m.GetBackingStore().Set("resetRedemption", value)
if err != nil {
panic(err)
}
}
// SetSendInvitationMessage sets the sendInvitationMessage property value. Indicates whether an email should be sent to the user being invited. The default is false.
func (m *Invitation) SetSendInvitationMessage(value *bool)() {
err := m.GetBackingStore().Set("sendInvitationMessage", value)
if err != nil {
panic(err)
}
}
// SetStatus sets the status property value. The status of the invitation. Possible values are: PendingAcceptance, Completed, InProgress, and Error.
func (m *Invitation) SetStatus(value *string)() {
err := m.GetBackingStore().Set("status", value)
if err != nil {
panic(err)
}
}
type Invitationable interface {
Entityable
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetInvitedUser()(Userable)
GetInvitedUserDisplayName()(*string)
GetInvitedUserEmailAddress()(*string)
GetInvitedUserMessageInfo()(InvitedUserMessageInfoable)
GetInvitedUserSponsors()([]DirectoryObjectable)
GetInvitedUserType()(*string)
GetInviteRedeemUrl()(*string)
GetInviteRedirectUrl()(*string)
GetResetRedemption()(*bool)
GetSendInvitationMessage()(*bool)
GetStatus()(*string)
SetInvitedUser(value Userable)()
SetInvitedUserDisplayName(value *string)()
SetInvitedUserEmailAddress(value *string)()
SetInvitedUserMessageInfo(value InvitedUserMessageInfoable)()
SetInvitedUserSponsors(value []DirectoryObjectable)()
SetInvitedUserType(value *string)()
SetInviteRedeemUrl(value *string)()
SetInviteRedirectUrl(value *string)()
SetResetRedemption(value *bool)()
SetSendInvitationMessage(value *bool)()
SetStatus(value *string)()
}