github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/channel_close_solo_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 14 utils "github.com/aeternity/aepp-sdk-go/utils" 15 ) 16 17 // ChannelCloseSoloTx channel close solo tx 18 // swagger:model ChannelCloseSoloTx 19 type ChannelCloseSoloTx struct { 20 21 // channel id 22 // Required: true 23 ChannelID EncodedPubkey `json:"channel_id"` 24 25 // fee 26 // Required: true 27 Fee utils.BigInt `json:"fee"` 28 29 // from id 30 // Required: true 31 FromID EncodedPubkey `json:"from_id"` 32 33 // nonce 34 Nonce Uint64 `json:"nonce,omitempty"` 35 36 // payload 37 // Required: true 38 Payload EncodedByteArray `json:"payload"` 39 40 // Proof of inclusion containing information for closing the channel 41 // Required: true 42 Poi EncodedByteArray `json:"poi"` 43 44 // ttl 45 TTL Uint64 `json:"ttl,omitempty"` 46 } 47 48 // Validate validates this channel close solo tx 49 func (m *ChannelCloseSoloTx) Validate(formats strfmt.Registry) error { 50 var res []error 51 52 if err := m.validateChannelID(formats); err != nil { 53 res = append(res, err) 54 } 55 56 if err := m.validateFee(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateFromID(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateNonce(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validatePayload(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if err := m.validatePoi(formats); err != nil { 73 res = append(res, err) 74 } 75 76 if err := m.validateTTL(formats); err != nil { 77 res = append(res, err) 78 } 79 80 if len(res) > 0 { 81 return errors.CompositeValidationError(res...) 82 } 83 return nil 84 } 85 86 func (m *ChannelCloseSoloTx) validateChannelID(formats strfmt.Registry) error { 87 88 if err := m.ChannelID.Validate(formats); err != nil { 89 if ve, ok := err.(*errors.Validation); ok { 90 return ve.ValidateName("channel_id") 91 } 92 return err 93 } 94 95 return nil 96 } 97 98 func (m *ChannelCloseSoloTx) validateFee(formats strfmt.Registry) error { 99 100 if err := m.Fee.Validate(formats); err != nil { 101 if ve, ok := err.(*errors.Validation); ok { 102 return ve.ValidateName("fee") 103 } 104 return err 105 } 106 107 return nil 108 } 109 110 func (m *ChannelCloseSoloTx) validateFromID(formats strfmt.Registry) error { 111 112 if err := m.FromID.Validate(formats); err != nil { 113 if ve, ok := err.(*errors.Validation); ok { 114 return ve.ValidateName("from_id") 115 } 116 return err 117 } 118 119 return nil 120 } 121 122 func (m *ChannelCloseSoloTx) validateNonce(formats strfmt.Registry) error { 123 124 if swag.IsZero(m.Nonce) { // not required 125 return nil 126 } 127 128 if err := m.Nonce.Validate(formats); err != nil { 129 if ve, ok := err.(*errors.Validation); ok { 130 return ve.ValidateName("nonce") 131 } 132 return err 133 } 134 135 return nil 136 } 137 138 func (m *ChannelCloseSoloTx) validatePayload(formats strfmt.Registry) error { 139 140 if err := m.Payload.Validate(formats); err != nil { 141 if ve, ok := err.(*errors.Validation); ok { 142 return ve.ValidateName("payload") 143 } 144 return err 145 } 146 147 return nil 148 } 149 150 func (m *ChannelCloseSoloTx) validatePoi(formats strfmt.Registry) error { 151 152 if err := m.Poi.Validate(formats); err != nil { 153 if ve, ok := err.(*errors.Validation); ok { 154 return ve.ValidateName("poi") 155 } 156 return err 157 } 158 159 return nil 160 } 161 162 func (m *ChannelCloseSoloTx) validateTTL(formats strfmt.Registry) error { 163 164 if swag.IsZero(m.TTL) { // not required 165 return nil 166 } 167 168 if err := m.TTL.Validate(formats); err != nil { 169 if ve, ok := err.(*errors.Validation); ok { 170 return ve.ValidateName("ttl") 171 } 172 return err 173 } 174 175 return nil 176 } 177 178 // MarshalBinary interface implementation 179 func (m *ChannelCloseSoloTx) MarshalBinary() ([]byte, error) { 180 if m == nil { 181 return nil, nil 182 } 183 return swag.WriteJSON(m) 184 } 185 186 // UnmarshalBinary interface implementation 187 func (m *ChannelCloseSoloTx) UnmarshalBinary(b []byte) error { 188 var res ChannelCloseSoloTx 189 if err := swag.ReadJSON(b, &res); err != nil { 190 return err 191 } 192 *m = res 193 return nil 194 }