github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_extend_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  // OracleExtendTx oracle extend tx
    19  // swagger:model OracleExtendTx
    20  type OracleExtendTx struct {
    21  
    22  	// fee
    23  	// Required: true
    24  	Fee utils.BigInt `json:"fee"`
    25  
    26  	// nonce
    27  	Nonce uint64 `json:"nonce,omitempty"`
    28  
    29  	// oracle id
    30  	// Required: true
    31  	OracleID *string `json:"oracle_id"`
    32  
    33  	// oracle ttl
    34  	// Required: true
    35  	OracleTTL *RelativeTTL `json:"oracle_ttl"`
    36  
    37  	// ttl
    38  	TTL uint64 `json:"ttl,omitempty"`
    39  }
    40  
    41  // Validate validates this oracle extend tx
    42  func (m *OracleExtendTx) Validate(formats strfmt.Registry) error {
    43  	var res []error
    44  
    45  	if err := m.validateFee(formats); err != nil {
    46  		res = append(res, err)
    47  	}
    48  
    49  	if err := m.validateOracleID(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if err := m.validateOracleTTL(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 *OracleExtendTx) validateFee(formats strfmt.Registry) error {
    64  
    65  	if err := m.Fee.Validate(formats); err != nil {
    66  		if ve, ok := err.(*errors.Validation); ok {
    67  			return ve.ValidateName("fee")
    68  		}
    69  		return err
    70  	}
    71  
    72  	return nil
    73  }
    74  
    75  func (m *OracleExtendTx) validateOracleID(formats strfmt.Registry) error {
    76  
    77  	if err := validate.Required("oracle_id", "body", m.OracleID); err != nil {
    78  		return err
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  func (m *OracleExtendTx) validateOracleTTL(formats strfmt.Registry) error {
    85  
    86  	if err := validate.Required("oracle_ttl", "body", m.OracleTTL); err != nil {
    87  		return err
    88  	}
    89  
    90  	if m.OracleTTL != nil {
    91  		if err := m.OracleTTL.Validate(formats); err != nil {
    92  			if ve, ok := err.(*errors.Validation); ok {
    93  				return ve.ValidateName("oracle_ttl")
    94  			}
    95  			return err
    96  		}
    97  	}
    98  
    99  	return nil
   100  }
   101  
   102  // MarshalBinary interface implementation
   103  func (m *OracleExtendTx) MarshalBinary() ([]byte, error) {
   104  	if m == nil {
   105  		return nil, nil
   106  	}
   107  	return swag.WriteJSON(m)
   108  }
   109  
   110  // UnmarshalBinary interface implementation
   111  func (m *OracleExtendTx) UnmarshalBinary(b []byte) error {
   112  	var res OracleExtendTx
   113  	if err := swag.ReadJSON(b, &res); err != nil {
   114  		return err
   115  	}
   116  	*m = res
   117  	return nil
   118  }