github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/channel_snapshot_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 // ChannelSnapshotSoloTx channel snapshot solo tx 18 // swagger:model ChannelSnapshotSoloTx 19 type ChannelSnapshotSoloTx 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 // ttl 41 TTL Uint64 `json:"ttl,omitempty"` 42 } 43 44 // Validate validates this channel snapshot solo tx 45 func (m *ChannelSnapshotSoloTx) Validate(formats strfmt.Registry) error { 46 var res []error 47 48 if err := m.validateChannelID(formats); err != nil { 49 res = append(res, err) 50 } 51 52 if err := m.validateFee(formats); err != nil { 53 res = append(res, err) 54 } 55 56 if err := m.validateFromID(formats); err != nil { 57 res = append(res, err) 58 } 59 60 if err := m.validateNonce(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validatePayload(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateTTL(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if len(res) > 0 { 73 return errors.CompositeValidationError(res...) 74 } 75 return nil 76 } 77 78 func (m *ChannelSnapshotSoloTx) validateChannelID(formats strfmt.Registry) error { 79 80 if err := m.ChannelID.Validate(formats); err != nil { 81 if ve, ok := err.(*errors.Validation); ok { 82 return ve.ValidateName("channel_id") 83 } 84 return err 85 } 86 87 return nil 88 } 89 90 func (m *ChannelSnapshotSoloTx) validateFee(formats strfmt.Registry) error { 91 92 if err := m.Fee.Validate(formats); err != nil { 93 if ve, ok := err.(*errors.Validation); ok { 94 return ve.ValidateName("fee") 95 } 96 return err 97 } 98 99 return nil 100 } 101 102 func (m *ChannelSnapshotSoloTx) validateFromID(formats strfmt.Registry) error { 103 104 if err := m.FromID.Validate(formats); err != nil { 105 if ve, ok := err.(*errors.Validation); ok { 106 return ve.ValidateName("from_id") 107 } 108 return err 109 } 110 111 return nil 112 } 113 114 func (m *ChannelSnapshotSoloTx) validateNonce(formats strfmt.Registry) error { 115 116 if swag.IsZero(m.Nonce) { // not required 117 return nil 118 } 119 120 if err := m.Nonce.Validate(formats); err != nil { 121 if ve, ok := err.(*errors.Validation); ok { 122 return ve.ValidateName("nonce") 123 } 124 return err 125 } 126 127 return nil 128 } 129 130 func (m *ChannelSnapshotSoloTx) validatePayload(formats strfmt.Registry) error { 131 132 if err := m.Payload.Validate(formats); err != nil { 133 if ve, ok := err.(*errors.Validation); ok { 134 return ve.ValidateName("payload") 135 } 136 return err 137 } 138 139 return nil 140 } 141 142 func (m *ChannelSnapshotSoloTx) validateTTL(formats strfmt.Registry) error { 143 144 if swag.IsZero(m.TTL) { // not required 145 return nil 146 } 147 148 if err := m.TTL.Validate(formats); err != nil { 149 if ve, ok := err.(*errors.Validation); ok { 150 return ve.ValidateName("ttl") 151 } 152 return err 153 } 154 155 return nil 156 } 157 158 // MarshalBinary interface implementation 159 func (m *ChannelSnapshotSoloTx) MarshalBinary() ([]byte, error) { 160 if m == nil { 161 return nil, nil 162 } 163 return swag.WriteJSON(m) 164 } 165 166 // UnmarshalBinary interface implementation 167 func (m *ChannelSnapshotSoloTx) UnmarshalBinary(b []byte) error { 168 var res ChannelSnapshotSoloTx 169 if err := swag.ReadJSON(b, &res); err != nil { 170 return err 171 } 172 *m = res 173 return nil 174 }