-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
429 lines (379 loc) · 10.8 KB
/
types.go
File metadata and controls
429 lines (379 loc) · 10.8 KB
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
// This file was auto-generated by Fern from our API Definition.
package livesession
import (
json "encoding/json"
fmt "fmt"
internal "go.livesession.io/livesession-go/internal"
)
type AlertDeleted struct {
// ID of the deleted alert
AlertId *string `json:"alert_id,omitempty" url:"alert_id,omitempty"`
// Confirmation that the alert was deleted
Deleted *bool `json:"deleted,omitempty" url:"deleted,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (a *AlertDeleted) GetAlertId() *string {
if a == nil {
return nil
}
return a.AlertId
}
func (a *AlertDeleted) GetDeleted() *bool {
if a == nil {
return nil
}
return a.Deleted
}
func (a *AlertDeleted) GetExtraProperties() map[string]interface{} {
return a.extraProperties
}
func (a *AlertDeleted) UnmarshalJSON(data []byte) error {
type unmarshaler AlertDeleted
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AlertDeleted(value)
extraProperties, err := internal.ExtractExtraProperties(data, *a)
if err != nil {
return err
}
a.extraProperties = extraProperties
a.rawJSON = json.RawMessage(data)
return nil
}
func (a *AlertDeleted) String() string {
if len(a.rawJSON) > 0 {
if value, err := internal.StringifyJSON(a.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
type ErrorResponse struct {
Error *ErrorResponseError `json:"error,omitempty" url:"error,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (e *ErrorResponse) GetError() *ErrorResponseError {
if e == nil {
return nil
}
return e.Error
}
func (e *ErrorResponse) GetExtraProperties() map[string]interface{} {
return e.extraProperties
}
func (e *ErrorResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ErrorResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*e = ErrorResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *e)
if err != nil {
return err
}
e.extraProperties = extraProperties
e.rawJSON = json.RawMessage(data)
return nil
}
func (e *ErrorResponse) String() string {
if len(e.rawJSON) > 0 {
if value, err := internal.StringifyJSON(e.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(e); err == nil {
return value
}
return fmt.Sprintf("%#v", e)
}
type ErrorResponseError struct {
// Type of error (e.g., validation_error, authentication_error)
Type *string `json:"type,omitempty" url:"type,omitempty"`
// Machine-readable error code
Code *string `json:"code,omitempty" url:"code,omitempty"`
// Name of the parameter that caused the error
Param *string `json:"param,omitempty" url:"param,omitempty"`
// Human-readable error message
Message *string `json:"message,omitempty" url:"message,omitempty"`
// HTTP status code associated with the error
HttpStatusCode *int `json:"http_status_code,omitempty" url:"http_status_code,omitempty"`
// Unique identifier for the request that caused the error
RequestId *string `json:"request_id,omitempty" url:"request_id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (e *ErrorResponseError) GetType() *string {
if e == nil {
return nil
}
return e.Type
}
func (e *ErrorResponseError) GetCode() *string {
if e == nil {
return nil
}
return e.Code
}
func (e *ErrorResponseError) GetParam() *string {
if e == nil {
return nil
}
return e.Param
}
func (e *ErrorResponseError) GetMessage() *string {
if e == nil {
return nil
}
return e.Message
}
func (e *ErrorResponseError) GetHttpStatusCode() *int {
if e == nil {
return nil
}
return e.HttpStatusCode
}
func (e *ErrorResponseError) GetRequestId() *string {
if e == nil {
return nil
}
return e.RequestId
}
func (e *ErrorResponseError) GetExtraProperties() map[string]interface{} {
return e.extraProperties
}
func (e *ErrorResponseError) UnmarshalJSON(data []byte) error {
type unmarshaler ErrorResponseError
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*e = ErrorResponseError(value)
extraProperties, err := internal.ExtractExtraProperties(data, *e)
if err != nil {
return err
}
e.extraProperties = extraProperties
e.rawJSON = json.RawMessage(data)
return nil
}
func (e *ErrorResponseError) String() string {
if len(e.rawJSON) > 0 {
if value, err := internal.StringifyJSON(e.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(e); err == nil {
return value
}
return fmt.Sprintf("%#v", e)
}
type OauthScope string
const (
// read user sessions
OauthScopeUsersSessionsRead OauthScope = "users.sessions:read"
// read webhooks
OauthScopeWebhooksRead OauthScope = "webhooks:read"
// write webhooks
OauthScopeWebhooksWrite OauthScope = "webhooks:write"
// read alerts
OauthScopeAlertsRead OauthScope = "alerts:read"
// write alerts
OauthScopeAlertsWrite OauthScope = "alerts:write"
// read websites
OauthScopeWebsitesRead OauthScope = "websites:read"
// write websites
OauthScopeWebsitesWrite OauthScope = "websites:write"
// write payment intents
OauthScopePaymentIntentsWrite OauthScope = "payment_intents:write"
// confirm payment intents
OauthScopePaymentIntentsConfirm OauthScope = "payment_intents.confirm"
)
func NewOauthScopeFromString(s string) (OauthScope, error) {
switch s {
case "users.sessions:read":
return OauthScopeUsersSessionsRead, nil
case "webhooks:read":
return OauthScopeWebhooksRead, nil
case "webhooks:write":
return OauthScopeWebhooksWrite, nil
case "alerts:read":
return OauthScopeAlertsRead, nil
case "alerts:write":
return OauthScopeAlertsWrite, nil
case "websites:read":
return OauthScopeWebsitesRead, nil
case "websites:write":
return OauthScopeWebsitesWrite, nil
case "payment_intents:write":
return OauthScopePaymentIntentsWrite, nil
case "payment_intents.confirm":
return OauthScopePaymentIntentsConfirm, nil
}
var t OauthScope
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (o OauthScope) Ptr() *OauthScope {
return &o
}
// * `TODAY` - Today since midnight
// * `YESTERDAY` - Yesterday since midnight
// * `BEGINNING_OF_WEEK` - Nearest monday since midnight
// * `BEGINNING_OF_MONTH` - 1st of the month since midnight
// * `BEGINNING_OF_PREV_MONTH` - Previous 1st of the month since midnight
// * `TODAY-7DAYS` - Exact 7 days ago since midnight
// * `TODAY-30DAYS` - Exact 30 days ago since midnight
type RelativeDateString string
const (
RelativeDateStringToday RelativeDateString = "TODAY"
RelativeDateStringYesterday RelativeDateString = "YESTERDAY"
RelativeDateStringBeginningOfWeek RelativeDateString = "BEGINNING_OF_WEEK"
RelativeDateStringBeginningOfMonth RelativeDateString = "BEGINNING_OF_MONTH"
RelativeDateStringBeginningOfPrevMonth RelativeDateString = "BEGINNING_OF_PREV_MONTH"
RelativeDateStringToday7Days RelativeDateString = "TODAY-7DAYS"
RelativeDateStringToday30Days RelativeDateString = "TODAY-30DAYS"
)
func NewRelativeDateStringFromString(s string) (RelativeDateString, error) {
switch s {
case "TODAY":
return RelativeDateStringToday, nil
case "YESTERDAY":
return RelativeDateStringYesterday, nil
case "BEGINNING_OF_WEEK":
return RelativeDateStringBeginningOfWeek, nil
case "BEGINNING_OF_MONTH":
return RelativeDateStringBeginningOfMonth, nil
case "BEGINNING_OF_PREV_MONTH":
return RelativeDateStringBeginningOfPrevMonth, nil
case "TODAY-7DAYS":
return RelativeDateStringToday7Days, nil
case "TODAY-30DAYS":
return RelativeDateStringToday30Days, nil
}
var t RelativeDateString
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (r RelativeDateString) Ptr() *RelativeDateString {
return &r
}
type SessionPageViewLocationData struct {
// Base URL of the page
Base *string `json:"base,omitempty" url:"base,omitempty"`
// Full URL of the page
Href *string `json:"href,omitempty" url:"href,omitempty"`
// Origin of the page (protocol + hostname)
Origin *string `json:"origin,omitempty" url:"origin,omitempty"`
// URL of the previous page
Referrer *string `json:"referrer,omitempty" url:"referrer,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (s *SessionPageViewLocationData) GetBase() *string {
if s == nil {
return nil
}
return s.Base
}
func (s *SessionPageViewLocationData) GetHref() *string {
if s == nil {
return nil
}
return s.Href
}
func (s *SessionPageViewLocationData) GetOrigin() *string {
if s == nil {
return nil
}
return s.Origin
}
func (s *SessionPageViewLocationData) GetReferrer() *string {
if s == nil {
return nil
}
return s.Referrer
}
func (s *SessionPageViewLocationData) GetExtraProperties() map[string]interface{} {
return s.extraProperties
}
func (s *SessionPageViewLocationData) UnmarshalJSON(data []byte) error {
type unmarshaler SessionPageViewLocationData
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = SessionPageViewLocationData(value)
extraProperties, err := internal.ExtractExtraProperties(data, *s)
if err != nil {
return err
}
s.extraProperties = extraProperties
s.rawJSON = json.RawMessage(data)
return nil
}
func (s *SessionPageViewLocationData) String() string {
if len(s.rawJSON) > 0 {
if value, err := internal.StringifyJSON(s.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
type SessionPageViewViewPortData struct {
// Viewport height in pixels
Height *int `json:"height,omitempty" url:"height,omitempty"`
// Viewport width in pixels
Width *int `json:"width,omitempty" url:"width,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (s *SessionPageViewViewPortData) GetHeight() *int {
if s == nil {
return nil
}
return s.Height
}
func (s *SessionPageViewViewPortData) GetWidth() *int {
if s == nil {
return nil
}
return s.Width
}
func (s *SessionPageViewViewPortData) GetExtraProperties() map[string]interface{} {
return s.extraProperties
}
func (s *SessionPageViewViewPortData) UnmarshalJSON(data []byte) error {
type unmarshaler SessionPageViewViewPortData
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = SessionPageViewViewPortData(value)
extraProperties, err := internal.ExtractExtraProperties(data, *s)
if err != nil {
return err
}
s.extraProperties = extraProperties
s.rawJSON = json.RawMessage(data)
return nil
}
func (s *SessionPageViewViewPortData) String() string {
if len(s.rawJSON) > 0 {
if value, err := internal.StringifyJSON(s.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}