-
Notifications
You must be signed in to change notification settings - Fork 1
/
invoice_line_item_pricing_detail.go
58 lines (51 loc) · 1.92 KB
/
invoice_line_item_pricing_detail.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
package models
import (
"encoding/json"
)
// InvoiceLineItemPricingDetail represents a InvoiceLineItemPricingDetail struct.
type InvoiceLineItemPricingDetail struct {
Label *string `json:"label,omitempty"`
Amount *string `json:"amount,omitempty"`
AdditionalProperties map[string]any `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceLineItemPricingDetail.
// It customizes the JSON marshaling process for InvoiceLineItemPricingDetail objects.
func (i InvoiceLineItemPricingDetail) MarshalJSON() (
[]byte,
error) {
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceLineItemPricingDetail object to a map representation for JSON marshaling.
func (i InvoiceLineItemPricingDetail) toMap() map[string]any {
structMap := make(map[string]any)
MapAdditionalProperties(structMap, i.AdditionalProperties)
if i.Label != nil {
structMap["label"] = i.Label
}
if i.Amount != nil {
structMap["amount"] = i.Amount
}
return structMap
}
// UnmarshalJSON implements the json.Unmarshaler interface for InvoiceLineItemPricingDetail.
// It customizes the JSON unmarshaling process for InvoiceLineItemPricingDetail objects.
func (i *InvoiceLineItemPricingDetail) UnmarshalJSON(input []byte) error {
var temp invoiceLineItemPricingDetail
err := json.Unmarshal(input, &temp)
if err != nil {
return err
}
additionalProperties, err := UnmarshalAdditionalProperties(input, "label", "amount")
if err != nil {
return err
}
i.AdditionalProperties = additionalProperties
i.Label = temp.Label
i.Amount = temp.Amount
return nil
}
// invoiceLineItemPricingDetail is a temporary struct used for validating the fields of InvoiceLineItemPricingDetail.
type invoiceLineItemPricingDetail struct {
Label *string `json:"label,omitempty"`
Amount *string `json:"amount,omitempty"`
}