-
Notifications
You must be signed in to change notification settings - Fork 2
/
fileaction.go
45 lines (35 loc) · 1.04 KB
/
fileaction.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type FileAction struct {
Status string `json:"status,omitempty" path:"status"`
FileMigrationId int64 `json:"file_migration_id,omitempty" path:"file_migration_id"`
}
type FileActionCollection []FileAction
func (f *FileAction) UnmarshalJSON(data []byte) error {
type fileAction FileAction
var v fileAction
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*f = FileAction(v)
return nil
}
func (f *FileActionCollection) UnmarshalJSON(data []byte) error {
type fileActions FileActionCollection
var v fileActions
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*f = FileActionCollection(v)
return nil
}
func (f *FileActionCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*f))
for i, v := range *f {
ret[i] = v
}
return &ret
}