-
Notifications
You must be signed in to change notification settings - Fork 2
/
history.go
102 lines (87 loc) · 4.6 KB
/
history.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
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type History struct {
Id int64 `json:"id,omitempty" path:"id"`
Path string `json:"path,omitempty" path:"path"`
When *time.Time `json:"when,omitempty" path:"when"`
Destination string `json:"destination,omitempty" path:"destination"`
Display string `json:"display,omitempty" path:"display"`
Ip string `json:"ip,omitempty" path:"ip"`
Source string `json:"source,omitempty" path:"source"`
Targets []string `json:"targets,omitempty" path:"targets"`
UserId int64 `json:"user_id,omitempty" path:"user_id"`
Username string `json:"username,omitempty" path:"username"`
Action string `json:"action,omitempty" path:"action"`
FailureType string `json:"failure_type,omitempty" path:"failure_type"`
Interface string `json:"interface,omitempty" path:"interface"`
}
type HistoryCollection []History
type HistoryListForFileParams struct {
StartAt *time.Time `url:"start_at,omitempty" required:"false" json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `url:"end_at,omitempty" required:"false" json:"end_at,omitempty" path:"end_at"`
Display string `url:"display,omitempty" required:"false" json:"display,omitempty" path:"display"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
Path string `url:"-,omitempty" required:"true" json:"-,omitempty" path:"path"`
lib.ListParams
}
type HistoryListForFolderParams struct {
StartAt *time.Time `url:"start_at,omitempty" required:"false" json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `url:"end_at,omitempty" required:"false" json:"end_at,omitempty" path:"end_at"`
Display string `url:"display,omitempty" required:"false" json:"display,omitempty" path:"display"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
Path string `url:"-,omitempty" required:"true" json:"-,omitempty" path:"path"`
lib.ListParams
}
type HistoryListForUserParams struct {
StartAt *time.Time `url:"start_at,omitempty" required:"false" json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `url:"end_at,omitempty" required:"false" json:"end_at,omitempty" path:"end_at"`
Display string `url:"display,omitempty" required:"false" json:"display,omitempty" path:"display"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
UserId int64 `url:"-,omitempty" required:"true" json:"-,omitempty" path:"user_id"`
lib.ListParams
}
type HistoryListLoginsParams struct {
StartAt *time.Time `url:"start_at,omitempty" required:"false" json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `url:"end_at,omitempty" required:"false" json:"end_at,omitempty" path:"end_at"`
Display string `url:"display,omitempty" required:"false" json:"display,omitempty" path:"display"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
lib.ListParams
}
type HistoryListParams struct {
StartAt *time.Time `url:"start_at,omitempty" required:"false" json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `url:"end_at,omitempty" required:"false" json:"end_at,omitempty" path:"end_at"`
Display string `url:"display,omitempty" required:"false" json:"display,omitempty" path:"display"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false" json:"sort_by,omitempty" path:"sort_by"`
Filter json.RawMessage `url:"filter,omitempty" required:"false" json:"filter,omitempty" path:"filter"`
FilterPrefix json.RawMessage `url:"filter_prefix,omitempty" required:"false" json:"filter_prefix,omitempty" path:"filter_prefix"`
lib.ListParams
}
func (h *History) UnmarshalJSON(data []byte) error {
type history History
var v history
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*h = History(v)
return nil
}
func (h *HistoryCollection) UnmarshalJSON(data []byte) error {
type historys HistoryCollection
var v historys
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*h = HistoryCollection(v)
return nil
}
func (h *HistoryCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*h))
for i, v := range *h {
ret[i] = v
}
return &ret
}