github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_query.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  // OracleQuery oracle query
    19  // swagger:model OracleQuery
    20  type OracleQuery struct {
    21  
    22  	// fee
    23  	// Required: true
    24  	Fee utils.BigInt `json:"fee"`
    25  
    26  	// id
    27  	// Required: true
    28  	ID *string `json:"id"`
    29  
    30  	// oracle id
    31  	// Required: true
    32  	OracleID *string `json:"oracle_id"`
    33  
    34  	// query
    35  	// Required: true
    36  	Query *string `json:"query"`
    37  
    38  	// response
    39  	// Required: true
    40  	Response *string `json:"response"`
    41  
    42  	// response ttl
    43  	// Required: true
    44  	ResponseTTL *TTL `json:"response_ttl"`
    45  
    46  	// sender id
    47  	// Required: true
    48  	SenderID *string `json:"sender_id"`
    49  
    50  	// sender nonce
    51  	// Required: true
    52  	SenderNonce *uint64 `json:"sender_nonce"`
    53  
    54  	// ttl
    55  	// Required: true
    56  	TTL *uint64 `json:"ttl"`
    57  }
    58  
    59  // Validate validates this oracle query
    60  func (m *OracleQuery) Validate(formats strfmt.Registry) error {
    61  	var res []error
    62  
    63  	if err := m.validateFee(formats); err != nil {
    64  		res = append(res, err)
    65  	}
    66  
    67  	if err := m.validateID(formats); err != nil {
    68  		res = append(res, err)
    69  	}
    70  
    71  	if err := m.validateOracleID(formats); err != nil {
    72  		res = append(res, err)
    73  	}
    74  
    75  	if err := m.validateQuery(formats); err != nil {
    76  		res = append(res, err)
    77  	}
    78  
    79  	if err := m.validateResponse(formats); err != nil {
    80  		res = append(res, err)
    81  	}
    82  
    83  	if err := m.validateResponseTTL(formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	if err := m.validateSenderID(formats); err != nil {
    88  		res = append(res, err)
    89  	}
    90  
    91  	if err := m.validateSenderNonce(formats); err != nil {
    92  		res = append(res, err)
    93  	}
    94  
    95  	if err := m.validateTTL(formats); err != nil {
    96  		res = append(res, err)
    97  	}
    98  
    99  	if len(res) > 0 {
   100  		return errors.CompositeValidationError(res...)
   101  	}
   102  	return nil
   103  }
   104  
   105  func (m *OracleQuery) validateFee(formats strfmt.Registry) error {
   106  
   107  	if err := m.Fee.Validate(formats); err != nil {
   108  		if ve, ok := err.(*errors.Validation); ok {
   109  			return ve.ValidateName("fee")
   110  		}
   111  		return err
   112  	}
   113  
   114  	return nil
   115  }
   116  
   117  func (m *OracleQuery) validateID(formats strfmt.Registry) error {
   118  
   119  	if err := validate.Required("id", "body", m.ID); err != nil {
   120  		return err
   121  	}
   122  
   123  	return nil
   124  }
   125  
   126  func (m *OracleQuery) validateOracleID(formats strfmt.Registry) error {
   127  
   128  	if err := validate.Required("oracle_id", "body", m.OracleID); err != nil {
   129  		return err
   130  	}
   131  
   132  	return nil
   133  }
   134  
   135  func (m *OracleQuery) validateQuery(formats strfmt.Registry) error {
   136  
   137  	if err := validate.Required("query", "body", m.Query); err != nil {
   138  		return err
   139  	}
   140  
   141  	return nil
   142  }
   143  
   144  func (m *OracleQuery) validateResponse(formats strfmt.Registry) error {
   145  
   146  	if err := validate.Required("response", "body", m.Response); err != nil {
   147  		return err
   148  	}
   149  
   150  	return nil
   151  }
   152  
   153  func (m *OracleQuery) validateResponseTTL(formats strfmt.Registry) error {
   154  
   155  	if err := validate.Required("response_ttl", "body", m.ResponseTTL); err != nil {
   156  		return err
   157  	}
   158  
   159  	if m.ResponseTTL != nil {
   160  		if err := m.ResponseTTL.Validate(formats); err != nil {
   161  			if ve, ok := err.(*errors.Validation); ok {
   162  				return ve.ValidateName("response_ttl")
   163  			}
   164  			return err
   165  		}
   166  	}
   167  
   168  	return nil
   169  }
   170  
   171  func (m *OracleQuery) validateSenderID(formats strfmt.Registry) error {
   172  
   173  	if err := validate.Required("sender_id", "body", m.SenderID); err != nil {
   174  		return err
   175  	}
   176  
   177  	return nil
   178  }
   179  
   180  func (m *OracleQuery) validateSenderNonce(formats strfmt.Registry) error {
   181  
   182  	if err := validate.Required("sender_nonce", "body", m.SenderNonce); err != nil {
   183  		return err
   184  	}
   185  
   186  	return nil
   187  }
   188  
   189  func (m *OracleQuery) validateTTL(formats strfmt.Registry) error {
   190  
   191  	if err := validate.Required("ttl", "body", m.TTL); err != nil {
   192  		return err
   193  	}
   194  
   195  	return nil
   196  }
   197  
   198  // MarshalBinary interface implementation
   199  func (m *OracleQuery) MarshalBinary() ([]byte, error) {
   200  	if m == nil {
   201  		return nil, nil
   202  	}
   203  	return swag.WriteJSON(m)
   204  }
   205  
   206  // UnmarshalBinary interface implementation
   207  func (m *OracleQuery) UnmarshalBinary(b []byte) error {
   208  	var res OracleQuery
   209  	if err := swag.ReadJSON(b, &res); err != nil {
   210  		return err
   211  	}
   212  	*m = res
   213  	return nil
   214  }