Files
ark/pkg/client-sdk/client/rest/service/models/v1_round.go
Pietralberto Mazza 3271776954 Rename API fields (#337)
* Update api-spec

* Update ASP (also domain to drop "pool" completely)

* Update sdk

* Update protos

* Update asp

* Update sdk

* Fixes
2024-09-27 15:35:31 +02:00

179 lines
3.7 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// V1Round v1 round
//
// swagger:model v1Round
type V1Round struct {
// connectors
Connectors []string `json:"connectors"`
// end
End string `json:"end,omitempty"`
// forfeit txs
ForfeitTxs []string `json:"forfeitTxs"`
// id
ID string `json:"id,omitempty"`
// round tx
RoundTx string `json:"roundTx,omitempty"`
// stage
Stage *V1RoundStage `json:"stage,omitempty"`
// start
Start string `json:"start,omitempty"`
// vtxo tree
VtxoTree *V1Tree `json:"vtxoTree,omitempty"`
}
// Validate validates this v1 round
func (m *V1Round) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateStage(formats); err != nil {
res = append(res, err)
}
if err := m.validateVtxoTree(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V1Round) validateStage(formats strfmt.Registry) error {
if swag.IsZero(m.Stage) { // not required
return nil
}
if m.Stage != nil {
if err := m.Stage.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("stage")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("stage")
}
return err
}
}
return nil
}
func (m *V1Round) validateVtxoTree(formats strfmt.Registry) error {
if swag.IsZero(m.VtxoTree) { // not required
return nil
}
if m.VtxoTree != nil {
if err := m.VtxoTree.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("vtxoTree")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("vtxoTree")
}
return err
}
}
return nil
}
// ContextValidate validate this v1 round based on the context it is used
func (m *V1Round) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateStage(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateVtxoTree(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V1Round) contextValidateStage(ctx context.Context, formats strfmt.Registry) error {
if m.Stage != nil {
if swag.IsZero(m.Stage) { // not required
return nil
}
if err := m.Stage.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("stage")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("stage")
}
return err
}
}
return nil
}
func (m *V1Round) contextValidateVtxoTree(ctx context.Context, formats strfmt.Registry) error {
if m.VtxoTree != nil {
if swag.IsZero(m.VtxoTree) { // not required
return nil
}
if err := m.VtxoTree.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("vtxoTree")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("vtxoTree")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *V1Round) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *V1Round) UnmarshalBinary(b []byte) error {
var res V1Round
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}