github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/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  
    14  	utils "github.com/aeternity/aepp-sdk-go/utils"
    15  )
    16  
    17  // NameRevokeTx name revoke tx
    18  // swagger:model NameRevokeTx
    19  type NameRevokeTx struct {
    20  
    21  	// account id
    22  	// Required: true
    23  	AccountID EncodedPubkey `json:"account_id"`
    24  
    25  	// fee
    26  	// Required: true
    27  	Fee utils.BigInt `json:"fee"`
    28  
    29  	// name id
    30  	// Required: true
    31  	NameID EncodedValue `json:"name_id"`
    32  
    33  	// nonce
    34  	Nonce Uint64 `json:"nonce,omitempty"`
    35  
    36  	// ttl
    37  	TTL Uint64 `json:"ttl,omitempty"`
    38  }
    39  
    40  // Validate validates this name revoke tx
    41  func (m *NameRevokeTx) Validate(formats strfmt.Registry) error {
    42  	var res []error
    43  
    44  	if err := m.validateAccountID(formats); err != nil {
    45  		res = append(res, err)
    46  	}
    47  
    48  	if err := m.validateFee(formats); err != nil {
    49  		res = append(res, err)
    50  	}
    51  
    52  	if err := m.validateNameID(formats); err != nil {
    53  		res = append(res, err)
    54  	}
    55  
    56  	if err := m.validateNonce(formats); err != nil {
    57  		res = append(res, err)
    58  	}
    59  
    60  	if err := m.validateTTL(formats); err != nil {
    61  		res = append(res, err)
    62  	}
    63  
    64  	if len(res) > 0 {
    65  		return errors.CompositeValidationError(res...)
    66  	}
    67  	return nil
    68  }
    69  
    70  func (m *NameRevokeTx) validateAccountID(formats strfmt.Registry) error {
    71  
    72  	if err := m.AccountID.Validate(formats); err != nil {
    73  		if ve, ok := err.(*errors.Validation); ok {
    74  			return ve.ValidateName("account_id")
    75  		}
    76  		return err
    77  	}
    78  
    79  	return nil
    80  }
    81  
    82  func (m *NameRevokeTx) validateFee(formats strfmt.Registry) error {
    83  
    84  	if err := m.Fee.Validate(formats); err != nil {
    85  		if ve, ok := err.(*errors.Validation); ok {
    86  			return ve.ValidateName("fee")
    87  		}
    88  		return err
    89  	}
    90  
    91  	return nil
    92  }
    93  
    94  func (m *NameRevokeTx) validateNameID(formats strfmt.Registry) error {
    95  
    96  	if err := m.NameID.Validate(formats); err != nil {
    97  		if ve, ok := err.(*errors.Validation); ok {
    98  			return ve.ValidateName("name_id")
    99  		}
   100  		return err
   101  	}
   102  
   103  	return nil
   104  }
   105  
   106  func (m *NameRevokeTx) validateNonce(formats strfmt.Registry) error {
   107  
   108  	if swag.IsZero(m.Nonce) { // not required
   109  		return nil
   110  	}
   111  
   112  	if err := m.Nonce.Validate(formats); err != nil {
   113  		if ve, ok := err.(*errors.Validation); ok {
   114  			return ve.ValidateName("nonce")
   115  		}
   116  		return err
   117  	}
   118  
   119  	return nil
   120  }
   121  
   122  func (m *NameRevokeTx) validateTTL(formats strfmt.Registry) error {
   123  
   124  	if swag.IsZero(m.TTL) { // not required
   125  		return nil
   126  	}
   127  
   128  	if err := m.TTL.Validate(formats); err != nil {
   129  		if ve, ok := err.(*errors.Validation); ok {
   130  			return ve.ValidateName("ttl")
   131  		}
   132  		return err
   133  	}
   134  
   135  	return nil
   136  }
   137  
   138  // MarshalBinary interface implementation
   139  func (m *NameRevokeTx) MarshalBinary() ([]byte, error) {
   140  	if m == nil {
   141  		return nil, nil
   142  	}
   143  	return swag.WriteJSON(m)
   144  }
   145  
   146  // UnmarshalBinary interface implementation
   147  func (m *NameRevokeTx) UnmarshalBinary(b []byte) error {
   148  	var res NameRevokeTx
   149  	if err := swag.ReadJSON(b, &res); err != nil {
   150  		return err
   151  	}
   152  	*m = res
   153  	return nil
   154  }