github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_register_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  // OracleRegisterTx oracle register tx
    19  // swagger:model OracleRegisterTx
    20  type OracleRegisterTx struct {
    21  
    22  	// abi version
    23  	AbiVersion uint16 `json:"abi_version,omitempty"`
    24  
    25  	// account id
    26  	// Required: true
    27  	AccountID *string `json:"account_id"`
    28  
    29  	// fee
    30  	// Required: true
    31  	Fee utils.BigInt `json:"fee"`
    32  
    33  	// nonce
    34  	Nonce uint64 `json:"nonce,omitempty"`
    35  
    36  	// oracle ttl
    37  	// Required: true
    38  	OracleTTL *TTL `json:"oracle_ttl"`
    39  
    40  	// query fee
    41  	// Required: true
    42  	QueryFee utils.BigInt `json:"query_fee"`
    43  
    44  	// query format
    45  	// Required: true
    46  	QueryFormat *string `json:"query_format"`
    47  
    48  	// response format
    49  	// Required: true
    50  	ResponseFormat *string `json:"response_format"`
    51  
    52  	// ttl
    53  	TTL uint64 `json:"ttl,omitempty"`
    54  }
    55  
    56  // Validate validates this oracle register tx
    57  func (m *OracleRegisterTx) Validate(formats strfmt.Registry) error {
    58  	var res []error
    59  
    60  	if err := m.validateAccountID(formats); err != nil {
    61  		res = append(res, err)
    62  	}
    63  
    64  	if err := m.validateFee(formats); err != nil {
    65  		res = append(res, err)
    66  	}
    67  
    68  	if err := m.validateOracleTTL(formats); err != nil {
    69  		res = append(res, err)
    70  	}
    71  
    72  	if err := m.validateQueryFee(formats); err != nil {
    73  		res = append(res, err)
    74  	}
    75  
    76  	if err := m.validateQueryFormat(formats); err != nil {
    77  		res = append(res, err)
    78  	}
    79  
    80  	if err := m.validateResponseFormat(formats); err != nil {
    81  		res = append(res, err)
    82  	}
    83  
    84  	if len(res) > 0 {
    85  		return errors.CompositeValidationError(res...)
    86  	}
    87  	return nil
    88  }
    89  
    90  func (m *OracleRegisterTx) validateAccountID(formats strfmt.Registry) error {
    91  
    92  	if err := validate.Required("account_id", "body", m.AccountID); err != nil {
    93  		return err
    94  	}
    95  
    96  	return nil
    97  }
    98  
    99  func (m *OracleRegisterTx) validateFee(formats strfmt.Registry) error {
   100  
   101  	if err := m.Fee.Validate(formats); err != nil {
   102  		if ve, ok := err.(*errors.Validation); ok {
   103  			return ve.ValidateName("fee")
   104  		}
   105  		return err
   106  	}
   107  
   108  	return nil
   109  }
   110  
   111  func (m *OracleRegisterTx) validateOracleTTL(formats strfmt.Registry) error {
   112  
   113  	if err := validate.Required("oracle_ttl", "body", m.OracleTTL); err != nil {
   114  		return err
   115  	}
   116  
   117  	if m.OracleTTL != nil {
   118  		if err := m.OracleTTL.Validate(formats); err != nil {
   119  			if ve, ok := err.(*errors.Validation); ok {
   120  				return ve.ValidateName("oracle_ttl")
   121  			}
   122  			return err
   123  		}
   124  	}
   125  
   126  	return nil
   127  }
   128  
   129  func (m *OracleRegisterTx) validateQueryFee(formats strfmt.Registry) error {
   130  
   131  	if err := m.QueryFee.Validate(formats); err != nil {
   132  		if ve, ok := err.(*errors.Validation); ok {
   133  			return ve.ValidateName("query_fee")
   134  		}
   135  		return err
   136  	}
   137  
   138  	return nil
   139  }
   140  
   141  func (m *OracleRegisterTx) validateQueryFormat(formats strfmt.Registry) error {
   142  
   143  	if err := validate.Required("query_format", "body", m.QueryFormat); err != nil {
   144  		return err
   145  	}
   146  
   147  	return nil
   148  }
   149  
   150  func (m *OracleRegisterTx) validateResponseFormat(formats strfmt.Registry) error {
   151  
   152  	if err := validate.Required("response_format", "body", m.ResponseFormat); err != nil {
   153  		return err
   154  	}
   155  
   156  	return nil
   157  }
   158  
   159  // MarshalBinary interface implementation
   160  func (m *OracleRegisterTx) MarshalBinary() ([]byte, error) {
   161  	if m == nil {
   162  		return nil, nil
   163  	}
   164  	return swag.WriteJSON(m)
   165  }
   166  
   167  // UnmarshalBinary interface implementation
   168  func (m *OracleRegisterTx) UnmarshalBinary(b []byte) error {
   169  	var res OracleRegisterTx
   170  	if err := swag.ReadJSON(b, &res); err != nil {
   171  		return err
   172  	}
   173  	*m = res
   174  	return nil
   175  }