-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmodel_device_authorization.go
347 lines (286 loc) · 10.1 KB
/
model_device_authorization.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
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
API version: v2.4.0-alpha.1
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
)
// checks if the DeviceAuthorization type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DeviceAuthorization{}
// DeviceAuthorization # Ory's OAuth 2.0 Device Authorization API
type DeviceAuthorization struct {
// The device verification code.
DeviceCode *string `json:"device_code,omitempty"`
// The lifetime in seconds of the \"device_code\" and \"user_code\".
ExpiresIn *int64 `json:"expires_in,omitempty"`
// The minimum amount of time in seconds that the client SHOULD wait between polling requests to the token endpoint. If no value is provided, clients MUST use 5 as the default.
Interval *int64 `json:"interval,omitempty"`
// The end-user verification code.
UserCode *string `json:"user_code,omitempty"`
// The end-user verification URI on the authorization server. The URI should be short and easy to remember as end users will be asked to manually type it into their user agent.
VerificationUri *string `json:"verification_uri,omitempty"`
// A verification URI that includes the \"user_code\" (or other information with the same function as the \"user_code\"), which is designed for non-textual transmission.
VerificationUriComplete *string `json:"verification_uri_complete,omitempty"`
AdditionalProperties map[string]interface{}
}
type _DeviceAuthorization DeviceAuthorization
// NewDeviceAuthorization instantiates a new DeviceAuthorization object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewDeviceAuthorization() *DeviceAuthorization {
this := DeviceAuthorization{}
return &this
}
// NewDeviceAuthorizationWithDefaults instantiates a new DeviceAuthorization object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewDeviceAuthorizationWithDefaults() *DeviceAuthorization {
this := DeviceAuthorization{}
return &this
}
// GetDeviceCode returns the DeviceCode field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetDeviceCode() string {
if o == nil || IsNil(o.DeviceCode) {
var ret string
return ret
}
return *o.DeviceCode
}
// GetDeviceCodeOk returns a tuple with the DeviceCode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetDeviceCodeOk() (*string, bool) {
if o == nil || IsNil(o.DeviceCode) {
return nil, false
}
return o.DeviceCode, true
}
// HasDeviceCode returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasDeviceCode() bool {
if o != nil && !IsNil(o.DeviceCode) {
return true
}
return false
}
// SetDeviceCode gets a reference to the given string and assigns it to the DeviceCode field.
func (o *DeviceAuthorization) SetDeviceCode(v string) {
o.DeviceCode = &v
}
// GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetExpiresIn() int64 {
if o == nil || IsNil(o.ExpiresIn) {
var ret int64
return ret
}
return *o.ExpiresIn
}
// GetExpiresInOk returns a tuple with the ExpiresIn field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetExpiresInOk() (*int64, bool) {
if o == nil || IsNil(o.ExpiresIn) {
return nil, false
}
return o.ExpiresIn, true
}
// HasExpiresIn returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasExpiresIn() bool {
if o != nil && !IsNil(o.ExpiresIn) {
return true
}
return false
}
// SetExpiresIn gets a reference to the given int64 and assigns it to the ExpiresIn field.
func (o *DeviceAuthorization) SetExpiresIn(v int64) {
o.ExpiresIn = &v
}
// GetInterval returns the Interval field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetInterval() int64 {
if o == nil || IsNil(o.Interval) {
var ret int64
return ret
}
return *o.Interval
}
// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetIntervalOk() (*int64, bool) {
if o == nil || IsNil(o.Interval) {
return nil, false
}
return o.Interval, true
}
// HasInterval returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasInterval() bool {
if o != nil && !IsNil(o.Interval) {
return true
}
return false
}
// SetInterval gets a reference to the given int64 and assigns it to the Interval field.
func (o *DeviceAuthorization) SetInterval(v int64) {
o.Interval = &v
}
// GetUserCode returns the UserCode field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetUserCode() string {
if o == nil || IsNil(o.UserCode) {
var ret string
return ret
}
return *o.UserCode
}
// GetUserCodeOk returns a tuple with the UserCode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetUserCodeOk() (*string, bool) {
if o == nil || IsNil(o.UserCode) {
return nil, false
}
return o.UserCode, true
}
// HasUserCode returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasUserCode() bool {
if o != nil && !IsNil(o.UserCode) {
return true
}
return false
}
// SetUserCode gets a reference to the given string and assigns it to the UserCode field.
func (o *DeviceAuthorization) SetUserCode(v string) {
o.UserCode = &v
}
// GetVerificationUri returns the VerificationUri field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetVerificationUri() string {
if o == nil || IsNil(o.VerificationUri) {
var ret string
return ret
}
return *o.VerificationUri
}
// GetVerificationUriOk returns a tuple with the VerificationUri field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetVerificationUriOk() (*string, bool) {
if o == nil || IsNil(o.VerificationUri) {
return nil, false
}
return o.VerificationUri, true
}
// HasVerificationUri returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasVerificationUri() bool {
if o != nil && !IsNil(o.VerificationUri) {
return true
}
return false
}
// SetVerificationUri gets a reference to the given string and assigns it to the VerificationUri field.
func (o *DeviceAuthorization) SetVerificationUri(v string) {
o.VerificationUri = &v
}
// GetVerificationUriComplete returns the VerificationUriComplete field value if set, zero value otherwise.
func (o *DeviceAuthorization) GetVerificationUriComplete() string {
if o == nil || IsNil(o.VerificationUriComplete) {
var ret string
return ret
}
return *o.VerificationUriComplete
}
// GetVerificationUriCompleteOk returns a tuple with the VerificationUriComplete field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceAuthorization) GetVerificationUriCompleteOk() (*string, bool) {
if o == nil || IsNil(o.VerificationUriComplete) {
return nil, false
}
return o.VerificationUriComplete, true
}
// HasVerificationUriComplete returns a boolean if a field has been set.
func (o *DeviceAuthorization) HasVerificationUriComplete() bool {
if o != nil && !IsNil(o.VerificationUriComplete) {
return true
}
return false
}
// SetVerificationUriComplete gets a reference to the given string and assigns it to the VerificationUriComplete field.
func (o *DeviceAuthorization) SetVerificationUriComplete(v string) {
o.VerificationUriComplete = &v
}
func (o DeviceAuthorization) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DeviceAuthorization) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.DeviceCode) {
toSerialize["device_code"] = o.DeviceCode
}
if !IsNil(o.ExpiresIn) {
toSerialize["expires_in"] = o.ExpiresIn
}
if !IsNil(o.Interval) {
toSerialize["interval"] = o.Interval
}
if !IsNil(o.UserCode) {
toSerialize["user_code"] = o.UserCode
}
if !IsNil(o.VerificationUri) {
toSerialize["verification_uri"] = o.VerificationUri
}
if !IsNil(o.VerificationUriComplete) {
toSerialize["verification_uri_complete"] = o.VerificationUriComplete
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *DeviceAuthorization) UnmarshalJSON(data []byte) (err error) {
varDeviceAuthorization := _DeviceAuthorization{}
err = json.Unmarshal(data, &varDeviceAuthorization)
if err != nil {
return err
}
*o = DeviceAuthorization(varDeviceAuthorization)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "device_code")
delete(additionalProperties, "expires_in")
delete(additionalProperties, "interval")
delete(additionalProperties, "user_code")
delete(additionalProperties, "verification_uri")
delete(additionalProperties, "verification_uri_complete")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableDeviceAuthorization struct {
value *DeviceAuthorization
isSet bool
}
func (v NullableDeviceAuthorization) Get() *DeviceAuthorization {
return v.value
}
func (v *NullableDeviceAuthorization) Set(val *DeviceAuthorization) {
v.value = val
v.isSet = true
}
func (v NullableDeviceAuthorization) IsSet() bool {
return v.isSet
}
func (v *NullableDeviceAuthorization) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDeviceAuthorization(val *DeviceAuthorization) *NullableDeviceAuthorization {
return &NullableDeviceAuthorization{value: val, isSet: true}
}
func (v NullableDeviceAuthorization) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDeviceAuthorization) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}