github.com/Files-com/files-sdk-go/v3@v3.1.81/paymentlineitem.go (about) 1 package files_sdk 2 3 import ( 4 "encoding/json" 5 "time" 6 7 lib "github.com/Files-com/files-sdk-go/v3/lib" 8 ) 9 10 type PaymentLineItem struct { 11 Amount string `json:"amount,omitempty" path:"amount,omitempty" url:"amount,omitempty"` 12 CreatedAt *time.Time `json:"created_at,omitempty" path:"created_at,omitempty" url:"created_at,omitempty"` 13 InvoiceId int64 `json:"invoice_id,omitempty" path:"invoice_id,omitempty" url:"invoice_id,omitempty"` 14 PaymentId int64 `json:"payment_id,omitempty" path:"payment_id,omitempty" url:"payment_id,omitempty"` 15 } 16 17 // Identifier no path or id 18 19 type PaymentLineItemCollection []PaymentLineItem 20 21 func (p *PaymentLineItem) UnmarshalJSON(data []byte) error { 22 type paymentLineItem PaymentLineItem 23 var v paymentLineItem 24 if err := json.Unmarshal(data, &v); err != nil { 25 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{}) 26 } 27 28 *p = PaymentLineItem(v) 29 return nil 30 } 31 32 func (p *PaymentLineItemCollection) UnmarshalJSON(data []byte) error { 33 type paymentLineItems PaymentLineItemCollection 34 var v paymentLineItems 35 if err := json.Unmarshal(data, &v); err != nil { 36 return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{}) 37 } 38 39 *p = PaymentLineItemCollection(v) 40 return nil 41 } 42 43 func (p *PaymentLineItemCollection) ToSlice() *[]interface{} { 44 ret := make([]interface{}, len(*p)) 45 for i, v := range *p { 46 ret[i] = v 47 } 48 49 return &ret 50 }