github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/name_transfer_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 // NameTransferTx name transfer tx 18 // swagger:model NameTransferTx 19 type NameTransferTx struct { 20 21 // account id 22 // Required: true 23 AccountID EncodedPubkey `json:"account_id"` 24 25 // fee 26 // Required: true 27 Fee utils.BigInt `json:"fee"` 28 29 // name id 30 // Required: true 31 NameID EncodedValue `json:"name_id"` 32 33 // nonce 34 Nonce Uint64 `json:"nonce,omitempty"` 35 36 // recipient id 37 // Required: true 38 RecipientID EncodedPubkey `json:"recipient_id"` 39 40 // ttl 41 TTL Uint64 `json:"ttl,omitempty"` 42 } 43 44 // Validate validates this name transfer tx 45 func (m *NameTransferTx) Validate(formats strfmt.Registry) error { 46 var res []error 47 48 if err := m.validateAccountID(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.validateNameID(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.validateRecipientID(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 *NameTransferTx) validateAccountID(formats strfmt.Registry) error { 79 80 if err := m.AccountID.Validate(formats); err != nil { 81 if ve, ok := err.(*errors.Validation); ok { 82 return ve.ValidateName("account_id") 83 } 84 return err 85 } 86 87 return nil 88 } 89 90 func (m *NameTransferTx) 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 *NameTransferTx) validateNameID(formats strfmt.Registry) error { 103 104 if err := m.NameID.Validate(formats); err != nil { 105 if ve, ok := err.(*errors.Validation); ok { 106 return ve.ValidateName("name_id") 107 } 108 return err 109 } 110 111 return nil 112 } 113 114 func (m *NameTransferTx) 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 *NameTransferTx) validateRecipientID(formats strfmt.Registry) error { 131 132 if err := m.RecipientID.Validate(formats); err != nil { 133 if ve, ok := err.(*errors.Validation); ok { 134 return ve.ValidateName("recipient_id") 135 } 136 return err 137 } 138 139 return nil 140 } 141 142 func (m *NameTransferTx) 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 *NameTransferTx) 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 *NameTransferTx) UnmarshalBinary(b []byte) error { 168 var res NameTransferTx 169 if err := swag.ReadJSON(b, &res); err != nil { 170 return err 171 } 172 *m = res 173 return nil 174 }