-
Notifications
You must be signed in to change notification settings - Fork 2
/
filemigration.go
56 lines (45 loc) · 1.59 KB
/
filemigration.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"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type FileMigration struct {
Id int64 `json:"id,omitempty" path:"id"`
Path string `json:"path,omitempty" path:"path"`
DestPath string `json:"dest_path,omitempty" path:"dest_path"`
FilesMoved int64 `json:"files_moved,omitempty" path:"files_moved"`
FilesTotal int64 `json:"files_total,omitempty" path:"files_total"`
Operation string `json:"operation,omitempty" path:"operation"`
Region string `json:"region,omitempty" path:"region"`
Status string `json:"status,omitempty" path:"status"`
LogUrl string `json:"log_url,omitempty" path:"log_url"`
}
type FileMigrationCollection []FileMigration
type FileMigrationFindParams struct {
Id int64 `url:"-,omitempty" required:"true" json:"-,omitempty" path:"id"`
}
func (f *FileMigration) UnmarshalJSON(data []byte) error {
type fileMigration FileMigration
var v fileMigration
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*f = FileMigration(v)
return nil
}
func (f *FileMigrationCollection) UnmarshalJSON(data []byte) error {
type fileMigrations FileMigrationCollection
var v fileMigrations
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*f = FileMigrationCollection(v)
return nil
}
func (f *FileMigrationCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*f))
for i, v := range *f {
ret[i] = v
}
return &ret
}