1
0
api/ent/ogent/oas_parameters_gen.go
2023-04-06 12:39:26 +09:00

1588 lines
31 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package ogent
import (
"net/http"
"net/url"
"github.com/go-faster/errors"
"github.com/ogen-go/ogen/conv"
"github.com/ogen-go/ogen/middleware"
"github.com/ogen-go/ogen/ogenerrors"
"github.com/ogen-go/ogen/uri"
"github.com/ogen-go/ogen/validate"
)
// DeleteCardParams is parameters of deleteCard operation.
type DeleteCardParams struct {
// ID of the Card.
ID int
}
func unpackDeleteCardParams(packed middleware.Parameters) (params DeleteCardParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeDeleteCardParams(args [1]string, r *http.Request) (params DeleteCardParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// DeleteGroupParams is parameters of deleteGroup operation.
type DeleteGroupParams struct {
// ID of the Group.
ID int
}
func unpackDeleteGroupParams(packed middleware.Parameters) (params DeleteGroupParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeDeleteGroupParams(args [1]string, r *http.Request) (params DeleteGroupParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// DeleteUserParams is parameters of deleteUser operation.
type DeleteUserParams struct {
// ID of the User.
ID int
}
func unpackDeleteUserParams(packed middleware.Parameters) (params DeleteUserParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeDeleteUserParams(args [1]string, r *http.Request) (params DeleteUserParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// DrawDoneParams is parameters of drawDone operation.
type DrawDoneParams struct {
ID int
}
func unpackDrawDoneParams(packed middleware.Parameters) (params DrawDoneParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeDrawDoneParams(args [1]string, r *http.Request) (params DrawDoneParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// DrawStartParams is parameters of drawStart operation.
type DrawStartParams struct {
ID int
}
func unpackDrawStartParams(packed middleware.Parameters) (params DrawStartParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeDrawStartParams(args [1]string, r *http.Request) (params DrawStartParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// ListCardParams is parameters of listCard operation.
type ListCardParams struct {
// What page to render.
Page OptInt
// Item count to render per page.
ItemsPerPage OptInt
}
func unpackListCardParams(packed middleware.Parameters) (params ListCardParams) {
{
key := middleware.ParameterKey{
Name: "page",
In: "query",
}
if v, ok := packed[key]; ok {
params.Page = v.(OptInt)
}
}
{
key := middleware.ParameterKey{
Name: "itemsPerPage",
In: "query",
}
if v, ok := packed[key]; ok {
params.ItemsPerPage = v.(OptInt)
}
}
return params
}
func decodeListCardParams(args [0]string, r *http.Request) (params ListCardParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode query: page.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "page",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotPageVal = c
return nil
}(); err != nil {
return err
}
params.Page.SetTo(paramsDotPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.Page.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: false,
Max: 0,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.Page.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "page",
In: "query",
Err: err,
}
}
// Decode query: itemsPerPage.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "itemsPerPage",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotItemsPerPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotItemsPerPageVal = c
return nil
}(); err != nil {
return err
}
params.ItemsPerPage.SetTo(paramsDotItemsPerPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.ItemsPerPage.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: true,
Max: 255,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.ItemsPerPage.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "itemsPerPage",
In: "query",
Err: err,
}
}
return params, nil
}
// ListGroupParams is parameters of listGroup operation.
type ListGroupParams struct {
// What page to render.
Page OptInt
// Item count to render per page.
ItemsPerPage OptInt
}
func unpackListGroupParams(packed middleware.Parameters) (params ListGroupParams) {
{
key := middleware.ParameterKey{
Name: "page",
In: "query",
}
if v, ok := packed[key]; ok {
params.Page = v.(OptInt)
}
}
{
key := middleware.ParameterKey{
Name: "itemsPerPage",
In: "query",
}
if v, ok := packed[key]; ok {
params.ItemsPerPage = v.(OptInt)
}
}
return params
}
func decodeListGroupParams(args [0]string, r *http.Request) (params ListGroupParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode query: page.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "page",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotPageVal = c
return nil
}(); err != nil {
return err
}
params.Page.SetTo(paramsDotPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.Page.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: false,
Max: 0,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.Page.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "page",
In: "query",
Err: err,
}
}
// Decode query: itemsPerPage.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "itemsPerPage",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotItemsPerPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotItemsPerPageVal = c
return nil
}(); err != nil {
return err
}
params.ItemsPerPage.SetTo(paramsDotItemsPerPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.ItemsPerPage.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: true,
Max: 255,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.ItemsPerPage.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "itemsPerPage",
In: "query",
Err: err,
}
}
return params, nil
}
// ListGroupUsersParams is parameters of listGroupUsers operation.
type ListGroupUsersParams struct {
// ID of the Group.
ID int
// What page to render.
Page OptInt
// Item count to render per page.
ItemsPerPage OptInt
}
func unpackListGroupUsersParams(packed middleware.Parameters) (params ListGroupUsersParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
{
key := middleware.ParameterKey{
Name: "page",
In: "query",
}
if v, ok := packed[key]; ok {
params.Page = v.(OptInt)
}
}
{
key := middleware.ParameterKey{
Name: "itemsPerPage",
In: "query",
}
if v, ok := packed[key]; ok {
params.ItemsPerPage = v.(OptInt)
}
}
return params
}
func decodeListGroupUsersParams(args [1]string, r *http.Request) (params ListGroupUsersParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
// Decode query: page.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "page",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotPageVal = c
return nil
}(); err != nil {
return err
}
params.Page.SetTo(paramsDotPageVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "page",
In: "query",
Err: err,
}
}
// Decode query: itemsPerPage.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "itemsPerPage",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotItemsPerPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotItemsPerPageVal = c
return nil
}(); err != nil {
return err
}
params.ItemsPerPage.SetTo(paramsDotItemsPerPageVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "itemsPerPage",
In: "query",
Err: err,
}
}
return params, nil
}
// ListUserParams is parameters of listUser operation.
type ListUserParams struct {
// What page to render.
Page OptInt
// Item count to render per page.
ItemsPerPage OptInt
}
func unpackListUserParams(packed middleware.Parameters) (params ListUserParams) {
{
key := middleware.ParameterKey{
Name: "page",
In: "query",
}
if v, ok := packed[key]; ok {
params.Page = v.(OptInt)
}
}
{
key := middleware.ParameterKey{
Name: "itemsPerPage",
In: "query",
}
if v, ok := packed[key]; ok {
params.ItemsPerPage = v.(OptInt)
}
}
return params
}
func decodeListUserParams(args [0]string, r *http.Request) (params ListUserParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode query: page.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "page",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotPageVal = c
return nil
}(); err != nil {
return err
}
params.Page.SetTo(paramsDotPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.Page.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: false,
Max: 0,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.Page.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "page",
In: "query",
Err: err,
}
}
// Decode query: itemsPerPage.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "itemsPerPage",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotItemsPerPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotItemsPerPageVal = c
return nil
}(); err != nil {
return err
}
params.ItemsPerPage.SetTo(paramsDotItemsPerPageVal)
return nil
}); err != nil {
return err
}
if err := func() error {
if params.ItemsPerPage.Set {
if err := func() error {
if err := (validate.Int{
MinSet: true,
Min: 1,
MaxSet: true,
Max: 255,
MinExclusive: false,
MaxExclusive: false,
MultipleOfSet: false,
MultipleOf: 0,
}).Validate(int64(params.ItemsPerPage.Value)); err != nil {
return errors.Wrap(err, "int")
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "itemsPerPage",
In: "query",
Err: err,
}
}
return params, nil
}
// ListUserCardParams is parameters of listUserCard operation.
type ListUserCardParams struct {
// ID of the User.
ID int
// What page to render.
Page OptInt
// Item count to render per page.
ItemsPerPage OptInt
}
func unpackListUserCardParams(packed middleware.Parameters) (params ListUserCardParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
{
key := middleware.ParameterKey{
Name: "page",
In: "query",
}
if v, ok := packed[key]; ok {
params.Page = v.(OptInt)
}
}
{
key := middleware.ParameterKey{
Name: "itemsPerPage",
In: "query",
}
if v, ok := packed[key]; ok {
params.ItemsPerPage = v.(OptInt)
}
}
return params
}
func decodeListUserCardParams(args [1]string, r *http.Request) (params ListUserCardParams, _ error) {
q := uri.NewQueryDecoder(r.URL.Query())
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
// Decode query: page.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "page",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotPageVal = c
return nil
}(); err != nil {
return err
}
params.Page.SetTo(paramsDotPageVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "page",
In: "query",
Err: err,
}
}
// Decode query: itemsPerPage.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "itemsPerPage",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotItemsPerPageVal int
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
paramsDotItemsPerPageVal = c
return nil
}(); err != nil {
return err
}
params.ItemsPerPage.SetTo(paramsDotItemsPerPageVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "itemsPerPage",
In: "query",
Err: err,
}
}
return params, nil
}
// ReadCardParams is parameters of readCard operation.
type ReadCardParams struct {
// ID of the Card.
ID int
}
func unpackReadCardParams(packed middleware.Parameters) (params ReadCardParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeReadCardParams(args [1]string, r *http.Request) (params ReadCardParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// ReadCardOwnerParams is parameters of readCardOwner operation.
type ReadCardOwnerParams struct {
// ID of the Card.
ID int
}
func unpackReadCardOwnerParams(packed middleware.Parameters) (params ReadCardOwnerParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeReadCardOwnerParams(args [1]string, r *http.Request) (params ReadCardOwnerParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// ReadGroupParams is parameters of readGroup operation.
type ReadGroupParams struct {
// ID of the Group.
ID int
}
func unpackReadGroupParams(packed middleware.Parameters) (params ReadGroupParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeReadGroupParams(args [1]string, r *http.Request) (params ReadGroupParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// ReadUserParams is parameters of readUser operation.
type ReadUserParams struct {
// ID of the User.
ID int
}
func unpackReadUserParams(packed middleware.Parameters) (params ReadUserParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeReadUserParams(args [1]string, r *http.Request) (params ReadUserParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// UpdateCardParams is parameters of updateCard operation.
type UpdateCardParams struct {
// ID of the Card.
ID int
}
func unpackUpdateCardParams(packed middleware.Parameters) (params UpdateCardParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeUpdateCardParams(args [1]string, r *http.Request) (params UpdateCardParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// UpdateGroupParams is parameters of updateGroup operation.
type UpdateGroupParams struct {
// ID of the Group.
ID int
}
func unpackUpdateGroupParams(packed middleware.Parameters) (params UpdateGroupParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeUpdateGroupParams(args [1]string, r *http.Request) (params UpdateGroupParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}
// UpdateUserParams is parameters of updateUser operation.
type UpdateUserParams struct {
// ID of the User.
ID int
}
func unpackUpdateUserParams(packed middleware.Parameters) (params UpdateUserParams) {
{
key := middleware.ParameterKey{
Name: "id",
In: "path",
}
params.ID = packed[key].(int)
}
return params
}
func decodeUpdateUserParams(args [1]string, r *http.Request) (params UpdateUserParams, _ error) {
// Decode path: id.
if err := func() error {
param, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "id",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt(val)
if err != nil {
return err
}
params.ID = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "id",
In: "path",
Err: err,
}
}
return params, nil
}