-
Notifications
You must be signed in to change notification settings - Fork 4
/
model_update_settings_flow_body.go
367 lines (311 loc) · 14.4 KB
/
model_update_settings_flow_body.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
/*
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
API version: v1.11.7
Contact: support@ory.sh
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
"fmt"
)
// UpdateSettingsFlowBody - Update Settings Flow Request Body
type UpdateSettingsFlowBody struct {
UpdateSettingsFlowWithLookupMethod *UpdateSettingsFlowWithLookupMethod
UpdateSettingsFlowWithOidcMethod *UpdateSettingsFlowWithOidcMethod
UpdateSettingsFlowWithPasskeyMethod *UpdateSettingsFlowWithPasskeyMethod
UpdateSettingsFlowWithPasswordMethod *UpdateSettingsFlowWithPasswordMethod
UpdateSettingsFlowWithProfileMethod *UpdateSettingsFlowWithProfileMethod
UpdateSettingsFlowWithTotpMethod *UpdateSettingsFlowWithTotpMethod
UpdateSettingsFlowWithWebAuthnMethod *UpdateSettingsFlowWithWebAuthnMethod
}
// UpdateSettingsFlowWithLookupMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithLookupMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithLookupMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithLookupMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithLookupMethod: v,
}
}
// UpdateSettingsFlowWithOidcMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithOidcMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithOidcMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithOidcMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithOidcMethod: v,
}
}
// UpdateSettingsFlowWithPasskeyMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithPasskeyMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithPasskeyMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithPasskeyMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithPasskeyMethod: v,
}
}
// UpdateSettingsFlowWithPasswordMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithPasswordMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithPasswordMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithPasswordMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithPasswordMethod: v,
}
}
// UpdateSettingsFlowWithProfileMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithProfileMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithProfileMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithProfileMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithProfileMethod: v,
}
}
// UpdateSettingsFlowWithTotpMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithTotpMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithTotpMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithTotpMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithTotpMethod: v,
}
}
// UpdateSettingsFlowWithWebAuthnMethodAsUpdateSettingsFlowBody is a convenience function that returns UpdateSettingsFlowWithWebAuthnMethod wrapped in UpdateSettingsFlowBody
func UpdateSettingsFlowWithWebAuthnMethodAsUpdateSettingsFlowBody(v *UpdateSettingsFlowWithWebAuthnMethod) UpdateSettingsFlowBody {
return UpdateSettingsFlowBody{
UpdateSettingsFlowWithWebAuthnMethod: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *UpdateSettingsFlowBody) UnmarshalJSON(data []byte) error {
var err error
// use discriminator value to speed up the lookup
var jsonDict map[string]interface{}
err = newStrictDecoder(data).Decode(&jsonDict)
if err != nil {
return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup")
}
// check if the discriminator value is 'lookup_secret'
if jsonDict["method"] == "lookup_secret" {
// try to unmarshal JSON data into UpdateSettingsFlowWithLookupMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithLookupMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithLookupMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithLookupMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithLookupMethod: %s", err.Error())
}
}
// check if the discriminator value is 'oidc'
if jsonDict["method"] == "oidc" {
// try to unmarshal JSON data into UpdateSettingsFlowWithOidcMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithOidcMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithOidcMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithOidcMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithOidcMethod: %s", err.Error())
}
}
// check if the discriminator value is 'passkey'
if jsonDict["method"] == "passkey" {
// try to unmarshal JSON data into UpdateSettingsFlowWithPasskeyMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithPasskeyMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithPasskeyMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithPasskeyMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithPasskeyMethod: %s", err.Error())
}
}
// check if the discriminator value is 'password'
if jsonDict["method"] == "password" {
// try to unmarshal JSON data into UpdateSettingsFlowWithPasswordMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithPasswordMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithPasswordMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithPasswordMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithPasswordMethod: %s", err.Error())
}
}
// check if the discriminator value is 'profile'
if jsonDict["method"] == "profile" {
// try to unmarshal JSON data into UpdateSettingsFlowWithProfileMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithProfileMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithProfileMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithProfileMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithProfileMethod: %s", err.Error())
}
}
// check if the discriminator value is 'totp'
if jsonDict["method"] == "totp" {
// try to unmarshal JSON data into UpdateSettingsFlowWithTotpMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithTotpMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithTotpMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithTotpMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithTotpMethod: %s", err.Error())
}
}
// check if the discriminator value is 'webauthn'
if jsonDict["method"] == "webauthn" {
// try to unmarshal JSON data into UpdateSettingsFlowWithWebAuthnMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithWebAuthnMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithWebAuthnMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithWebAuthnMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithWebAuthnMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithLookupMethod'
if jsonDict["method"] == "updateSettingsFlowWithLookupMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithLookupMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithLookupMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithLookupMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithLookupMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithLookupMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithOidcMethod'
if jsonDict["method"] == "updateSettingsFlowWithOidcMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithOidcMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithOidcMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithOidcMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithOidcMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithOidcMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithPasskeyMethod'
if jsonDict["method"] == "updateSettingsFlowWithPasskeyMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithPasskeyMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithPasskeyMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithPasskeyMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithPasskeyMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithPasskeyMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithPasswordMethod'
if jsonDict["method"] == "updateSettingsFlowWithPasswordMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithPasswordMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithPasswordMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithPasswordMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithPasswordMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithPasswordMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithProfileMethod'
if jsonDict["method"] == "updateSettingsFlowWithProfileMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithProfileMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithProfileMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithProfileMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithProfileMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithProfileMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithTotpMethod'
if jsonDict["method"] == "updateSettingsFlowWithTotpMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithTotpMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithTotpMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithTotpMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithTotpMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithTotpMethod: %s", err.Error())
}
}
// check if the discriminator value is 'updateSettingsFlowWithWebAuthnMethod'
if jsonDict["method"] == "updateSettingsFlowWithWebAuthnMethod" {
// try to unmarshal JSON data into UpdateSettingsFlowWithWebAuthnMethod
err = json.Unmarshal(data, &dst.UpdateSettingsFlowWithWebAuthnMethod)
if err == nil {
return nil // data stored in dst.UpdateSettingsFlowWithWebAuthnMethod, return on the first match
} else {
dst.UpdateSettingsFlowWithWebAuthnMethod = nil
return fmt.Errorf("failed to unmarshal UpdateSettingsFlowBody as UpdateSettingsFlowWithWebAuthnMethod: %s", err.Error())
}
}
return nil
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src UpdateSettingsFlowBody) MarshalJSON() ([]byte, error) {
if src.UpdateSettingsFlowWithLookupMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithLookupMethod)
}
if src.UpdateSettingsFlowWithOidcMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithOidcMethod)
}
if src.UpdateSettingsFlowWithPasskeyMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithPasskeyMethod)
}
if src.UpdateSettingsFlowWithPasswordMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithPasswordMethod)
}
if src.UpdateSettingsFlowWithProfileMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithProfileMethod)
}
if src.UpdateSettingsFlowWithTotpMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithTotpMethod)
}
if src.UpdateSettingsFlowWithWebAuthnMethod != nil {
return json.Marshal(&src.UpdateSettingsFlowWithWebAuthnMethod)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *UpdateSettingsFlowBody) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.UpdateSettingsFlowWithLookupMethod != nil {
return obj.UpdateSettingsFlowWithLookupMethod
}
if obj.UpdateSettingsFlowWithOidcMethod != nil {
return obj.UpdateSettingsFlowWithOidcMethod
}
if obj.UpdateSettingsFlowWithPasskeyMethod != nil {
return obj.UpdateSettingsFlowWithPasskeyMethod
}
if obj.UpdateSettingsFlowWithPasswordMethod != nil {
return obj.UpdateSettingsFlowWithPasswordMethod
}
if obj.UpdateSettingsFlowWithProfileMethod != nil {
return obj.UpdateSettingsFlowWithProfileMethod
}
if obj.UpdateSettingsFlowWithTotpMethod != nil {
return obj.UpdateSettingsFlowWithTotpMethod
}
if obj.UpdateSettingsFlowWithWebAuthnMethod != nil {
return obj.UpdateSettingsFlowWithWebAuthnMethod
}
// all schemas are nil
return nil
}
type NullableUpdateSettingsFlowBody struct {
value *UpdateSettingsFlowBody
isSet bool
}
func (v NullableUpdateSettingsFlowBody) Get() *UpdateSettingsFlowBody {
return v.value
}
func (v *NullableUpdateSettingsFlowBody) Set(val *UpdateSettingsFlowBody) {
v.value = val
v.isSet = true
}
func (v NullableUpdateSettingsFlowBody) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateSettingsFlowBody) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateSettingsFlowBody(val *UpdateSettingsFlowBody) *NullableUpdateSettingsFlowBody {
return &NullableUpdateSettingsFlowBody{value: val, isSet: true}
}
func (v NullableUpdateSettingsFlowBody) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateSettingsFlowBody) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}