-
Notifications
You must be signed in to change notification settings - Fork 2
/
revision.go
54 lines (42 loc) · 1.4 KB
/
revision.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type Revision struct {
Current string `json:"current,omitempty" path:"current,omitempty" url:"current,omitempty"`
Prior string `json:"prior,omitempty" path:"prior,omitempty" url:"prior,omitempty"`
Revision string `json:"revision,omitempty" path:"revision,omitempty" url:"revision,omitempty"`
UpToDate *bool `json:"up_to_date,omitempty" path:"up_to_date,omitempty" url:"up_to_date,omitempty"`
}
// Identifier no path or id
type RevisionCollection []Revision
type RevisionListParams struct {
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
ListParams
}
func (r *Revision) UnmarshalJSON(data []byte) error {
type revision Revision
var v revision
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*r = Revision(v)
return nil
}
func (r *RevisionCollection) UnmarshalJSON(data []byte) error {
type revisions RevisionCollection
var v revisions
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*r = RevisionCollection(v)
return nil
}
func (r *RevisionCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*r))
for i, v := range *r {
ret[i] = v
}
return &ret
}