forked from pagarme/pagarme-golang-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listPayablesResponse.go
45 lines (38 loc) · 989 Bytes
/
listPayablesResponse.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
package models
import (
"encoding/json"
"github.com/apimatic/go-core-runtime/types"
)
// Response object for listing payable objects
type ListPayablesResponse struct {
Data types.Optional[[]GetPayableResponse] `json:"data"`
Paging types.Optional[PagingResponse] `json:"paging"`
}
func (l *ListPayablesResponse) MarshalJSON() (
[]byte,
error) {
return json.Marshal(l.toMap())
}
func (l *ListPayablesResponse) toMap() map[string]any {
structMap := make(map[string]any)
if l.Data.IsValueSet() {
structMap["data"] = l.Data.Value()
}
if l.Paging.IsValueSet() {
structMap["paging"] = l.Paging.Value()
}
return structMap
}
func (l *ListPayablesResponse) UnmarshalJSON(input []byte) error {
temp := &struct {
Data types.Optional[[]GetPayableResponse] `json:"data"`
Paging types.Optional[PagingResponse] `json:"paging"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
return err
}
l.Data = temp.Data
l.Paging = temp.Paging
return nil
}