v1/usage.go
raw| 1 | package client |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "fmt" |
| 6 | ) |
| 7 | |
| 8 | type Usage struct { |
| 9 | Data []UsageData |
| 10 | Product string `json:"-"` |
| 11 | } |
| 12 | |
| 13 | func (u Usage) Path() string { |
| 14 | return fmt.Sprintf("/usage/%s", u.Product) |
| 15 | } |
| 16 | |
| 17 | func (u Usage) MarshalJSON() ([]byte, error) { |
| 18 | return json.Marshal(u.Data) |
| 19 | } |
| 20 | |
| 21 | type UsageData struct { |
| 22 | Tags Tags `json:"tags"` |
| 23 | Values Values `json:"values"` |
| 24 | } |