-
Notifications
You must be signed in to change notification settings - Fork 2
/
invoicelineitem.go
51 lines (42 loc) · 1.24 KB
/
invoicelineitem.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
package files_sdk
import (
"encoding/json"
"time"
)
type InvoiceLineItem struct {
Amount float32 `json:"amount,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
ServiceEndAt time.Time `json:"service_end_at,omitempty"`
ServiceStartAt time.Time `json:"service_start_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Plan string `json:"plan,omitempty"`
Site string `json:"site,omitempty"`
}
type InvoiceLineItemCollection []InvoiceLineItem
func (i *InvoiceLineItem) UnmarshalJSON(data []byte) error {
type invoiceLineItem InvoiceLineItem
var v invoiceLineItem
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*i = InvoiceLineItem(v)
return nil
}
func (i *InvoiceLineItemCollection) UnmarshalJSON(data []byte) error {
type invoiceLineItems []InvoiceLineItem
var v invoiceLineItems
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*i = InvoiceLineItemCollection(v)
return nil
}
func (i *InvoiceLineItemCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*i))
for i, v := range *i {
ret[i] = v
}
return &ret
}