forked from seamapi/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
connected_accounts.go
347 lines (303 loc) · 11.6 KB
/
connected_accounts.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
// 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 ConnectedAccountsDeleteRequest struct {
ConnectedAccountId string `json:"connected_account_id"`
Sync *bool `json:"sync,omitempty"`
}
type ConnectedAccountsListRequest struct {
// Returns devices where the account's custom_metadata contains all of the provided key/value pairs.
CustomMetadataHas map[string]*ConnectedAccountsListRequestCustomMetadataHasValue `json:"custom_metadata_has,omitempty"`
}
type ConnectedAccountsDeleteResponse struct {
Ok bool `json:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectedAccountsDeleteResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectedAccountsDeleteResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectedAccountsDeleteResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectedAccountsDeleteResponse) 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 ConnectedAccountsGetRequest struct {
typeName string
ConnectedAccountsGetRequestConnectedAccountId *ConnectedAccountsGetRequestConnectedAccountId
ConnectedAccountsGetRequestEmail *ConnectedAccountsGetRequestEmail
}
func NewConnectedAccountsGetRequestFromConnectedAccountsGetRequestConnectedAccountId(value *ConnectedAccountsGetRequestConnectedAccountId) *ConnectedAccountsGetRequest {
return &ConnectedAccountsGetRequest{typeName: "connectedAccountsGetRequestConnectedAccountId", ConnectedAccountsGetRequestConnectedAccountId: value}
}
func NewConnectedAccountsGetRequestFromConnectedAccountsGetRequestEmail(value *ConnectedAccountsGetRequestEmail) *ConnectedAccountsGetRequest {
return &ConnectedAccountsGetRequest{typeName: "connectedAccountsGetRequestEmail", ConnectedAccountsGetRequestEmail: value}
}
func (c *ConnectedAccountsGetRequest) UnmarshalJSON(data []byte) error {
valueConnectedAccountsGetRequestConnectedAccountId := new(ConnectedAccountsGetRequestConnectedAccountId)
if err := json.Unmarshal(data, &valueConnectedAccountsGetRequestConnectedAccountId); err == nil {
c.typeName = "connectedAccountsGetRequestConnectedAccountId"
c.ConnectedAccountsGetRequestConnectedAccountId = valueConnectedAccountsGetRequestConnectedAccountId
return nil
}
valueConnectedAccountsGetRequestEmail := new(ConnectedAccountsGetRequestEmail)
if err := json.Unmarshal(data, &valueConnectedAccountsGetRequestEmail); err == nil {
c.typeName = "connectedAccountsGetRequestEmail"
c.ConnectedAccountsGetRequestEmail = valueConnectedAccountsGetRequestEmail
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}
func (c ConnectedAccountsGetRequest) MarshalJSON() ([]byte, error) {
switch c.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "connectedAccountsGetRequestConnectedAccountId":
return json.Marshal(c.ConnectedAccountsGetRequestConnectedAccountId)
case "connectedAccountsGetRequestEmail":
return json.Marshal(c.ConnectedAccountsGetRequestEmail)
}
}
type ConnectedAccountsGetRequestVisitor interface {
VisitConnectedAccountsGetRequestConnectedAccountId(*ConnectedAccountsGetRequestConnectedAccountId) error
VisitConnectedAccountsGetRequestEmail(*ConnectedAccountsGetRequestEmail) error
}
func (c *ConnectedAccountsGetRequest) Accept(visitor ConnectedAccountsGetRequestVisitor) error {
switch c.typeName {
default:
return fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "connectedAccountsGetRequestConnectedAccountId":
return visitor.VisitConnectedAccountsGetRequestConnectedAccountId(c.ConnectedAccountsGetRequestConnectedAccountId)
case "connectedAccountsGetRequestEmail":
return visitor.VisitConnectedAccountsGetRequestEmail(c.ConnectedAccountsGetRequestEmail)
}
}
type ConnectedAccountsGetResponse struct {
ConnectedAccount *ConnectedAccount `json:"connected_account,omitempty"`
Ok bool `json:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectedAccountsGetResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectedAccountsGetResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectedAccountsGetResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectedAccountsGetResponse) 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 ConnectedAccountsListRequestCustomMetadataHasValue struct {
typeName string
String string
Boolean bool
StringOptional *string
}
func NewConnectedAccountsListRequestCustomMetadataHasValueFromString(value string) *ConnectedAccountsListRequestCustomMetadataHasValue {
return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "string", String: value}
}
func NewConnectedAccountsListRequestCustomMetadataHasValueFromBoolean(value bool) *ConnectedAccountsListRequestCustomMetadataHasValue {
return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "boolean", Boolean: value}
}
func NewConnectedAccountsListRequestCustomMetadataHasValueFromStringOptional(value *string) *ConnectedAccountsListRequestCustomMetadataHasValue {
return &ConnectedAccountsListRequestCustomMetadataHasValue{typeName: "stringOptional", StringOptional: value}
}
func (c *ConnectedAccountsListRequestCustomMetadataHasValue) 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 ConnectedAccountsListRequestCustomMetadataHasValue) 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 ConnectedAccountsListRequestCustomMetadataHasValueVisitor interface {
VisitString(string) error
VisitBoolean(bool) error
VisitStringOptional(*string) error
}
func (c *ConnectedAccountsListRequestCustomMetadataHasValue) Accept(visitor ConnectedAccountsListRequestCustomMetadataHasValueVisitor) 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 ConnectedAccountsListResponse struct {
ConnectedAccounts []*ConnectedAccount `json:"connected_accounts,omitempty"`
Ok bool `json:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectedAccountsListResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectedAccountsListResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectedAccountsListResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectedAccountsListResponse) 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 ConnectedAccountsUpdateRequestCustomMetadataValue struct {
typeName string
String string
Boolean bool
StringOptional *string
}
func NewConnectedAccountsUpdateRequestCustomMetadataValueFromString(value string) *ConnectedAccountsUpdateRequestCustomMetadataValue {
return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "string", String: value}
}
func NewConnectedAccountsUpdateRequestCustomMetadataValueFromBoolean(value bool) *ConnectedAccountsUpdateRequestCustomMetadataValue {
return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "boolean", Boolean: value}
}
func NewConnectedAccountsUpdateRequestCustomMetadataValueFromStringOptional(value *string) *ConnectedAccountsUpdateRequestCustomMetadataValue {
return &ConnectedAccountsUpdateRequestCustomMetadataValue{typeName: "stringOptional", StringOptional: value}
}
func (c *ConnectedAccountsUpdateRequestCustomMetadataValue) 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 ConnectedAccountsUpdateRequestCustomMetadataValue) 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 ConnectedAccountsUpdateRequestCustomMetadataValueVisitor interface {
VisitString(string) error
VisitBoolean(bool) error
VisitStringOptional(*string) error
}
func (c *ConnectedAccountsUpdateRequestCustomMetadataValue) Accept(visitor ConnectedAccountsUpdateRequestCustomMetadataValueVisitor) 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 ConnectedAccountsUpdateResponse struct {
ConnectedAccount *ConnectedAccount `json:"connected_account,omitempty"`
Ok bool `json:"ok"`
_rawJSON json.RawMessage
}
func (c *ConnectedAccountsUpdateResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ConnectedAccountsUpdateResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = ConnectedAccountsUpdateResponse(value)
c._rawJSON = json.RawMessage(data)
return nil
}
func (c *ConnectedAccountsUpdateResponse) 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 ConnectedAccountsUpdateRequest struct {
ConnectedAccountId string `json:"connected_account_id"`
AutomaticallyManageNewDevices *bool `json:"automatically_manage_new_devices,omitempty"`
CustomMetadata map[string]*ConnectedAccountsUpdateRequestCustomMetadataValue `json:"custom_metadata,omitempty"`
}