-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.go
44 lines (37 loc) · 1.21 KB
/
common.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
package casheerapi
import (
"time"
)
type Timestamps struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// DefaultLinks allow the user to navigate back to the home page of the API.
type DefaultLinks struct {
Home string `json:"home"`
}
type HomeLink struct {
Href string `json:"href"`
Title string `json:"title"`
}
// MonetaryValueAttributes are used to define the "value" of something in a
// currency agnostic manner.
type MonetaryValueAttributes struct {
Amount int `json:"amount"`
Currency string `json:"currency"`
Exponent int `json:"exponent"`
}
// MonetaryMutableValueAttributes is the same as MonetaryValueAttributes, except
// that it holds the fields that are mutable.
type MonetaryMutableValueAttributes struct {
Amount *int `json:"amount,omitempty"`
Currency *string `json:"currency,omitempty"`
Exponent *int `json:"exponent,omitempty"`
}
// MonetaryValueCreationAttributes is the same as MonetaryValueAttributes,
// but it is used when creating such an object to highlight the optional fields.
type MonetaryValueCreationAttributes struct {
Amount int `json:"amount"`
Currency string `json:"currency"`
Exponent *int `json:"exponent,omitempty"`
}