-
Notifications
You must be signed in to change notification settings - Fork 2
/
bandwidthsnapshot.go
68 lines (57 loc) · 2.18 KB
/
bandwidthsnapshot.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
package files_sdk
import (
"encoding/json"
"time"
lib "github.com/Files-com/files-sdk-go/lib"
)
type BandwidthSnapshot struct {
Id int64 `json:"id,omitempty"`
BytesReceived float32 `json:"bytes_received,omitempty"`
BytesSent float32 `json:"bytes_sent,omitempty"`
SyncBytesReceived float32 `json:"sync_bytes_received,omitempty"`
SyncBytesSent float32 `json:"sync_bytes_sent,omitempty"`
RequestsGet float32 `json:"requests_get,omitempty"`
RequestsPut float32 `json:"requests_put,omitempty"`
RequestsOther float32 `json:"requests_other,omitempty"`
LoggedAt time.Time `json:"logged_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
type BandwidthSnapshotCollection []BandwidthSnapshot
type BandwidthSnapshotListParams struct {
Cursor string `url:"cursor,omitempty" required:"false"`
PerPage int64 `url:"per_page,omitempty" required:"false"`
SortBy json.RawMessage `url:"sort_by,omitempty" required:"false"`
Filter json.RawMessage `url:"filter,omitempty" required:"false"`
FilterGt json.RawMessage `url:"filter_gt,omitempty" required:"false"`
FilterGteq json.RawMessage `url:"filter_gteq,omitempty" required:"false"`
FilterLike json.RawMessage `url:"filter_like,omitempty" required:"false"`
FilterLt json.RawMessage `url:"filter_lt,omitempty" required:"false"`
FilterLteq json.RawMessage `url:"filter_lteq,omitempty" required:"false"`
lib.ListParams
}
func (b *BandwidthSnapshot) UnmarshalJSON(data []byte) error {
type bandwidthSnapshot BandwidthSnapshot
var v bandwidthSnapshot
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*b = BandwidthSnapshot(v)
return nil
}
func (b *BandwidthSnapshotCollection) UnmarshalJSON(data []byte) error {
type bandwidthSnapshots []BandwidthSnapshot
var v bandwidthSnapshots
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*b = BandwidthSnapshotCollection(v)
return nil
}
func (b *BandwidthSnapshotCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*b))
for i, v := range *b {
ret[i] = v
}
return &ret
}