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