github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/oracle_register_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 // OracleRegisterTx oracle register tx 19 // swagger:model OracleRegisterTx 20 type OracleRegisterTx struct { 21 22 // abi version 23 AbiVersion Uint16 `json:"abi_version,omitempty"` 24 25 // account id 26 // Required: true 27 AccountID EncodedPubkey `json:"account_id"` 28 29 // fee 30 // Required: true 31 Fee utils.BigInt `json:"fee"` 32 33 // nonce 34 Nonce Uint64 `json:"nonce,omitempty"` 35 36 // oracle ttl 37 // Required: true 38 OracleTTL *TTL `json:"oracle_ttl"` 39 40 // query fee 41 // Required: true 42 QueryFee utils.BigInt `json:"query_fee"` 43 44 // query format 45 // Required: true 46 QueryFormat *string `json:"query_format"` 47 48 // response format 49 // Required: true 50 ResponseFormat *string `json:"response_format"` 51 52 // ttl 53 TTL Uint64 `json:"ttl,omitempty"` 54 } 55 56 // Validate validates this oracle register tx 57 func (m *OracleRegisterTx) Validate(formats strfmt.Registry) error { 58 var res []error 59 60 if err := m.validateAbiVersion(formats); err != nil { 61 res = append(res, err) 62 } 63 64 if err := m.validateAccountID(formats); err != nil { 65 res = append(res, err) 66 } 67 68 if err := m.validateFee(formats); err != nil { 69 res = append(res, err) 70 } 71 72 if err := m.validateNonce(formats); err != nil { 73 res = append(res, err) 74 } 75 76 if err := m.validateOracleTTL(formats); err != nil { 77 res = append(res, err) 78 } 79 80 if err := m.validateQueryFee(formats); err != nil { 81 res = append(res, err) 82 } 83 84 if err := m.validateQueryFormat(formats); err != nil { 85 res = append(res, err) 86 } 87 88 if err := m.validateResponseFormat(formats); err != nil { 89 res = append(res, err) 90 } 91 92 if err := m.validateTTL(formats); err != nil { 93 res = append(res, err) 94 } 95 96 if len(res) > 0 { 97 return errors.CompositeValidationError(res...) 98 } 99 return nil 100 } 101 102 func (m *OracleRegisterTx) validateAbiVersion(formats strfmt.Registry) error { 103 104 if swag.IsZero(m.AbiVersion) { // not required 105 return nil 106 } 107 108 if err := m.AbiVersion.Validate(formats); err != nil { 109 if ve, ok := err.(*errors.Validation); ok { 110 return ve.ValidateName("abi_version") 111 } 112 return err 113 } 114 115 return nil 116 } 117 118 func (m *OracleRegisterTx) validateAccountID(formats strfmt.Registry) error { 119 120 if err := m.AccountID.Validate(formats); err != nil { 121 if ve, ok := err.(*errors.Validation); ok { 122 return ve.ValidateName("account_id") 123 } 124 return err 125 } 126 127 return nil 128 } 129 130 func (m *OracleRegisterTx) validateFee(formats strfmt.Registry) error { 131 132 if err := m.Fee.Validate(formats); err != nil { 133 if ve, ok := err.(*errors.Validation); ok { 134 return ve.ValidateName("fee") 135 } 136 return err 137 } 138 139 return nil 140 } 141 142 func (m *OracleRegisterTx) validateNonce(formats strfmt.Registry) error { 143 144 if swag.IsZero(m.Nonce) { // not required 145 return nil 146 } 147 148 if err := m.Nonce.Validate(formats); err != nil { 149 if ve, ok := err.(*errors.Validation); ok { 150 return ve.ValidateName("nonce") 151 } 152 return err 153 } 154 155 return nil 156 } 157 158 func (m *OracleRegisterTx) validateOracleTTL(formats strfmt.Registry) error { 159 160 if err := validate.Required("oracle_ttl", "body", m.OracleTTL); err != nil { 161 return err 162 } 163 164 if m.OracleTTL != nil { 165 if err := m.OracleTTL.Validate(formats); err != nil { 166 if ve, ok := err.(*errors.Validation); ok { 167 return ve.ValidateName("oracle_ttl") 168 } 169 return err 170 } 171 } 172 173 return nil 174 } 175 176 func (m *OracleRegisterTx) validateQueryFee(formats strfmt.Registry) error { 177 178 if err := m.QueryFee.Validate(formats); err != nil { 179 if ve, ok := err.(*errors.Validation); ok { 180 return ve.ValidateName("query_fee") 181 } 182 return err 183 } 184 185 return nil 186 } 187 188 func (m *OracleRegisterTx) validateQueryFormat(formats strfmt.Registry) error { 189 190 if err := validate.Required("query_format", "body", m.QueryFormat); err != nil { 191 return err 192 } 193 194 return nil 195 } 196 197 func (m *OracleRegisterTx) validateResponseFormat(formats strfmt.Registry) error { 198 199 if err := validate.Required("response_format", "body", m.ResponseFormat); err != nil { 200 return err 201 } 202 203 return nil 204 } 205 206 func (m *OracleRegisterTx) validateTTL(formats strfmt.Registry) error { 207 208 if swag.IsZero(m.TTL) { // not required 209 return nil 210 } 211 212 if err := m.TTL.Validate(formats); err != nil { 213 if ve, ok := err.(*errors.Validation); ok { 214 return ve.ValidateName("ttl") 215 } 216 return err 217 } 218 219 return nil 220 } 221 222 // MarshalBinary interface implementation 223 func (m *OracleRegisterTx) MarshalBinary() ([]byte, error) { 224 if m == nil { 225 return nil, nil 226 } 227 return swag.WriteJSON(m) 228 } 229 230 // UnmarshalBinary interface implementation 231 func (m *OracleRegisterTx) UnmarshalBinary(b []byte) error { 232 var res OracleRegisterTx 233 if err := swag.ReadJSON(b, &res); err != nil { 234 return err 235 } 236 *m = res 237 return nil 238 }