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