-
Notifications
You must be signed in to change notification settings - Fork 3
/
connect_webviews.go
419 lines (378 loc) · 14.8 KB
/
connect_webviews.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
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/seamapi/go/core"
)
type ConnectWebviewsCreateRequest struct {
DeviceSelectionMode *SelectionMode `json:"device_selection_mode,omitempty" url:"device_selection_mode,omitempty"`
CustomRedirectUrl *string `json:"custom_redirect_url,omitempty" url:"custom_redirect_url,omitempty"`
CustomRedirectFailureUrl *string `json:"custom_redirect_failure_url,omitempty" url:"custom_redirect_failure_url,omitempty"`
AcceptedProviders []AcceptedProvider `json:"accepted_providers,omitempty" url:"accepted_providers,omitempty"`
ProviderCategory *ProviderCategory `json:"provider_category,omitempty" url:"provider_category,omitempty"`
CustomMetadata map[string]*ConnectWebviewsCreateRequestCustomMetadataValue `json:"custom_metadata,omitempty" url:"custom_metadata,omitempty"`
AutomaticallyManageNewDevices *bool `json:"automatically_manage_new_devices,omitempty" url:"automatically_manage_new_devices,omitempty"`
WaitForDeviceCreation *bool `json:"wait_for_device_creation,omitempty" url:"wait_for_device_creation,omitempty"`
}
type ConnectWebviewsDeleteRequest struct {
ConnectWebviewId string `json:"connect_webview_id" url:"connect_webview_id"`
}
type ConnectWebviewsGetRequest struct {
ConnectWebviewId string `json:"connect_webview_id" url:"connect_webview_id"`
}
type ConnectWebviewsListRequest struct {
UserIdentifierKey *string `json:"user_identifier_key,omitempty" url:"user_identifier_key,omitempty"`
// Returns devices where the webview's custom_metadata contains all of the provided key/value pairs.
CustomMetadataHas map[string]*ConnectWebviewsListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty" url:"custom_metadata_has,omitempty"`
}
type AcceptedProvider string
const (
AcceptedProviderAkuvox AcceptedProvider = "akuvox"
AcceptedProviderAugust AcceptedProvider = "august"
AcceptedProviderAvigilonAlta AcceptedProvider = "avigilon_alta"
AcceptedProviderBrivo AcceptedProvider = "brivo"
AcceptedProviderButterflymx AcceptedProvider = "butterflymx"
AcceptedProviderSchlage AcceptedProvider = "schlage"
AcceptedProviderSmartthings AcceptedProvider = "smartthings"
AcceptedProviderYale AcceptedProvider = "yale"
AcceptedProviderGenie AcceptedProvider = "genie"
AcceptedProviderDoorking AcceptedProvider = "doorking"
AcceptedProviderSalto AcceptedProvider = "salto"
AcceptedProviderLockly AcceptedProvider = "lockly"
AcceptedProviderTtlock AcceptedProvider = "ttlock"
AcceptedProviderLinear AcceptedProvider = "linear"
AcceptedProviderNoiseaware AcceptedProvider = "noiseaware"
AcceptedProviderNuki AcceptedProvider = "nuki"
AcceptedProviderSeamRelayAdmin AcceptedProvider = "seam_relay_admin"
AcceptedProviderIgloo AcceptedProvider = "igloo"
AcceptedProviderKwikset AcceptedProvider = "kwikset"
AcceptedProviderMinut AcceptedProvider = "minut"
AcceptedProviderMy2N AcceptedProvider = "my_2n"
AcceptedProviderControlbyweb AcceptedProvider = "controlbyweb"
AcceptedProviderNest AcceptedProvider = "nest"
AcceptedProviderIgloohome AcceptedProvider = "igloohome"
AcceptedProviderEcobee AcceptedProvider = "ecobee"
AcceptedProviderHubitat AcceptedProvider = "hubitat"
AcceptedProviderFourSuites AcceptedProvider = "four_suites"
AcceptedProviderDormakabaOracode AcceptedProvider = "dormakaba_oracode"
AcceptedProviderPti AcceptedProvider = "pti"
AcceptedProviderWyze AcceptedProvider = "wyze"
AcceptedProviderSeamPassport AcceptedProvider = "seam_passport"
AcceptedProviderVisionline AcceptedProvider = "visionline"
AcceptedProviderAssaAbloyCredentialService AcceptedProvider = "assa_abloy_credential_service"
AcceptedProviderSeamBridge AcceptedProvider = "seam_bridge"
AcceptedProviderTedee AcceptedProvider = "tedee"
AcceptedProviderHoneywellResideo AcceptedProvider = "honeywell_resideo"
AcceptedProviderLatch AcceptedProvider = "latch"
AcceptedProviderYaleAccess AcceptedProvider = "yale_access"
AcceptedProviderHidCm AcceptedProvider = "hid_cm"
AcceptedProviderGoogleNest AcceptedProvider = "google_nest"
)
func NewAcceptedProviderFromString(s string) (AcceptedProvider, error) {
switch s {
case "akuvox":
return AcceptedProviderAkuvox, nil
case "august":
return AcceptedProviderAugust, nil
case "avigilon_alta":
return AcceptedProviderAvigilonAlta, nil
case "brivo":
return AcceptedProviderBrivo, nil
case "butterflymx":
return AcceptedProviderButterflymx, nil
case "schlage":
return AcceptedProviderSchlage, nil
case "smartthings":
return AcceptedProviderSmartthings, nil
case "yale":
return AcceptedProviderYale, nil
case "genie":
return AcceptedProviderGenie, nil
case "doorking":
return AcceptedProviderDoorking, nil
case "salto":
return AcceptedProviderSalto, nil
case "lockly":
return AcceptedProviderLockly, nil
case "ttlock":
return AcceptedProviderTtlock, nil
case "linear":
return AcceptedProviderLinear, nil
case "noiseaware":
return AcceptedProviderNoiseaware, nil
case "nuki":
return AcceptedProviderNuki, nil
case "seam_relay_admin":
return AcceptedProviderSeamRelayAdmin, nil
case "igloo":
return AcceptedProviderIgloo, nil
case "kwikset":
return AcceptedProviderKwikset, nil
case "minut":
return AcceptedProviderMinut, nil
case "my_2n":
return AcceptedProviderMy2N, nil
case "controlbyweb":
return AcceptedProviderControlbyweb, nil
case "nest":
return AcceptedProviderNest, nil
case "igloohome":
return AcceptedProviderIgloohome, nil
case "ecobee":
return AcceptedProviderEcobee, nil
case "hubitat":
return AcceptedProviderHubitat, nil
case "four_suites":
return AcceptedProviderFourSuites, nil
case "dormakaba_oracode":
return AcceptedProviderDormakabaOracode, nil
case "pti":
return AcceptedProviderPti, nil
case "wyze":
return AcceptedProviderWyze, nil
case "seam_passport":
return AcceptedProviderSeamPassport, nil
case "visionline":
return AcceptedProviderVisionline, nil
case "assa_abloy_credential_service":
return AcceptedProviderAssaAbloyCredentialService, nil
case "seam_bridge":
return AcceptedProviderSeamBridge, nil
case "tedee":
return AcceptedProviderTedee, nil
case "honeywell_resideo":
return AcceptedProviderHoneywellResideo, nil
case "latch":
return AcceptedProviderLatch, nil
case "yale_access":
return AcceptedProviderYaleAccess, nil
case "hid_cm":
return AcceptedProviderHidCm, nil
case "google_nest":
return AcceptedProviderGoogleNest, nil
}
var t AcceptedProvider
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (a AcceptedProvider) Ptr() *AcceptedProvider {
return &a
}
type ConnectWebviewsCreateRequestCustomMetadataValue struct {
typeName string
String string
Boolean bool
StringOptional *string
}
func NewConnectWebviewsCreateRequestCustomMetadataValueFromString(value string) *ConnectWebviewsCreateRequestCustomMetadataValue {
return &ConnectWebviewsCreateRequestCustomMetadataValue{typeName: "string", String: value}
}
func NewConnectWebviewsCreateRequestCustomMetadataValueFromBoolean(value bool) *ConnectWebviewsCreateRequestCustomMetadataValue {
return &ConnectWebviewsCreateRequestCustomMetadataValue{typeName: "boolean", Boolean: value}
}
func NewConnectWebviewsCreateRequestCustomMetadataValueFromStringOptional(value *string) *ConnectWebviewsCreateRequestCustomMetadataValue {
return &ConnectWebviewsCreateRequestCustomMetadataValue{typeName: "stringOptional", StringOptional: value}
}
func (c *ConnectWebviewsCreateRequestCustomMetadataValue) UnmarshalJSON(data []byte) error {
var valueString string
if err := json.Unmarshal(data, &valueString); err == nil {
c.typeName = "string"
c.String = valueString
return nil
}
var valueBoolean bool
if err := json.Unmarshal(data, &valueBoolean); err == nil {
c.typeName = "boolean"
c.Boolean = valueBoolean
return nil
}
var valueStringOptional *string
if err := json.Unmarshal(data, &valueStringOptional); err == nil {
c.typeName = "stringOptional"
c.StringOptional = valueStringOptional
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}
func (c ConnectWebviewsCreateRequestCustomMetadataValue) MarshalJSON() ([]byte, error) {
switch c.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "string":
return json.Marshal(c.String)
case "boolean":
return json.Marshal(c.Boolean)
case "stringOptional":
return json.Marshal(c.StringOptional)
}
}
type ConnectWebviewsCreateRequestCustomMetadataValueVisitor interface {
VisitString(string) error
VisitBoolean(bool) error
VisitStringOptional(*string) error
}
func (c *ConnectWebviewsCreateRequestCustomMetadataValue) Accept(visitor ConnectWebviewsCreateRequestCustomMetadataValueVisitor) error {
switch c.typeName {
default:
return fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "string":
return visitor.VisitString(c.String)
case "boolean":
return visitor.VisitBoolean(c.Boolean)
case "stringOptional":
return visitor.VisitStringOptional(c.StringOptional)
}
}
type ConnectWebviewsCreateResponse struct {
ConnectWebview *ConnectWebview `json:"connect_webview,omitempty" url:"connect_webview,omitempty"`
Ok bool `json:"ok" url:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectWebviewsCreateResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectWebviewsCreateResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectWebviewsCreateResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectWebviewsCreateResponse) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type ConnectWebviewsDeleteResponse struct {
Ok bool `json:"ok" url:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectWebviewsDeleteResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectWebviewsDeleteResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectWebviewsDeleteResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectWebviewsDeleteResponse) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type ConnectWebviewsGetResponse struct {
ConnectWebview *ConnectWebview `json:"connect_webview,omitempty" url:"connect_webview,omitempty"`
Ok bool `json:"ok" url:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectWebviewsGetResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectWebviewsGetResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectWebviewsGetResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectWebviewsGetResponse) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type ConnectWebviewsListRequestCustomMetadataHasValue struct {
typeName string
String string
Boolean bool
}
func NewConnectWebviewsListRequestCustomMetadataHasValueFromString(value string) *ConnectWebviewsListRequestCustomMetadataHasValue {
return &ConnectWebviewsListRequestCustomMetadataHasValue{typeName: "string", String: value}
}
func NewConnectWebviewsListRequestCustomMetadataHasValueFromBoolean(value bool) *ConnectWebviewsListRequestCustomMetadataHasValue {
return &ConnectWebviewsListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value}
}
func (c *ConnectWebviewsListRequestCustomMetadataHasValue) UnmarshalJSON(data []byte) error {
var valueString string
if err := json.Unmarshal(data, &valueString); err == nil {
c.typeName = "string"
c.String = valueString
return nil
}
var valueBoolean bool
if err := json.Unmarshal(data, &valueBoolean); err == nil {
c.typeName = "boolean"
c.Boolean = valueBoolean
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}
func (c ConnectWebviewsListRequestCustomMetadataHasValue) MarshalJSON() ([]byte, error) {
switch c.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "string":
return json.Marshal(c.String)
case "boolean":
return json.Marshal(c.Boolean)
}
}
type ConnectWebviewsListRequestCustomMetadataHasValueVisitor interface {
VisitString(string) error
VisitBoolean(bool) error
}
func (c *ConnectWebviewsListRequestCustomMetadataHasValue) Accept(visitor ConnectWebviewsListRequestCustomMetadataHasValueVisitor) error {
switch c.typeName {
default:
return fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "string":
return visitor.VisitString(c.String)
case "boolean":
return visitor.VisitBoolean(c.Boolean)
}
}
type ConnectWebviewsListResponse struct {
ConnectWebviews []*ConnectWebview `json:"connect_webviews,omitempty" url:"connect_webviews,omitempty"`
Ok bool `json:"ok" url:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectWebviewsListResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectWebviewsListResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectWebviewsListResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectWebviewsListResponse) String() string {
if len(c._rawJSON) > 0 {
if value, err := core.StringifyJSON(c._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}