github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/g_a_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  	utils "github.com/aeternity/aepp-sdk-go/utils"
    16  )
    17  
    18  // GAObject g a object
    19  // swagger:model GAObject
    20  type GAObject struct {
    21  
    22  	// caller id
    23  	// Required: true
    24  	CallerID *string `json:"caller_id"`
    25  
    26  	// gas price
    27  	// Required: true
    28  	GasPrice utils.BigInt `json:"gas_price"`
    29  
    30  	// gas used
    31  	// Required: true
    32  	GasUsed *uint64 `json:"gas_used"`
    33  
    34  	// height
    35  	// Required: true
    36  	Height *uint64 `json:"height"`
    37  
    38  	// inner object
    39  	InnerObject *TxInfoObject `json:"inner_object,omitempty"`
    40  
    41  	// The status of the call 'ok | error'.
    42  	// Required: true
    43  	ReturnType *string `json:"return_type"`
    44  
    45  	// return value
    46  	// Required: true
    47  	ReturnValue *string `json:"return_value"`
    48  }
    49  
    50  // Validate validates this g a object
    51  func (m *GAObject) Validate(formats strfmt.Registry) error {
    52  	var res []error
    53  
    54  	if err := m.validateCallerID(formats); err != nil {
    55  		res = append(res, err)
    56  	}
    57  
    58  	if err := m.validateGasPrice(formats); err != nil {
    59  		res = append(res, err)
    60  	}
    61  
    62  	if err := m.validateGasUsed(formats); err != nil {
    63  		res = append(res, err)
    64  	}
    65  
    66  	if err := m.validateHeight(formats); err != nil {
    67  		res = append(res, err)
    68  	}
    69  
    70  	if err := m.validateInnerObject(formats); err != nil {
    71  		res = append(res, err)
    72  	}
    73  
    74  	if err := m.validateReturnType(formats); err != nil {
    75  		res = append(res, err)
    76  	}
    77  
    78  	if err := m.validateReturnValue(formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  
    82  	if len(res) > 0 {
    83  		return errors.CompositeValidationError(res...)
    84  	}
    85  	return nil
    86  }
    87  
    88  func (m *GAObject) validateCallerID(formats strfmt.Registry) error {
    89  
    90  	if err := validate.Required("caller_id", "body", m.CallerID); err != nil {
    91  		return err
    92  	}
    93  
    94  	return nil
    95  }
    96  
    97  func (m *GAObject) validateGasPrice(formats strfmt.Registry) error {
    98  
    99  	if err := m.GasPrice.Validate(formats); err != nil {
   100  		if ve, ok := err.(*errors.Validation); ok {
   101  			return ve.ValidateName("gas_price")
   102  		}
   103  		return err
   104  	}
   105  
   106  	return nil
   107  }
   108  
   109  func (m *GAObject) validateGasUsed(formats strfmt.Registry) error {
   110  
   111  	if err := validate.Required("gas_used", "body", m.GasUsed); err != nil {
   112  		return err
   113  	}
   114  
   115  	return nil
   116  }
   117  
   118  func (m *GAObject) validateHeight(formats strfmt.Registry) error {
   119  
   120  	if err := validate.Required("height", "body", m.Height); err != nil {
   121  		return err
   122  	}
   123  
   124  	return nil
   125  }
   126  
   127  func (m *GAObject) validateInnerObject(formats strfmt.Registry) error {
   128  
   129  	if swag.IsZero(m.InnerObject) { // not required
   130  		return nil
   131  	}
   132  
   133  	if m.InnerObject != nil {
   134  		if err := m.InnerObject.Validate(formats); err != nil {
   135  			if ve, ok := err.(*errors.Validation); ok {
   136  				return ve.ValidateName("inner_object")
   137  			}
   138  			return err
   139  		}
   140  	}
   141  
   142  	return nil
   143  }
   144  
   145  func (m *GAObject) validateReturnType(formats strfmt.Registry) error {
   146  
   147  	if err := validate.Required("return_type", "body", m.ReturnType); err != nil {
   148  		return err
   149  	}
   150  
   151  	return nil
   152  }
   153  
   154  func (m *GAObject) validateReturnValue(formats strfmt.Registry) error {
   155  
   156  	if err := validate.Required("return_value", "body", m.ReturnValue); err != nil {
   157  		return err
   158  	}
   159  
   160  	return nil
   161  }
   162  
   163  // MarshalBinary interface implementation
   164  func (m *GAObject) MarshalBinary() ([]byte, error) {
   165  	if m == nil {
   166  		return nil, nil
   167  	}
   168  	return swag.WriteJSON(m)
   169  }
   170  
   171  // UnmarshalBinary interface implementation
   172  func (m *GAObject) UnmarshalBinary(b []byte) error {
   173  	var res GAObject
   174  	if err := swag.ReadJSON(b, &res); err != nil {
   175  		return err
   176  	}
   177  	*m = res
   178  	return nil
   179  }