github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/contract_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 "github.com/go-openapi/validate" 14 ) 15 16 // ContractObject contract object 17 // swagger:model ContractObject 18 type ContractObject struct { 19 20 // abi version 21 // Required: true 22 AbiVersion *uint16 `json:"abi_version"` 23 24 // active 25 // Required: true 26 Active *bool `json:"active"` 27 28 // deposit 29 // Required: true 30 Deposit *uint64 `json:"deposit"` 31 32 // id 33 // Required: true 34 ID *string `json:"id"` 35 36 // owner id 37 // Required: true 38 OwnerID *string `json:"owner_id"` 39 40 // referrer ids 41 // Required: true 42 ReferrerIds []string `json:"referrer_ids"` 43 44 // vm version 45 // Required: true 46 VMVersion *uint16 `json:"vm_version"` 47 } 48 49 // Validate validates this contract object 50 func (m *ContractObject) Validate(formats strfmt.Registry) error { 51 var res []error 52 53 if err := m.validateAbiVersion(formats); err != nil { 54 res = append(res, err) 55 } 56 57 if err := m.validateActive(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validateDeposit(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validateID(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validateOwnerID(formats); err != nil { 70 res = append(res, err) 71 } 72 73 if err := m.validateReferrerIds(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if err := m.validateVMVersion(formats); err != nil { 78 res = append(res, err) 79 } 80 81 if len(res) > 0 { 82 return errors.CompositeValidationError(res...) 83 } 84 return nil 85 } 86 87 func (m *ContractObject) validateAbiVersion(formats strfmt.Registry) error { 88 89 if err := validate.Required("abi_version", "body", m.AbiVersion); err != nil { 90 return err 91 } 92 93 return nil 94 } 95 96 func (m *ContractObject) validateActive(formats strfmt.Registry) error { 97 98 if err := validate.Required("active", "body", m.Active); err != nil { 99 return err 100 } 101 102 return nil 103 } 104 105 func (m *ContractObject) validateDeposit(formats strfmt.Registry) error { 106 107 if err := validate.Required("deposit", "body", m.Deposit); err != nil { 108 return err 109 } 110 111 return nil 112 } 113 114 func (m *ContractObject) validateID(formats strfmt.Registry) error { 115 116 if err := validate.Required("id", "body", m.ID); err != nil { 117 return err 118 } 119 120 return nil 121 } 122 123 func (m *ContractObject) validateOwnerID(formats strfmt.Registry) error { 124 125 if err := validate.Required("owner_id", "body", m.OwnerID); err != nil { 126 return err 127 } 128 129 return nil 130 } 131 132 func (m *ContractObject) validateReferrerIds(formats strfmt.Registry) error { 133 134 if err := validate.Required("referrer_ids", "body", m.ReferrerIds); err != nil { 135 return err 136 } 137 138 return nil 139 } 140 141 func (m *ContractObject) validateVMVersion(formats strfmt.Registry) error { 142 143 if err := validate.Required("vm_version", "body", m.VMVersion); err != nil { 144 return err 145 } 146 147 return nil 148 } 149 150 // MarshalBinary interface implementation 151 func (m *ContractObject) MarshalBinary() ([]byte, error) { 152 if m == nil { 153 return nil, nil 154 } 155 return swag.WriteJSON(m) 156 } 157 158 // UnmarshalBinary interface implementation 159 func (m *ContractObject) UnmarshalBinary(b []byte) error { 160 var res ContractObject 161 if err := swag.ReadJSON(b, &res); err != nil { 162 return err 163 } 164 *m = res 165 return nil 166 }