github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/dry_run_result.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  // DryRunResult dry run result
    17  // swagger:model DryRunResult
    18  type DryRunResult struct {
    19  
    20  	// call obj
    21  	CallObj *ContractCallObject `json:"call_obj,omitempty"`
    22  
    23  	// reason
    24  	Reason string `json:"reason,omitempty"`
    25  
    26  	// result
    27  	// Required: true
    28  	Result *string `json:"result"`
    29  
    30  	// type
    31  	// Required: true
    32  	Type *string `json:"type"`
    33  }
    34  
    35  // Validate validates this dry run result
    36  func (m *DryRunResult) Validate(formats strfmt.Registry) error {
    37  	var res []error
    38  
    39  	if err := m.validateCallObj(formats); err != nil {
    40  		res = append(res, err)
    41  	}
    42  
    43  	if err := m.validateResult(formats); err != nil {
    44  		res = append(res, err)
    45  	}
    46  
    47  	if err := m.validateType(formats); err != nil {
    48  		res = append(res, err)
    49  	}
    50  
    51  	if len(res) > 0 {
    52  		return errors.CompositeValidationError(res...)
    53  	}
    54  	return nil
    55  }
    56  
    57  func (m *DryRunResult) validateCallObj(formats strfmt.Registry) error {
    58  
    59  	if swag.IsZero(m.CallObj) { // not required
    60  		return nil
    61  	}
    62  
    63  	if m.CallObj != nil {
    64  		if err := m.CallObj.Validate(formats); err != nil {
    65  			if ve, ok := err.(*errors.Validation); ok {
    66  				return ve.ValidateName("call_obj")
    67  			}
    68  			return err
    69  		}
    70  	}
    71  
    72  	return nil
    73  }
    74  
    75  func (m *DryRunResult) validateResult(formats strfmt.Registry) error {
    76  
    77  	if err := validate.Required("result", "body", m.Result); err != nil {
    78  		return err
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  func (m *DryRunResult) validateType(formats strfmt.Registry) error {
    85  
    86  	if err := validate.Required("type", "body", m.Type); err != nil {
    87  		return err
    88  	}
    89  
    90  	return nil
    91  }
    92  
    93  // MarshalBinary interface implementation
    94  func (m *DryRunResult) MarshalBinary() ([]byte, error) {
    95  	if m == nil {
    96  		return nil, nil
    97  	}
    98  	return swag.WriteJSON(m)
    99  }
   100  
   101  // UnmarshalBinary interface implementation
   102  func (m *DryRunResult) UnmarshalBinary(b []byte) error {
   103  	var res DryRunResult
   104  	if err := swag.ReadJSON(b, &res); err != nil {
   105  		return err
   106  	}
   107  	*m = res
   108  	return nil
   109  }