forked from TrueCloudLab/frostfs-rest-gw
[#33] Add route to get NeoFS balance
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
aaf7433c7b
commit
6e01a0ead7
9 changed files with 530 additions and 0 deletions
105
gen/models/balance.go
Normal file
105
gen/models/balance.go
Normal file
|
@ -0,0 +1,105 @@
|
|||
// 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"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// Balance balance
|
||||
//
|
||||
// swagger:model Balance
|
||||
type Balance struct {
|
||||
|
||||
// address
|
||||
// Required: true
|
||||
Address *string `json:"address"`
|
||||
|
||||
// precision
|
||||
// Required: true
|
||||
Precision *int64 `json:"precision"`
|
||||
|
||||
// value
|
||||
// Required: true
|
||||
Value *string `json:"value"`
|
||||
}
|
||||
|
||||
// Validate validates this balance
|
||||
func (m *Balance) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAddress(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePrecision(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateValue(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Balance) validateAddress(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("address", "body", m.Address); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Balance) validatePrecision(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("precision", "body", m.Precision); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Balance) validateValue(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("value", "body", m.Value); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this balance based on context it is used
|
||||
func (m *Balance) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Balance) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Balance) UnmarshalBinary(b []byte) error {
|
||||
var res Balance
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue