github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/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 "github.com/go-openapi/validate" 14 15 utils "github.com/aeternity/aepp-sdk-go/utils" 16 ) 17 18 // ChannelSnapshotSoloTx channel snapshot solo tx 19 // swagger:model ChannelSnapshotSoloTx 20 type ChannelSnapshotSoloTx 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 // nonce 35 Nonce uint64 `json:"nonce,omitempty"` 36 37 // payload 38 // Required: true 39 Payload *string `json:"payload"` 40 41 // ttl 42 TTL uint64 `json:"ttl,omitempty"` 43 } 44 45 // Validate validates this channel snapshot solo tx 46 func (m *ChannelSnapshotSoloTx) Validate(formats strfmt.Registry) error { 47 var res []error 48 49 if err := m.validateChannelID(formats); err != nil { 50 res = append(res, err) 51 } 52 53 if err := m.validateFee(formats); err != nil { 54 res = append(res, err) 55 } 56 57 if err := m.validateFromID(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validatePayload(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if len(res) > 0 { 66 return errors.CompositeValidationError(res...) 67 } 68 return nil 69 } 70 71 func (m *ChannelSnapshotSoloTx) validateChannelID(formats strfmt.Registry) error { 72 73 if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { 74 return err 75 } 76 77 return nil 78 } 79 80 func (m *ChannelSnapshotSoloTx) validateFee(formats strfmt.Registry) error { 81 82 if err := m.Fee.Validate(formats); err != nil { 83 if ve, ok := err.(*errors.Validation); ok { 84 return ve.ValidateName("fee") 85 } 86 return err 87 } 88 89 return nil 90 } 91 92 func (m *ChannelSnapshotSoloTx) validateFromID(formats strfmt.Registry) error { 93 94 if err := validate.Required("from_id", "body", m.FromID); err != nil { 95 return err 96 } 97 98 return nil 99 } 100 101 func (m *ChannelSnapshotSoloTx) validatePayload(formats strfmt.Registry) error { 102 103 if err := validate.Required("payload", "body", m.Payload); err != nil { 104 return err 105 } 106 107 return nil 108 } 109 110 // MarshalBinary interface implementation 111 func (m *ChannelSnapshotSoloTx) MarshalBinary() ([]byte, error) { 112 if m == nil { 113 return nil, nil 114 } 115 return swag.WriteJSON(m) 116 } 117 118 // UnmarshalBinary interface implementation 119 func (m *ChannelSnapshotSoloTx) UnmarshalBinary(b []byte) error { 120 var res ChannelSnapshotSoloTx 121 if err := swag.ReadJSON(b, &res); err != nil { 122 return err 123 } 124 *m = res 125 return nil 126 }