github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/name_preclaim_tx.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  // NamePreclaimTx name preclaim tx
    19  // swagger:model NamePreclaimTx
    20  type NamePreclaimTx struct {
    21  
    22  	// account id
    23  	// Required: true
    24  	AccountID *string `json:"account_id"`
    25  
    26  	// commitment id
    27  	// Required: true
    28  	CommitmentID *string `json:"commitment_id"`
    29  
    30  	// fee
    31  	// Required: true
    32  	Fee utils.BigInt `json:"fee"`
    33  
    34  	// nonce
    35  	Nonce uint64 `json:"nonce,omitempty"`
    36  
    37  	// ttl
    38  	TTL uint64 `json:"ttl,omitempty"`
    39  }
    40  
    41  // Validate validates this name preclaim tx
    42  func (m *NamePreclaimTx) Validate(formats strfmt.Registry) error {
    43  	var res []error
    44  
    45  	if err := m.validateAccountID(formats); err != nil {
    46  		res = append(res, err)
    47  	}
    48  
    49  	if err := m.validateCommitmentID(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if err := m.validateFee(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 *NamePreclaimTx) validateAccountID(formats strfmt.Registry) error {
    64  
    65  	if err := validate.Required("account_id", "body", m.AccountID); err != nil {
    66  		return err
    67  	}
    68  
    69  	return nil
    70  }
    71  
    72  func (m *NamePreclaimTx) validateCommitmentID(formats strfmt.Registry) error {
    73  
    74  	if err := validate.Required("commitment_id", "body", m.CommitmentID); err != nil {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  func (m *NamePreclaimTx) validateFee(formats strfmt.Registry) error {
    82  
    83  	if err := m.Fee.Validate(formats); err != nil {
    84  		if ve, ok := err.(*errors.Validation); ok {
    85  			return ve.ValidateName("fee")
    86  		}
    87  		return err
    88  	}
    89  
    90  	return nil
    91  }
    92  
    93  // MarshalBinary interface implementation
    94  func (m *NamePreclaimTx) 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 *NamePreclaimTx) UnmarshalBinary(b []byte) error {
   103  	var res NamePreclaimTx
   104  	if err := swag.ReadJSON(b, &res); err != nil {
   105  		return err
   106  	}
   107  	*m = res
   108  	return nil
   109  }