-
Notifications
You must be signed in to change notification settings - Fork 2
/
usagesnapshot.go
67 lines (56 loc) · 2.95 KB
/
usagesnapshot.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
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type UsageSnapshot struct {
Id int64 `json:"id,omitempty" path:"id"`
StartAt *time.Time `json:"start_at,omitempty" path:"start_at"`
EndAt *time.Time `json:"end_at,omitempty" path:"end_at"`
CreatedAt *time.Time `json:"created_at,omitempty" path:"created_at"`
HighWaterUserCount string `json:"high_water_user_count,omitempty" path:"high_water_user_count"`
CurrentStorage string `json:"current_storage,omitempty" path:"current_storage"`
HighWaterStorage string `json:"high_water_storage,omitempty" path:"high_water_storage"`
TotalDownloads int64 `json:"total_downloads,omitempty" path:"total_downloads"`
TotalUploads int64 `json:"total_uploads,omitempty" path:"total_uploads"`
UpdatedAt *time.Time `json:"updated_at,omitempty" path:"updated_at"`
UsageByTopLevelDir json.RawMessage `json:"usage_by_top_level_dir,omitempty" path:"usage_by_top_level_dir"`
RootStorage string `json:"root_storage,omitempty" path:"root_storage"`
DeletedFilesCountedInMinimum string `json:"deleted_files_counted_in_minimum,omitempty" path:"deleted_files_counted_in_minimum"`
DeletedFilesStorage string `json:"deleted_files_storage,omitempty" path:"deleted_files_storage"`
TotalBillableUsage string `json:"total_billable_usage,omitempty" path:"total_billable_usage"`
TotalBillableTransferUsage string `json:"total_billable_transfer_usage,omitempty" path:"total_billable_transfer_usage"`
BytesSent string `json:"bytes_sent,omitempty" path:"bytes_sent"`
SyncBytesReceived string `json:"sync_bytes_received,omitempty" path:"sync_bytes_received"`
SyncBytesSent string `json:"sync_bytes_sent,omitempty" path:"sync_bytes_sent"`
}
type UsageSnapshotCollection []UsageSnapshot
type UsageSnapshotListParams struct {
lib.ListParams
}
func (u *UsageSnapshot) UnmarshalJSON(data []byte) error {
type usageSnapshot UsageSnapshot
var v usageSnapshot
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*u = UsageSnapshot(v)
return nil
}
func (u *UsageSnapshotCollection) UnmarshalJSON(data []byte) error {
type usageSnapshots UsageSnapshotCollection
var v usageSnapshots
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*u = UsageSnapshotCollection(v)
return nil
}
func (u *UsageSnapshotCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*u))
for i, v := range *u {
ret[i] = v
}
return &ret
}