github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/channel.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 // Channel channel 19 // swagger:model Channel 20 type Channel struct { 21 22 // channel amount 23 // Required: true 24 ChannelAmount utils.BigInt `json:"channel_amount"` 25 26 // channel reserve 27 // Required: true 28 ChannelReserve utils.BigInt `json:"channel_reserve"` 29 30 // delegate ids 31 // Required: true 32 DelegateIds []string `json:"delegate_ids"` 33 34 // id 35 // Required: true 36 ID *string `json:"id"` 37 38 // initiator amount 39 // Required: true 40 InitiatorAmount utils.BigInt `json:"initiator_amount"` 41 42 // initiator id 43 // Required: true 44 InitiatorID *string `json:"initiator_id"` 45 46 // lock period 47 // Required: true 48 LockPeriod *uint64 `json:"lock_period"` 49 50 // locked until 51 // Required: true 52 LockedUntil *uint64 `json:"locked_until"` 53 54 // responder amount 55 // Required: true 56 ResponderAmount utils.BigInt `json:"responder_amount"` 57 58 // responder id 59 // Required: true 60 ResponderID *string `json:"responder_id"` 61 62 // round 63 // Required: true 64 Round *uint64 `json:"round"` 65 66 // solo round 67 // Required: true 68 SoloRound *uint64 `json:"solo_round"` 69 70 // state hash 71 // Required: true 72 StateHash *string `json:"state_hash"` 73 } 74 75 // Validate validates this channel 76 func (m *Channel) Validate(formats strfmt.Registry) error { 77 var res []error 78 79 if err := m.validateChannelAmount(formats); err != nil { 80 res = append(res, err) 81 } 82 83 if err := m.validateChannelReserve(formats); err != nil { 84 res = append(res, err) 85 } 86 87 if err := m.validateDelegateIds(formats); err != nil { 88 res = append(res, err) 89 } 90 91 if err := m.validateID(formats); err != nil { 92 res = append(res, err) 93 } 94 95 if err := m.validateInitiatorAmount(formats); err != nil { 96 res = append(res, err) 97 } 98 99 if err := m.validateInitiatorID(formats); err != nil { 100 res = append(res, err) 101 } 102 103 if err := m.validateLockPeriod(formats); err != nil { 104 res = append(res, err) 105 } 106 107 if err := m.validateLockedUntil(formats); err != nil { 108 res = append(res, err) 109 } 110 111 if err := m.validateResponderAmount(formats); err != nil { 112 res = append(res, err) 113 } 114 115 if err := m.validateResponderID(formats); err != nil { 116 res = append(res, err) 117 } 118 119 if err := m.validateRound(formats); err != nil { 120 res = append(res, err) 121 } 122 123 if err := m.validateSoloRound(formats); err != nil { 124 res = append(res, err) 125 } 126 127 if err := m.validateStateHash(formats); err != nil { 128 res = append(res, err) 129 } 130 131 if len(res) > 0 { 132 return errors.CompositeValidationError(res...) 133 } 134 return nil 135 } 136 137 func (m *Channel) validateChannelAmount(formats strfmt.Registry) error { 138 139 if err := m.ChannelAmount.Validate(formats); err != nil { 140 if ve, ok := err.(*errors.Validation); ok { 141 return ve.ValidateName("channel_amount") 142 } 143 return err 144 } 145 146 return nil 147 } 148 149 func (m *Channel) validateChannelReserve(formats strfmt.Registry) error { 150 151 if err := m.ChannelReserve.Validate(formats); err != nil { 152 if ve, ok := err.(*errors.Validation); ok { 153 return ve.ValidateName("channel_reserve") 154 } 155 return err 156 } 157 158 return nil 159 } 160 161 func (m *Channel) validateDelegateIds(formats strfmt.Registry) error { 162 163 if err := validate.Required("delegate_ids", "body", m.DelegateIds); err != nil { 164 return err 165 } 166 167 return nil 168 } 169 170 func (m *Channel) validateID(formats strfmt.Registry) error { 171 172 if err := validate.Required("id", "body", m.ID); err != nil { 173 return err 174 } 175 176 return nil 177 } 178 179 func (m *Channel) validateInitiatorAmount(formats strfmt.Registry) error { 180 181 if err := m.InitiatorAmount.Validate(formats); err != nil { 182 if ve, ok := err.(*errors.Validation); ok { 183 return ve.ValidateName("initiator_amount") 184 } 185 return err 186 } 187 188 return nil 189 } 190 191 func (m *Channel) validateInitiatorID(formats strfmt.Registry) error { 192 193 if err := validate.Required("initiator_id", "body", m.InitiatorID); err != nil { 194 return err 195 } 196 197 return nil 198 } 199 200 func (m *Channel) validateLockPeriod(formats strfmt.Registry) error { 201 202 if err := validate.Required("lock_period", "body", m.LockPeriod); err != nil { 203 return err 204 } 205 206 return nil 207 } 208 209 func (m *Channel) validateLockedUntil(formats strfmt.Registry) error { 210 211 if err := validate.Required("locked_until", "body", m.LockedUntil); err != nil { 212 return err 213 } 214 215 return nil 216 } 217 218 func (m *Channel) validateResponderAmount(formats strfmt.Registry) error { 219 220 if err := m.ResponderAmount.Validate(formats); err != nil { 221 if ve, ok := err.(*errors.Validation); ok { 222 return ve.ValidateName("responder_amount") 223 } 224 return err 225 } 226 227 return nil 228 } 229 230 func (m *Channel) validateResponderID(formats strfmt.Registry) error { 231 232 if err := validate.Required("responder_id", "body", m.ResponderID); err != nil { 233 return err 234 } 235 236 return nil 237 } 238 239 func (m *Channel) validateRound(formats strfmt.Registry) error { 240 241 if err := validate.Required("round", "body", m.Round); err != nil { 242 return err 243 } 244 245 return nil 246 } 247 248 func (m *Channel) validateSoloRound(formats strfmt.Registry) error { 249 250 if err := validate.Required("solo_round", "body", m.SoloRound); err != nil { 251 return err 252 } 253 254 return nil 255 } 256 257 func (m *Channel) validateStateHash(formats strfmt.Registry) error { 258 259 if err := validate.Required("state_hash", "body", m.StateHash); err != nil { 260 return err 261 } 262 263 return nil 264 } 265 266 // MarshalBinary interface implementation 267 func (m *Channel) MarshalBinary() ([]byte, error) { 268 if m == nil { 269 return nil, nil 270 } 271 return swag.WriteJSON(m) 272 } 273 274 // UnmarshalBinary interface implementation 275 func (m *Channel) UnmarshalBinary(b []byte) error { 276 var res Channel 277 if err := swag.ReadJSON(b, &res); err != nil { 278 return err 279 } 280 *m = res 281 return nil 282 }