github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/name_update_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 "strconv" 10 11 strfmt "github.com/go-openapi/strfmt" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/swag" 15 "github.com/go-openapi/validate" 16 17 utils "github.com/aeternity/aepp-sdk-go/utils" 18 ) 19 20 // NameUpdateTx name update tx 21 // swagger:model NameUpdateTx 22 type NameUpdateTx struct { 23 24 // account id 25 // Required: true 26 AccountID *string `json:"account_id"` 27 28 // client ttl 29 // Required: true 30 ClientTTL *uint64 `json:"client_ttl"` 31 32 // fee 33 // Required: true 34 Fee utils.BigInt `json:"fee"` 35 36 // name id 37 // Required: true 38 NameID *string `json:"name_id"` 39 40 // name ttl 41 // Required: true 42 NameTTL *uint64 `json:"name_ttl"` 43 44 // nonce 45 Nonce uint64 `json:"nonce,omitempty"` 46 47 // pointers 48 // Required: true 49 Pointers []*NamePointer `json:"pointers"` 50 51 // ttl 52 TTL uint64 `json:"ttl,omitempty"` 53 } 54 55 // Validate validates this name update tx 56 func (m *NameUpdateTx) Validate(formats strfmt.Registry) error { 57 var res []error 58 59 if err := m.validateAccountID(formats); err != nil { 60 res = append(res, err) 61 } 62 63 if err := m.validateClientTTL(formats); err != nil { 64 res = append(res, err) 65 } 66 67 if err := m.validateFee(formats); err != nil { 68 res = append(res, err) 69 } 70 71 if err := m.validateNameID(formats); err != nil { 72 res = append(res, err) 73 } 74 75 if err := m.validateNameTTL(formats); err != nil { 76 res = append(res, err) 77 } 78 79 if err := m.validatePointers(formats); err != nil { 80 res = append(res, err) 81 } 82 83 if len(res) > 0 { 84 return errors.CompositeValidationError(res...) 85 } 86 return nil 87 } 88 89 func (m *NameUpdateTx) validateAccountID(formats strfmt.Registry) error { 90 91 if err := validate.Required("account_id", "body", m.AccountID); err != nil { 92 return err 93 } 94 95 return nil 96 } 97 98 func (m *NameUpdateTx) validateClientTTL(formats strfmt.Registry) error { 99 100 if err := validate.Required("client_ttl", "body", m.ClientTTL); err != nil { 101 return err 102 } 103 104 return nil 105 } 106 107 func (m *NameUpdateTx) validateFee(formats strfmt.Registry) error { 108 109 if err := m.Fee.Validate(formats); err != nil { 110 if ve, ok := err.(*errors.Validation); ok { 111 return ve.ValidateName("fee") 112 } 113 return err 114 } 115 116 return nil 117 } 118 119 func (m *NameUpdateTx) validateNameID(formats strfmt.Registry) error { 120 121 if err := validate.Required("name_id", "body", m.NameID); err != nil { 122 return err 123 } 124 125 return nil 126 } 127 128 func (m *NameUpdateTx) validateNameTTL(formats strfmt.Registry) error { 129 130 if err := validate.Required("name_ttl", "body", m.NameTTL); err != nil { 131 return err 132 } 133 134 return nil 135 } 136 137 func (m *NameUpdateTx) validatePointers(formats strfmt.Registry) error { 138 139 if err := validate.Required("pointers", "body", m.Pointers); err != nil { 140 return err 141 } 142 143 for i := 0; i < len(m.Pointers); i++ { 144 if swag.IsZero(m.Pointers[i]) { // not required 145 continue 146 } 147 148 if m.Pointers[i] != nil { 149 if err := m.Pointers[i].Validate(formats); err != nil { 150 if ve, ok := err.(*errors.Validation); ok { 151 return ve.ValidateName("pointers" + "." + strconv.Itoa(i)) 152 } 153 return err 154 } 155 } 156 157 } 158 159 return nil 160 } 161 162 // MarshalBinary interface implementation 163 func (m *NameUpdateTx) MarshalBinary() ([]byte, error) { 164 if m == nil { 165 return nil, nil 166 } 167 return swag.WriteJSON(m) 168 } 169 170 // UnmarshalBinary interface implementation 171 func (m *NameUpdateTx) UnmarshalBinary(b []byte) error { 172 var res NameUpdateTx 173 if err := swag.ReadJSON(b, &res); err != nil { 174 return err 175 } 176 *m = res 177 return nil 178 }