github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/channel_settle_tx.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 15 utils "github.com/aeternity/aepp-sdk-go/utils" 16 ) 17 18 // ChannelSettleTx channel settle tx 19 // swagger:model ChannelSettleTx 20 type ChannelSettleTx struct { 21 22 // channel id 23 // Required: true 24 ChannelID *string `json:"channel_id"` 25 26 // fee 27 // Required: true 28 Fee utils.BigInt `json:"fee"` 29 30 // from id 31 // Required: true 32 FromID *string `json:"from_id"` 33 34 // initiator amount final 35 // Required: true 36 InitiatorAmountFinal utils.BigInt `json:"initiator_amount_final"` 37 38 // nonce 39 // Required: true 40 Nonce *uint64 `json:"nonce"` 41 42 // responder amount final 43 // Required: true 44 ResponderAmountFinal utils.BigInt `json:"responder_amount_final"` 45 46 // ttl 47 TTL uint64 `json:"ttl,omitempty"` 48 } 49 50 // Validate validates this channel settle tx 51 func (m *ChannelSettleTx) Validate(formats strfmt.Registry) error { 52 var res []error 53 54 if err := m.validateChannelID(formats); err != nil { 55 res = append(res, err) 56 } 57 58 if err := m.validateFee(formats); err != nil { 59 res = append(res, err) 60 } 61 62 if err := m.validateFromID(formats); err != nil { 63 res = append(res, err) 64 } 65 66 if err := m.validateInitiatorAmountFinal(formats); err != nil { 67 res = append(res, err) 68 } 69 70 if err := m.validateNonce(formats); err != nil { 71 res = append(res, err) 72 } 73 74 if err := m.validateResponderAmountFinal(formats); err != nil { 75 res = append(res, err) 76 } 77 78 if len(res) > 0 { 79 return errors.CompositeValidationError(res...) 80 } 81 return nil 82 } 83 84 func (m *ChannelSettleTx) validateChannelID(formats strfmt.Registry) error { 85 86 if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { 87 return err 88 } 89 90 return nil 91 } 92 93 func (m *ChannelSettleTx) validateFee(formats strfmt.Registry) error { 94 95 if err := m.Fee.Validate(formats); err != nil { 96 if ve, ok := err.(*errors.Validation); ok { 97 return ve.ValidateName("fee") 98 } 99 return err 100 } 101 102 return nil 103 } 104 105 func (m *ChannelSettleTx) validateFromID(formats strfmt.Registry) error { 106 107 if err := validate.Required("from_id", "body", m.FromID); err != nil { 108 return err 109 } 110 111 return nil 112 } 113 114 func (m *ChannelSettleTx) validateInitiatorAmountFinal(formats strfmt.Registry) error { 115 116 if err := m.InitiatorAmountFinal.Validate(formats); err != nil { 117 if ve, ok := err.(*errors.Validation); ok { 118 return ve.ValidateName("initiator_amount_final") 119 } 120 return err 121 } 122 123 return nil 124 } 125 126 func (m *ChannelSettleTx) validateNonce(formats strfmt.Registry) error { 127 128 if err := validate.Required("nonce", "body", m.Nonce); err != nil { 129 return err 130 } 131 132 return nil 133 } 134 135 func (m *ChannelSettleTx) validateResponderAmountFinal(formats strfmt.Registry) error { 136 137 if err := m.ResponderAmountFinal.Validate(formats); err != nil { 138 if ve, ok := err.(*errors.Validation); ok { 139 return ve.ValidateName("responder_amount_final") 140 } 141 return err 142 } 143 144 return nil 145 } 146 147 // MarshalBinary interface implementation 148 func (m *ChannelSettleTx) MarshalBinary() ([]byte, error) { 149 if m == nil { 150 return nil, nil 151 } 152 return swag.WriteJSON(m) 153 } 154 155 // UnmarshalBinary interface implementation 156 func (m *ChannelSettleTx) UnmarshalBinary(b []byte) error { 157 var res ChannelSettleTx 158 if err := swag.ReadJSON(b, &res); err != nil { 159 return err 160 } 161 *m = res 162 return nil 163 }