github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/dry_run_account.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  // DryRunAccount dry run account
    19  // swagger:model DryRunAccount
    20  type DryRunAccount struct {
    21  
    22  	// amount
    23  	// Required: true
    24  	Amount utils.BigInt `json:"amount"`
    25  
    26  	// pub key
    27  	// Required: true
    28  	PubKey *string `json:"pub_key"`
    29  }
    30  
    31  // Validate validates this dry run account
    32  func (m *DryRunAccount) Validate(formats strfmt.Registry) error {
    33  	var res []error
    34  
    35  	if err := m.validateAmount(formats); err != nil {
    36  		res = append(res, err)
    37  	}
    38  
    39  	if err := m.validatePubKey(formats); err != nil {
    40  		res = append(res, err)
    41  	}
    42  
    43  	if len(res) > 0 {
    44  		return errors.CompositeValidationError(res...)
    45  	}
    46  	return nil
    47  }
    48  
    49  func (m *DryRunAccount) validateAmount(formats strfmt.Registry) error {
    50  
    51  	if err := m.Amount.Validate(formats); err != nil {
    52  		if ve, ok := err.(*errors.Validation); ok {
    53  			return ve.ValidateName("amount")
    54  		}
    55  		return err
    56  	}
    57  
    58  	return nil
    59  }
    60  
    61  func (m *DryRunAccount) validatePubKey(formats strfmt.Registry) error {
    62  
    63  	if err := validate.Required("pub_key", "body", m.PubKey); err != nil {
    64  		return err
    65  	}
    66  
    67  	return nil
    68  }
    69  
    70  // MarshalBinary interface implementation
    71  func (m *DryRunAccount) MarshalBinary() ([]byte, error) {
    72  	if m == nil {
    73  		return nil, nil
    74  	}
    75  	return swag.WriteJSON(m)
    76  }
    77  
    78  // UnmarshalBinary interface implementation
    79  func (m *DryRunAccount) UnmarshalBinary(b []byte) error {
    80  	var res DryRunAccount
    81  	if err := swag.ReadJSON(b, &res); err != nil {
    82  		return err
    83  	}
    84  	*m = res
    85  	return nil
    86  }