github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/channel_close_mutual_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  // ChannelCloseMutualTx channel close mutual tx
    19  // swagger:model ChannelCloseMutualTx
    20  type ChannelCloseMutualTx struct {
    21  
    22  	// channel id
    23  	// Required: true
    24  	ChannelID *string `json:"channel_id"`
    25  
    26  	// fee
    27  	// Required: true
    28  	Fee *uint64 `json:"fee"`
    29  
    30  	// from id
    31  	// Required: true
    32  	FromID *string `json:"from_id"`
    33  
    34  	// initiator amount final
    35  	// Required: true
    36  	InitiatorAmountFinal utils.BigInt `json:"initiator_amount_final"`
    37  
    38  	// nonce
    39  	// Required: true
    40  	Nonce *uint64 `json:"nonce"`
    41  
    42  	// responder amount final
    43  	// Required: true
    44  	ResponderAmountFinal utils.BigInt `json:"responder_amount_final"`
    45  
    46  	// ttl
    47  	TTL uint64 `json:"ttl,omitempty"`
    48  }
    49  
    50  // Validate validates this channel close mutual tx
    51  func (m *ChannelCloseMutualTx) Validate(formats strfmt.Registry) error {
    52  	var res []error
    53  
    54  	if err := m.validateChannelID(formats); err != nil {
    55  		res = append(res, err)
    56  	}
    57  
    58  	if err := m.validateFee(formats); err != nil {
    59  		res = append(res, err)
    60  	}
    61  
    62  	if err := m.validateFromID(formats); err != nil {
    63  		res = append(res, err)
    64  	}
    65  
    66  	if err := m.validateInitiatorAmountFinal(formats); err != nil {
    67  		res = append(res, err)
    68  	}
    69  
    70  	if err := m.validateNonce(formats); err != nil {
    71  		res = append(res, err)
    72  	}
    73  
    74  	if err := m.validateResponderAmountFinal(formats); err != nil {
    75  		res = append(res, err)
    76  	}
    77  
    78  	if len(res) > 0 {
    79  		return errors.CompositeValidationError(res...)
    80  	}
    81  	return nil
    82  }
    83  
    84  func (m *ChannelCloseMutualTx) validateChannelID(formats strfmt.Registry) error {
    85  
    86  	if err := validate.Required("channel_id", "body", m.ChannelID); err != nil {
    87  		return err
    88  	}
    89  
    90  	return nil
    91  }
    92  
    93  func (m *ChannelCloseMutualTx) validateFee(formats strfmt.Registry) error {
    94  
    95  	if err := validate.Required("fee", "body", m.Fee); err != nil {
    96  		return err
    97  	}
    98  
    99  	return nil
   100  }
   101  
   102  func (m *ChannelCloseMutualTx) validateFromID(formats strfmt.Registry) error {
   103  
   104  	if err := validate.Required("from_id", "body", m.FromID); err != nil {
   105  		return err
   106  	}
   107  
   108  	return nil
   109  }
   110  
   111  func (m *ChannelCloseMutualTx) validateInitiatorAmountFinal(formats strfmt.Registry) error {
   112  
   113  	if err := m.InitiatorAmountFinal.Validate(formats); err != nil {
   114  		if ve, ok := err.(*errors.Validation); ok {
   115  			return ve.ValidateName("initiator_amount_final")
   116  		}
   117  		return err
   118  	}
   119  
   120  	return nil
   121  }
   122  
   123  func (m *ChannelCloseMutualTx) validateNonce(formats strfmt.Registry) error {
   124  
   125  	if err := validate.Required("nonce", "body", m.Nonce); err != nil {
   126  		return err
   127  	}
   128  
   129  	return nil
   130  }
   131  
   132  func (m *ChannelCloseMutualTx) validateResponderAmountFinal(formats strfmt.Registry) error {
   133  
   134  	if err := m.ResponderAmountFinal.Validate(formats); err != nil {
   135  		if ve, ok := err.(*errors.Validation); ok {
   136  			return ve.ValidateName("responder_amount_final")
   137  		}
   138  		return err
   139  	}
   140  
   141  	return nil
   142  }
   143  
   144  // MarshalBinary interface implementation
   145  func (m *ChannelCloseMutualTx) MarshalBinary() ([]byte, error) {
   146  	if m == nil {
   147  		return nil, nil
   148  	}
   149  	return swag.WriteJSON(m)
   150  }
   151  
   152  // UnmarshalBinary interface implementation
   153  func (m *ChannelCloseMutualTx) UnmarshalBinary(b []byte) error {
   154  	var res ChannelCloseMutualTx
   155  	if err := swag.ReadJSON(b, &res); err != nil {
   156  		return err
   157  	}
   158  	*m = res
   159  	return nil
   160  }