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