-
Notifications
You must be signed in to change notification settings - Fork 1
/
spaces.go
440 lines (406 loc) · 15.3 KB
/
spaces.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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/FlatFilers/flatfile-go/core"
time "time"
)
type DeleteSpacesRequest struct {
// List of ids for the spaces to be deleted
SpaceIds []SpaceId `json:"-" url:"spaceIds"`
}
type ListSpacesRequest struct {
// The ID of the environment.
EnvironmentId *EnvironmentId `json:"-" url:"environmentId,omitempty"`
// Number of spaces to return in a page (default 10)
PageSize *int `json:"-" url:"pageSize,omitempty"`
// Based on pageSize, which page of records to return
PageNumber *int `json:"-" url:"pageNumber,omitempty"`
// Search query for spaces
Search *string `json:"-" url:"search,omitempty"`
// Search by namespace
Namespace *string `json:"-" url:"namespace,omitempty"`
// Flag to include archived spaces
Archived *bool `json:"-" url:"archived,omitempty"`
// Field to sort spaces by
SortField *GetSpacesSortField `json:"-" url:"sortField,omitempty"`
// Direction of sorting
SortDirection *SortDirection `json:"-" url:"sortDirection,omitempty"`
// Flag for collaborative (project) spaces
IsCollaborative *bool `json:"-" url:"isCollaborative,omitempty"`
}
// The topic of the event
type EventTopic string
const (
EventTopicAgentCreated EventTopic = "agent:created"
EventTopicAgentUpdated EventTopic = "agent:updated"
EventTopicAgentDeleted EventTopic = "agent:deleted"
EventTopicSpaceCreated EventTopic = "space:created"
EventTopicSpaceUpdated EventTopic = "space:updated"
EventTopicSpaceDeleted EventTopic = "space:deleted"
EventTopicSpaceArchived EventTopic = "space:archived"
EventTopicSpaceUnarchived EventTopic = "space:unarchived"
EventTopicSpaceExpired EventTopic = "space:expired"
EventTopicSpaceGuestAdded EventTopic = "space:guestAdded"
EventTopicSpaceGuestRemoved EventTopic = "space:guestRemoved"
EventTopicDocumentCreated EventTopic = "document:created"
EventTopicDocumentUpdated EventTopic = "document:updated"
EventTopicDocumentDeleted EventTopic = "document:deleted"
EventTopicWorkbookCreated EventTopic = "workbook:created"
EventTopicWorkbookUpdated EventTopic = "workbook:updated"
EventTopicWorkbookDeleted EventTopic = "workbook:deleted"
EventTopicWorkbookExpired EventTopic = "workbook:expired"
EventTopicSheetCreated EventTopic = "sheet:created"
EventTopicSheetUpdated EventTopic = "sheet:updated"
EventTopicSheetDeleted EventTopic = "sheet:deleted"
EventTopicSheetCountsUpdated EventTopic = "sheet:counts-updated"
EventTopicSnapshotCreated EventTopic = "snapshot:created"
EventTopicRecordsCreated EventTopic = "records:created"
EventTopicRecordsUpdated EventTopic = "records:updated"
EventTopicRecordsDeleted EventTopic = "records:deleted"
EventTopicFileCreated EventTopic = "file:created"
EventTopicFileUpdated EventTopic = "file:updated"
EventTopicFileDeleted EventTopic = "file:deleted"
EventTopicFileExpired EventTopic = "file:expired"
EventTopicJobCreated EventTopic = "job:created"
EventTopicJobUpdated EventTopic = "job:updated"
EventTopicJobDeleted EventTopic = "job:deleted"
EventTopicJobCompleted EventTopic = "job:completed"
EventTopicJobReady EventTopic = "job:ready"
EventTopicJobScheduled EventTopic = "job:scheduled"
EventTopicJobOutcomeAcknowledged EventTopic = "job:outcome-acknowledged"
EventTopicJobPartsCompleted EventTopic = "job:parts-completed"
EventTopicJobFailed EventTopic = "job:failed"
EventTopicProgramCreated EventTopic = "program:created"
EventTopicProgramUpdated EventTopic = "program:updated"
EventTopicCommitCreated EventTopic = "commit:created"
EventTopicCommitUpdated EventTopic = "commit:updated"
EventTopicCommitCompleted EventTopic = "commit:completed"
EventTopicLayerCreated EventTopic = "layer:created"
EventTopicSecretCreated EventTopic = "secret:created"
EventTopicSecretUpdated EventTopic = "secret:updated"
EventTopicSecretDeleted EventTopic = "secret:deleted"
EventTopicCron5Minutes EventTopic = "cron:5-minutes"
EventTopicCronHourly EventTopic = "cron:hourly"
EventTopicCronDaily EventTopic = "cron:daily"
EventTopicCronWeekly EventTopic = "cron:weekly"
EventTopicEnvironmentCreated EventTopic = "environment:created"
EventTopicEnvironmentUpdated EventTopic = "environment:updated"
EventTopicEnvironmentDeleted EventTopic = "environment:deleted"
EventTopicActionCreated EventTopic = "action:created"
EventTopicActionUpdated EventTopic = "action:updated"
EventTopicActionDeleted EventTopic = "action:deleted"
EventTopicDataClipCreated EventTopic = "data-clip:created"
EventTopicDataClipUpdated EventTopic = "data-clip:updated"
EventTopicDataClipDeleted EventTopic = "data-clip:deleted"
)
func NewEventTopicFromString(s string) (EventTopic, error) {
switch s {
case "agent:created":
return EventTopicAgentCreated, nil
case "agent:updated":
return EventTopicAgentUpdated, nil
case "agent:deleted":
return EventTopicAgentDeleted, nil
case "space:created":
return EventTopicSpaceCreated, nil
case "space:updated":
return EventTopicSpaceUpdated, nil
case "space:deleted":
return EventTopicSpaceDeleted, nil
case "space:archived":
return EventTopicSpaceArchived, nil
case "space:unarchived":
return EventTopicSpaceUnarchived, nil
case "space:expired":
return EventTopicSpaceExpired, nil
case "space:guestAdded":
return EventTopicSpaceGuestAdded, nil
case "space:guestRemoved":
return EventTopicSpaceGuestRemoved, nil
case "document:created":
return EventTopicDocumentCreated, nil
case "document:updated":
return EventTopicDocumentUpdated, nil
case "document:deleted":
return EventTopicDocumentDeleted, nil
case "workbook:created":
return EventTopicWorkbookCreated, nil
case "workbook:updated":
return EventTopicWorkbookUpdated, nil
case "workbook:deleted":
return EventTopicWorkbookDeleted, nil
case "workbook:expired":
return EventTopicWorkbookExpired, nil
case "sheet:created":
return EventTopicSheetCreated, nil
case "sheet:updated":
return EventTopicSheetUpdated, nil
case "sheet:deleted":
return EventTopicSheetDeleted, nil
case "sheet:counts-updated":
return EventTopicSheetCountsUpdated, nil
case "snapshot:created":
return EventTopicSnapshotCreated, nil
case "records:created":
return EventTopicRecordsCreated, nil
case "records:updated":
return EventTopicRecordsUpdated, nil
case "records:deleted":
return EventTopicRecordsDeleted, nil
case "file:created":
return EventTopicFileCreated, nil
case "file:updated":
return EventTopicFileUpdated, nil
case "file:deleted":
return EventTopicFileDeleted, nil
case "file:expired":
return EventTopicFileExpired, nil
case "job:created":
return EventTopicJobCreated, nil
case "job:updated":
return EventTopicJobUpdated, nil
case "job:deleted":
return EventTopicJobDeleted, nil
case "job:completed":
return EventTopicJobCompleted, nil
case "job:ready":
return EventTopicJobReady, nil
case "job:scheduled":
return EventTopicJobScheduled, nil
case "job:outcome-acknowledged":
return EventTopicJobOutcomeAcknowledged, nil
case "job:parts-completed":
return EventTopicJobPartsCompleted, nil
case "job:failed":
return EventTopicJobFailed, nil
case "program:created":
return EventTopicProgramCreated, nil
case "program:updated":
return EventTopicProgramUpdated, nil
case "commit:created":
return EventTopicCommitCreated, nil
case "commit:updated":
return EventTopicCommitUpdated, nil
case "commit:completed":
return EventTopicCommitCompleted, nil
case "layer:created":
return EventTopicLayerCreated, nil
case "secret:created":
return EventTopicSecretCreated, nil
case "secret:updated":
return EventTopicSecretUpdated, nil
case "secret:deleted":
return EventTopicSecretDeleted, nil
case "cron:5-minutes":
return EventTopicCron5Minutes, nil
case "cron:hourly":
return EventTopicCronHourly, nil
case "cron:daily":
return EventTopicCronDaily, nil
case "cron:weekly":
return EventTopicCronWeekly, nil
case "environment:created":
return EventTopicEnvironmentCreated, nil
case "environment:updated":
return EventTopicEnvironmentUpdated, nil
case "environment:deleted":
return EventTopicEnvironmentDeleted, nil
case "action:created":
return EventTopicActionCreated, nil
case "action:updated":
return EventTopicActionUpdated, nil
case "action:deleted":
return EventTopicActionDeleted, nil
case "data-clip:created":
return EventTopicDataClipCreated, nil
case "data-clip:updated":
return EventTopicDataClipUpdated, nil
case "data-clip:deleted":
return EventTopicDataClipDeleted, nil
}
var t EventTopic
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (e EventTopic) Ptr() *EventTopic {
return &e
}
type GetSpacesSortField string
const (
GetSpacesSortFieldName GetSpacesSortField = "name"
GetSpacesSortFieldWorkbooksCount GetSpacesSortField = "workbooksCount"
GetSpacesSortFieldFilesCount GetSpacesSortField = "filesCount"
GetSpacesSortFieldEnvironmentId GetSpacesSortField = "environmentId"
GetSpacesSortFieldCreatedByUserName GetSpacesSortField = "createdByUserName"
GetSpacesSortFieldCreatedAt GetSpacesSortField = "createdAt"
GetSpacesSortFieldLastActivityAt GetSpacesSortField = "lastActivityAt"
)
func NewGetSpacesSortFieldFromString(s string) (GetSpacesSortField, error) {
switch s {
case "name":
return GetSpacesSortFieldName, nil
case "workbooksCount":
return GetSpacesSortFieldWorkbooksCount, nil
case "filesCount":
return GetSpacesSortFieldFilesCount, nil
case "environmentId":
return GetSpacesSortFieldEnvironmentId, nil
case "createdByUserName":
return GetSpacesSortFieldCreatedByUserName, nil
case "createdAt":
return GetSpacesSortFieldCreatedAt, nil
case "lastActivityAt":
return GetSpacesSortFieldLastActivityAt, nil
}
var t GetSpacesSortField
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (g GetSpacesSortField) Ptr() *GetSpacesSortField {
return &g
}
// List of Space objects
type ListSpacesResponse struct {
Pagination *Pagination `json:"pagination,omitempty" url:"pagination,omitempty"`
Data []*Space `json:"data,omitempty" url:"data,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (l *ListSpacesResponse) GetExtraProperties() map[string]interface{} {
return l.extraProperties
}
func (l *ListSpacesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListSpacesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListSpacesResponse(value)
extraProperties, err := core.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties
l._rawJSON = json.RawMessage(data)
return nil
}
func (l *ListSpacesResponse) String() string {
if len(l._rawJSON) > 0 {
if value, err := core.StringifyJSON(l._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
// Properties used to create a new Space
type SpaceConfig struct {
SpaceConfigId *SpaceConfigId `json:"spaceConfigId,omitempty" url:"spaceConfigId,omitempty"`
EnvironmentId *EnvironmentId `json:"environmentId,omitempty" url:"environmentId,omitempty"`
// The ID of the primary workbook for the space. This should not be included in create space requests.
PrimaryWorkbookId *WorkbookId `json:"primaryWorkbookId,omitempty" url:"primaryWorkbookId,omitempty"`
// Metadata for the space
Metadata interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
// The Space settings.
Settings *SpaceSettings `json:"settings,omitempty" url:"settings,omitempty"`
Actions []*Action `json:"actions,omitempty" url:"actions,omitempty"`
Access []SpaceAccess `json:"access,omitempty" url:"access,omitempty"`
AutoConfigure *bool `json:"autoConfigure,omitempty" url:"autoConfigure,omitempty"`
Namespace *string `json:"namespace,omitempty" url:"namespace,omitempty"`
Labels []string `json:"labels,omitempty" url:"labels,omitempty"`
TranslationsPath *string `json:"translationsPath,omitempty" url:"translationsPath,omitempty"`
LanguageOverride *string `json:"languageOverride,omitempty" url:"languageOverride,omitempty"`
// Date when space was archived
ArchivedAt *time.Time `json:"archivedAt,omitempty" url:"archivedAt,omitempty"`
// The ID of the App that space is associated with
AppId *AppId `json:"appId,omitempty" url:"appId,omitempty"`
// The name of the space
Name *string `json:"name,omitempty" url:"name,omitempty"`
// The display order
DisplayOrder *int `json:"displayOrder,omitempty" url:"displayOrder,omitempty"`
GuestAuthentication []GuestAuthenticationEnum `json:"guestAuthentication,omitempty" url:"guestAuthentication,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (s *SpaceConfig) GetExtraProperties() map[string]interface{} {
return s.extraProperties
}
func (s *SpaceConfig) UnmarshalJSON(data []byte) error {
type embed SpaceConfig
var unmarshaler = struct {
embed
ArchivedAt *core.DateTime `json:"archivedAt,omitempty"`
}{
embed: embed(*s),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*s = SpaceConfig(unmarshaler.embed)
s.ArchivedAt = unmarshaler.ArchivedAt.TimePtr()
extraProperties, err := core.ExtractExtraProperties(data, *s)
if err != nil {
return err
}
s.extraProperties = extraProperties
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *SpaceConfig) MarshalJSON() ([]byte, error) {
type embed SpaceConfig
var marshaler = struct {
embed
ArchivedAt *core.DateTime `json:"archivedAt,omitempty"`
}{
embed: embed(*s),
ArchivedAt: core.NewOptionalDateTime(s.ArchivedAt),
}
return json.Marshal(marshaler)
}
func (s *SpaceConfig) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
type SpaceResponse struct {
Data *Space `json:"data,omitempty" url:"data,omitempty"`
extraProperties map[string]interface{}
_rawJSON json.RawMessage
}
func (s *SpaceResponse) GetExtraProperties() map[string]interface{} {
return s.extraProperties
}
func (s *SpaceResponse) UnmarshalJSON(data []byte) error {
type unmarshaler SpaceResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = SpaceResponse(value)
extraProperties, err := core.ExtractExtraProperties(data, *s)
if err != nil {
return err
}
s.extraProperties = extraProperties
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *SpaceResponse) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}