github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/contract_call_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  	"strconv"
    10  
    11  	strfmt "github.com/go-openapi/strfmt"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/swag"
    15  	"github.com/go-openapi/validate"
    16  
    17  	utils "github.com/aeternity/aepp-sdk-go/utils"
    18  )
    19  
    20  // ContractCallObject contract call object
    21  // swagger:model ContractCallObject
    22  type ContractCallObject struct {
    23  
    24  	// caller id
    25  	// Required: true
    26  	CallerID *string `json:"caller_id"`
    27  
    28  	// caller nonce
    29  	// Required: true
    30  	CallerNonce *uint64 `json:"caller_nonce"`
    31  
    32  	// contract id
    33  	// Required: true
    34  	ContractID *string `json:"contract_id"`
    35  
    36  	// gas price
    37  	// Required: true
    38  	GasPrice utils.BigInt `json:"gas_price"`
    39  
    40  	// gas used
    41  	// Required: true
    42  	GasUsed *uint64 `json:"gas_used"`
    43  
    44  	// height
    45  	// Required: true
    46  	Height *uint64 `json:"height"`
    47  
    48  	// log
    49  	// Required: true
    50  	Log []*Event `json:"log"`
    51  
    52  	// The status of the call 'ok | error | revert'.
    53  	// Required: true
    54  	ReturnType *string `json:"return_type"`
    55  
    56  	// return value
    57  	// Required: true
    58  	ReturnValue *string `json:"return_value"`
    59  }
    60  
    61  // Validate validates this contract call object
    62  func (m *ContractCallObject) Validate(formats strfmt.Registry) error {
    63  	var res []error
    64  
    65  	if err := m.validateCallerID(formats); err != nil {
    66  		res = append(res, err)
    67  	}
    68  
    69  	if err := m.validateCallerNonce(formats); err != nil {
    70  		res = append(res, err)
    71  	}
    72  
    73  	if err := m.validateContractID(formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  
    77  	if err := m.validateGasPrice(formats); err != nil {
    78  		res = append(res, err)
    79  	}
    80  
    81  	if err := m.validateGasUsed(formats); err != nil {
    82  		res = append(res, err)
    83  	}
    84  
    85  	if err := m.validateHeight(formats); err != nil {
    86  		res = append(res, err)
    87  	}
    88  
    89  	if err := m.validateLog(formats); err != nil {
    90  		res = append(res, err)
    91  	}
    92  
    93  	if err := m.validateReturnType(formats); err != nil {
    94  		res = append(res, err)
    95  	}
    96  
    97  	if err := m.validateReturnValue(formats); err != nil {
    98  		res = append(res, err)
    99  	}
   100  
   101  	if len(res) > 0 {
   102  		return errors.CompositeValidationError(res...)
   103  	}
   104  	return nil
   105  }
   106  
   107  func (m *ContractCallObject) validateCallerID(formats strfmt.Registry) error {
   108  
   109  	if err := validate.Required("caller_id", "body", m.CallerID); err != nil {
   110  		return err
   111  	}
   112  
   113  	return nil
   114  }
   115  
   116  func (m *ContractCallObject) validateCallerNonce(formats strfmt.Registry) error {
   117  
   118  	if err := validate.Required("caller_nonce", "body", m.CallerNonce); err != nil {
   119  		return err
   120  	}
   121  
   122  	return nil
   123  }
   124  
   125  func (m *ContractCallObject) validateContractID(formats strfmt.Registry) error {
   126  
   127  	if err := validate.Required("contract_id", "body", m.ContractID); err != nil {
   128  		return err
   129  	}
   130  
   131  	return nil
   132  }
   133  
   134  func (m *ContractCallObject) validateGasPrice(formats strfmt.Registry) error {
   135  
   136  	if err := m.GasPrice.Validate(formats); err != nil {
   137  		if ve, ok := err.(*errors.Validation); ok {
   138  			return ve.ValidateName("gas_price")
   139  		}
   140  		return err
   141  	}
   142  
   143  	return nil
   144  }
   145  
   146  func (m *ContractCallObject) validateGasUsed(formats strfmt.Registry) error {
   147  
   148  	if err := validate.Required("gas_used", "body", m.GasUsed); err != nil {
   149  		return err
   150  	}
   151  
   152  	return nil
   153  }
   154  
   155  func (m *ContractCallObject) validateHeight(formats strfmt.Registry) error {
   156  
   157  	if err := validate.Required("height", "body", m.Height); err != nil {
   158  		return err
   159  	}
   160  
   161  	return nil
   162  }
   163  
   164  func (m *ContractCallObject) validateLog(formats strfmt.Registry) error {
   165  
   166  	if err := validate.Required("log", "body", m.Log); err != nil {
   167  		return err
   168  	}
   169  
   170  	for i := 0; i < len(m.Log); i++ {
   171  		if swag.IsZero(m.Log[i]) { // not required
   172  			continue
   173  		}
   174  
   175  		if m.Log[i] != nil {
   176  			if err := m.Log[i].Validate(formats); err != nil {
   177  				if ve, ok := err.(*errors.Validation); ok {
   178  					return ve.ValidateName("log" + "." + strconv.Itoa(i))
   179  				}
   180  				return err
   181  			}
   182  		}
   183  
   184  	}
   185  
   186  	return nil
   187  }
   188  
   189  func (m *ContractCallObject) validateReturnType(formats strfmt.Registry) error {
   190  
   191  	if err := validate.Required("return_type", "body", m.ReturnType); err != nil {
   192  		return err
   193  	}
   194  
   195  	return nil
   196  }
   197  
   198  func (m *ContractCallObject) validateReturnValue(formats strfmt.Registry) error {
   199  
   200  	if err := validate.Required("return_value", "body", m.ReturnValue); err != nil {
   201  		return err
   202  	}
   203  
   204  	return nil
   205  }
   206  
   207  // MarshalBinary interface implementation
   208  func (m *ContractCallObject) MarshalBinary() ([]byte, error) {
   209  	if m == nil {
   210  		return nil, nil
   211  	}
   212  	return swag.WriteJSON(m)
   213  }
   214  
   215  // UnmarshalBinary interface implementation
   216  func (m *ContractCallObject) UnmarshalBinary(b []byte) error {
   217  	var res ContractCallObject
   218  	if err := swag.ReadJSON(b, &res); err != nil {
   219  		return err
   220  	}
   221  	*m = res
   222  	return nil
   223  }