-
Notifications
You must be signed in to change notification settings - Fork 2
/
syncjob.go
56 lines (45 loc) · 1.23 KB
/
syncjob.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
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/lib"
)
type SyncJob struct {
QueuedAt time.Time `json:"queued_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Status string `json:"status,omitempty"`
RegionalWorkerStatus string `json:"regional_worker_status,omitempty"`
Uuid string `json:"uuid,omitempty"`
FolderBehaviorId int64 `json:"folder_behavior_id,omitempty"`
}
type SyncJobCollection []SyncJob
type SyncJobListParams struct {
Cursor string `url:"cursor,omitempty" required:"false"`
PerPage int64 `url:"per_page,omitempty" required:"false"`
lib.ListParams
}
func (s *SyncJob) UnmarshalJSON(data []byte) error {
type syncJob SyncJob
var v syncJob
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*s = SyncJob(v)
return nil
}
func (s *SyncJobCollection) UnmarshalJSON(data []byte) error {
type syncJobs []SyncJob
var v syncJobs
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*s = SyncJobCollection(v)
return nil
}
func (s *SyncJobCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*s))
for i, v := range *s {
ret[i] = v
}
return &ret
}