github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/commitment_id.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  
    16  // CommitmentID commitment Id
    17  // swagger:model CommitmentId
    18  type CommitmentID struct {
    19  
    20  	// commitment id
    21  	// Required: true
    22  	CommitmentID *string `json:"commitment_id"`
    23  }
    24  
    25  // Validate validates this commitment Id
    26  func (m *CommitmentID) Validate(formats strfmt.Registry) error {
    27  	var res []error
    28  
    29  	if err := m.validateCommitmentID(formats); err != nil {
    30  		res = append(res, err)
    31  	}
    32  
    33  	if len(res) > 0 {
    34  		return errors.CompositeValidationError(res...)
    35  	}
    36  	return nil
    37  }
    38  
    39  func (m *CommitmentID) validateCommitmentID(formats strfmt.Registry) error {
    40  
    41  	if err := validate.Required("commitment_id", "body", m.CommitmentID); err != nil {
    42  		return err
    43  	}
    44  
    45  	return nil
    46  }
    47  
    48  // MarshalBinary interface implementation
    49  func (m *CommitmentID) MarshalBinary() ([]byte, error) {
    50  	if m == nil {
    51  		return nil, nil
    52  	}
    53  	return swag.WriteJSON(m)
    54  }
    55  
    56  // UnmarshalBinary interface implementation
    57  func (m *CommitmentID) UnmarshalBinary(b []byte) error {
    58  	var res CommitmentID
    59  	if err := swag.ReadJSON(b, &res); err != nil {
    60  		return err
    61  	}
    62  	*m = res
    63  	return nil
    64  }