github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/name_revoke_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  // NameRevokeTx name revoke tx
    19  // swagger:model NameRevokeTx
    20  type NameRevokeTx struct {
    21  
    22  	// account id
    23  	// Required: true
    24  	AccountID *string `json:"account_id"`
    25  
    26  	// fee
    27  	// Required: true
    28  	Fee utils.BigInt `json:"fee"`
    29  
    30  	// name id
    31  	// Required: true
    32  	NameID *string `json:"name_id"`
    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 revoke tx
    42  func (m *NameRevokeTx) 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.validateFee(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if err := m.validateNameID(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 *NameRevokeTx) 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 *NameRevokeTx) validateFee(formats strfmt.Registry) error {
    73  
    74  	if err := m.Fee.Validate(formats); err != nil {
    75  		if ve, ok := err.(*errors.Validation); ok {
    76  			return ve.ValidateName("fee")
    77  		}
    78  		return err
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  func (m *NameRevokeTx) validateNameID(formats strfmt.Registry) error {
    85  
    86  	if err := validate.Required("name_id", "body", m.NameID); err != nil {
    87  		return err
    88  	}
    89  
    90  	return nil
    91  }
    92  
    93  // MarshalBinary interface implementation
    94  func (m *NameRevokeTx) 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 *NameRevokeTx) UnmarshalBinary(b []byte) error {
   103  	var res NameRevokeTx
   104  	if err := swag.ReadJSON(b, &res); err != nil {
   105  		return err
   106  	}
   107  	*m = res
   108  	return nil
   109  }