github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/tx_info_object.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 15 // TxInfoObject tx info object 16 // swagger:model TxInfoObject 17 type TxInfoObject struct { 18 19 // call info 20 CallInfo *ContractCallObject `json:"call_info,omitempty"` 21 22 // ga info 23 GaInfo *GAObject `json:"ga_info,omitempty"` 24 25 // tx info 26 TxInfo string `json:"tx_info,omitempty"` 27 } 28 29 // Validate validates this tx info object 30 func (m *TxInfoObject) Validate(formats strfmt.Registry) error { 31 var res []error 32 33 if err := m.validateCallInfo(formats); err != nil { 34 res = append(res, err) 35 } 36 37 if err := m.validateGaInfo(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if len(res) > 0 { 42 return errors.CompositeValidationError(res...) 43 } 44 return nil 45 } 46 47 func (m *TxInfoObject) validateCallInfo(formats strfmt.Registry) error { 48 49 if swag.IsZero(m.CallInfo) { // not required 50 return nil 51 } 52 53 if m.CallInfo != nil { 54 if err := m.CallInfo.Validate(formats); err != nil { 55 if ve, ok := err.(*errors.Validation); ok { 56 return ve.ValidateName("call_info") 57 } 58 return err 59 } 60 } 61 62 return nil 63 } 64 65 func (m *TxInfoObject) validateGaInfo(formats strfmt.Registry) error { 66 67 if swag.IsZero(m.GaInfo) { // not required 68 return nil 69 } 70 71 if m.GaInfo != nil { 72 if err := m.GaInfo.Validate(formats); err != nil { 73 if ve, ok := err.(*errors.Validation); ok { 74 return ve.ValidateName("ga_info") 75 } 76 return err 77 } 78 } 79 80 return nil 81 } 82 83 // MarshalBinary interface implementation 84 func (m *TxInfoObject) MarshalBinary() ([]byte, error) { 85 if m == nil { 86 return nil, nil 87 } 88 return swag.WriteJSON(m) 89 } 90 91 // UnmarshalBinary interface implementation 92 func (m *TxInfoObject) UnmarshalBinary(b []byte) error { 93 var res TxInfoObject 94 if err := swag.ReadJSON(b, &res); err != nil { 95 return err 96 } 97 *m = res 98 return nil 99 }