github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_respond_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 // OracleRespondTx oracle respond tx 19 // swagger:model OracleRespondTx 20 type OracleRespondTx struct { 21 22 // fee 23 // Required: true 24 Fee utils.BigInt `json:"fee"` 25 26 // nonce 27 Nonce uint64 `json:"nonce,omitempty"` 28 29 // oracle id 30 // Required: true 31 OracleID *string `json:"oracle_id"` 32 33 // query id 34 // Required: true 35 QueryID *string `json:"query_id"` 36 37 // response 38 // Required: true 39 Response *string `json:"response"` 40 41 // response ttl 42 // Required: true 43 ResponseTTL *RelativeTTL `json:"response_ttl"` 44 45 // ttl 46 TTL uint64 `json:"ttl,omitempty"` 47 } 48 49 // Validate validates this oracle respond tx 50 func (m *OracleRespondTx) Validate(formats strfmt.Registry) error { 51 var res []error 52 53 if err := m.validateFee(formats); err != nil { 54 res = append(res, err) 55 } 56 57 if err := m.validateOracleID(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validateQueryID(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validateResponse(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validateResponseTTL(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 *OracleRespondTx) validateFee(formats strfmt.Registry) error { 80 81 if err := m.Fee.Validate(formats); err != nil { 82 if ve, ok := err.(*errors.Validation); ok { 83 return ve.ValidateName("fee") 84 } 85 return err 86 } 87 88 return nil 89 } 90 91 func (m *OracleRespondTx) validateOracleID(formats strfmt.Registry) error { 92 93 if err := validate.Required("oracle_id", "body", m.OracleID); err != nil { 94 return err 95 } 96 97 return nil 98 } 99 100 func (m *OracleRespondTx) validateQueryID(formats strfmt.Registry) error { 101 102 if err := validate.Required("query_id", "body", m.QueryID); err != nil { 103 return err 104 } 105 106 return nil 107 } 108 109 func (m *OracleRespondTx) validateResponse(formats strfmt.Registry) error { 110 111 if err := validate.Required("response", "body", m.Response); err != nil { 112 return err 113 } 114 115 return nil 116 } 117 118 func (m *OracleRespondTx) validateResponseTTL(formats strfmt.Registry) error { 119 120 if err := validate.Required("response_ttl", "body", m.ResponseTTL); err != nil { 121 return err 122 } 123 124 if m.ResponseTTL != nil { 125 if err := m.ResponseTTL.Validate(formats); err != nil { 126 if ve, ok := err.(*errors.Validation); ok { 127 return ve.ValidateName("response_ttl") 128 } 129 return err 130 } 131 } 132 133 return nil 134 } 135 136 // MarshalBinary interface implementation 137 func (m *OracleRespondTx) MarshalBinary() ([]byte, error) { 138 if m == nil { 139 return nil, nil 140 } 141 return swag.WriteJSON(m) 142 } 143 144 // UnmarshalBinary interface implementation 145 func (m *OracleRespondTx) UnmarshalBinary(b []byte) error { 146 var res OracleRespondTx 147 if err := swag.ReadJSON(b, &res); err != nil { 148 return err 149 } 150 *m = res 151 return nil 152 }