github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_query_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 // OracleQueryTx oracle query tx 19 // swagger:model OracleQueryTx 20 type OracleQueryTx struct { 21 22 // fee 23 // Required: true 24 Fee utils.BigInt `json:"fee"` 25 26 // Sender nonce 27 Nonce uint64 `json:"nonce,omitempty"` 28 29 // oracle id 30 // Required: true 31 OracleID *string `json:"oracle_id"` 32 33 // query 34 // Required: true 35 Query *string `json:"query"` 36 37 // query fee 38 // Required: true 39 QueryFee utils.BigInt `json:"query_fee"` 40 41 // query ttl 42 // Required: true 43 QueryTTL *TTL `json:"query_ttl"` 44 45 // response ttl 46 // Required: true 47 ResponseTTL *RelativeTTL `json:"response_ttl"` 48 49 // sender id 50 // Required: true 51 SenderID *string `json:"sender_id"` 52 53 // ttl 54 TTL uint64 `json:"ttl,omitempty"` 55 } 56 57 // Validate validates this oracle query tx 58 func (m *OracleQueryTx) Validate(formats strfmt.Registry) error { 59 var res []error 60 61 if err := m.validateFee(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validateOracleID(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validateQuery(formats); err != nil { 70 res = append(res, err) 71 } 72 73 if err := m.validateQueryFee(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if err := m.validateQueryTTL(formats); err != nil { 78 res = append(res, err) 79 } 80 81 if err := m.validateResponseTTL(formats); err != nil { 82 res = append(res, err) 83 } 84 85 if err := m.validateSenderID(formats); err != nil { 86 res = append(res, err) 87 } 88 89 if len(res) > 0 { 90 return errors.CompositeValidationError(res...) 91 } 92 return nil 93 } 94 95 func (m *OracleQueryTx) validateFee(formats strfmt.Registry) error { 96 97 if err := m.Fee.Validate(formats); err != nil { 98 if ve, ok := err.(*errors.Validation); ok { 99 return ve.ValidateName("fee") 100 } 101 return err 102 } 103 104 return nil 105 } 106 107 func (m *OracleQueryTx) validateOracleID(formats strfmt.Registry) error { 108 109 if err := validate.Required("oracle_id", "body", m.OracleID); err != nil { 110 return err 111 } 112 113 return nil 114 } 115 116 func (m *OracleQueryTx) validateQuery(formats strfmt.Registry) error { 117 118 if err := validate.Required("query", "body", m.Query); err != nil { 119 return err 120 } 121 122 return nil 123 } 124 125 func (m *OracleQueryTx) validateQueryFee(formats strfmt.Registry) error { 126 127 if err := m.QueryFee.Validate(formats); err != nil { 128 if ve, ok := err.(*errors.Validation); ok { 129 return ve.ValidateName("query_fee") 130 } 131 return err 132 } 133 134 return nil 135 } 136 137 func (m *OracleQueryTx) validateQueryTTL(formats strfmt.Registry) error { 138 139 if err := validate.Required("query_ttl", "body", m.QueryTTL); err != nil { 140 return err 141 } 142 143 if m.QueryTTL != nil { 144 if err := m.QueryTTL.Validate(formats); err != nil { 145 if ve, ok := err.(*errors.Validation); ok { 146 return ve.ValidateName("query_ttl") 147 } 148 return err 149 } 150 } 151 152 return nil 153 } 154 155 func (m *OracleQueryTx) validateResponseTTL(formats strfmt.Registry) error { 156 157 if err := validate.Required("response_ttl", "body", m.ResponseTTL); err != nil { 158 return err 159 } 160 161 if m.ResponseTTL != nil { 162 if err := m.ResponseTTL.Validate(formats); err != nil { 163 if ve, ok := err.(*errors.Validation); ok { 164 return ve.ValidateName("response_ttl") 165 } 166 return err 167 } 168 } 169 170 return nil 171 } 172 173 func (m *OracleQueryTx) validateSenderID(formats strfmt.Registry) error { 174 175 if err := validate.Required("sender_id", "body", m.SenderID); err != nil { 176 return err 177 } 178 179 return nil 180 } 181 182 // MarshalBinary interface implementation 183 func (m *OracleQueryTx) MarshalBinary() ([]byte, error) { 184 if m == nil { 185 return nil, nil 186 } 187 return swag.WriteJSON(m) 188 } 189 190 // UnmarshalBinary interface implementation 191 func (m *OracleQueryTx) UnmarshalBinary(b []byte) error { 192 var res OracleQueryTx 193 if err := swag.ReadJSON(b, &res); err != nil { 194 return err 195 } 196 *m = res 197 return nil 198 }