-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_estimate.go
43 lines (36 loc) · 1.05 KB
/
model_estimate.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
/*
* GENERATED. Do not modify. Your changes might be overwritten!
*/
package resources
import "encoding/json"
type Estimate struct {
Key
Attributes EstimateAttributes `json:"attributes"`
}
type EstimateResponse struct {
Data Estimate `json:"data"`
Included Included `json:"included"`
}
type EstimateListResponse struct {
Data []Estimate `json:"data"`
Included Included `json:"included"`
Links *Links `json:"links"`
Meta json.RawMessage `json:"meta,omitempty"`
}
func (r *EstimateListResponse) PutMeta(v interface{}) (err error) {
r.Meta, err = json.Marshal(v)
return err
}
func (r *EstimateListResponse) GetMeta(out interface{}) error {
return json.Unmarshal(r.Meta, out)
}
// MustEstimate - returns Estimate from include collection.
// if entry with specified key does not exist - returns nil
// if entry with specified key exists but type or ID mismatches - panics
func (c *Included) MustEstimate(key Key) *Estimate {
var estimate Estimate
if c.tryFindEntry(key, &estimate) {
return &estimate
}
return nil
}