github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/compiler/models/sophia_call_result_input.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  // SophiaCallResultInput sophia call result input
    17  // swagger:model SophiaCallResultInput
    18  type SophiaCallResultInput struct {
    19  
    20  	// Call result type (ok | revert | error)
    21  	// Required: true
    22  	CallResult *string `json:"call-result"`
    23  
    24  	// Call result value (ABI encoded data or error string)
    25  	// Required: true
    26  	CallValue *string `json:"call-value"`
    27  
    28  	// Name of the called function
    29  	// Required: true
    30  	Function *string `json:"function"`
    31  
    32  	// (Possibly partial) Sophia contract code/interface
    33  	// Required: true
    34  	Source *string `json:"source"`
    35  }
    36  
    37  // Validate validates this sophia call result input
    38  func (m *SophiaCallResultInput) Validate(formats strfmt.Registry) error {
    39  	var res []error
    40  
    41  	if err := m.validateCallResult(formats); err != nil {
    42  		res = append(res, err)
    43  	}
    44  
    45  	if err := m.validateCallValue(formats); err != nil {
    46  		res = append(res, err)
    47  	}
    48  
    49  	if err := m.validateFunction(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if err := m.validateSource(formats); err != nil {
    54  		res = append(res, err)
    55  	}
    56  
    57  	if len(res) > 0 {
    58  		return errors.CompositeValidationError(res...)
    59  	}
    60  	return nil
    61  }
    62  
    63  func (m *SophiaCallResultInput) validateCallResult(formats strfmt.Registry) error {
    64  
    65  	if err := validate.Required("call-result", "body", m.CallResult); err != nil {
    66  		return err
    67  	}
    68  
    69  	return nil
    70  }
    71  
    72  func (m *SophiaCallResultInput) validateCallValue(formats strfmt.Registry) error {
    73  
    74  	if err := validate.Required("call-value", "body", m.CallValue); err != nil {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  func (m *SophiaCallResultInput) validateFunction(formats strfmt.Registry) error {
    82  
    83  	if err := validate.Required("function", "body", m.Function); err != nil {
    84  		return err
    85  	}
    86  
    87  	return nil
    88  }
    89  
    90  func (m *SophiaCallResultInput) validateSource(formats strfmt.Registry) error {
    91  
    92  	if err := validate.Required("source", "body", m.Source); err != nil {
    93  		return err
    94  	}
    95  
    96  	return nil
    97  }
    98  
    99  // MarshalBinary interface implementation
   100  func (m *SophiaCallResultInput) MarshalBinary() ([]byte, error) {
   101  	if m == nil {
   102  		return nil, nil
   103  	}
   104  	return swag.WriteJSON(m)
   105  }
   106  
   107  // UnmarshalBinary interface implementation
   108  func (m *SophiaCallResultInput) UnmarshalBinary(b []byte) error {
   109  	var res SophiaCallResultInput
   110  	if err := swag.ReadJSON(b, &res); err != nil {
   111  		return err
   112  	}
   113  	*m = res
   114  	return nil
   115  }