github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/channel_sla_s_h_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 // ChannelSLASHTx channel slash tx 19 // swagger:model ChannelSlashTx 20 type ChannelSLASHTx 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 // Proof of inclusion containing information for closing the channel 42 // Required: true 43 Poi *string `json:"poi"` 44 45 // ttl 46 TTL uint64 `json:"ttl,omitempty"` 47 } 48 49 // Validate validates this channel slash tx 50 func (m *ChannelSLASHTx) Validate(formats strfmt.Registry) error { 51 var res []error 52 53 if err := m.validateChannelID(formats); err != nil { 54 res = append(res, err) 55 } 56 57 if err := m.validateFee(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validateFromID(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validatePayload(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validatePoi(formats); err != nil { 70 res = append(res, err) 71 } 72 73 if len(res) > 0 { 74 return errors.CompositeValidationError(res...) 75 } 76 return nil 77 } 78 79 func (m *ChannelSLASHTx) validateChannelID(formats strfmt.Registry) error { 80 81 if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { 82 return err 83 } 84 85 return nil 86 } 87 88 func (m *ChannelSLASHTx) validateFee(formats strfmt.Registry) error { 89 90 if err := m.Fee.Validate(formats); err != nil { 91 if ve, ok := err.(*errors.Validation); ok { 92 return ve.ValidateName("fee") 93 } 94 return err 95 } 96 97 return nil 98 } 99 100 func (m *ChannelSLASHTx) validateFromID(formats strfmt.Registry) error { 101 102 if err := validate.Required("from_id", "body", m.FromID); err != nil { 103 return err 104 } 105 106 return nil 107 } 108 109 func (m *ChannelSLASHTx) validatePayload(formats strfmt.Registry) error { 110 111 if err := validate.Required("payload", "body", m.Payload); err != nil { 112 return err 113 } 114 115 return nil 116 } 117 118 func (m *ChannelSLASHTx) validatePoi(formats strfmt.Registry) error { 119 120 if err := validate.Required("poi", "body", m.Poi); err != nil { 121 return err 122 } 123 124 return nil 125 } 126 127 // MarshalBinary interface implementation 128 func (m *ChannelSLASHTx) MarshalBinary() ([]byte, error) { 129 if m == nil { 130 return nil, nil 131 } 132 return swag.WriteJSON(m) 133 } 134 135 // UnmarshalBinary interface implementation 136 func (m *ChannelSLASHTx) UnmarshalBinary(b []byte) error { 137 var res ChannelSLASHTx 138 if err := swag.ReadJSON(b, &res); err != nil { 139 return err 140 } 141 *m = res 142 return nil 143 }