// Code generated by ogen, DO NOT EDIT. package openapi 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" ) // GroupsIDDeleteParams is parameters of DELETE /groups/{id} operation. type GroupsIDDeleteParams struct { ID ID } func unpackGroupsIDDeleteParams(packed middleware.Parameters) (params GroupsIDDeleteParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeGroupsIDDeleteParams(args [1]string, argsEscaped bool, r *http.Request) (params GroupsIDDeleteParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 } // GroupsIDGetParams is parameters of GET /groups/{id} operation. type GroupsIDGetParams struct { ID ID } func unpackGroupsIDGetParams(packed middleware.Parameters) (params GroupsIDGetParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeGroupsIDGetParams(args [1]string, argsEscaped bool, r *http.Request) (params GroupsIDGetParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 } // GroupsIDPutParams is parameters of PUT /groups/{id} operation. type GroupsIDPutParams struct { ID ID } func unpackGroupsIDPutParams(packed middleware.Parameters) (params GroupsIDPutParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeGroupsIDPutParams(args [1]string, argsEscaped bool, r *http.Request) (params GroupsIDPutParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 } // UsersIDDeleteParams is parameters of DELETE /users/{id} operation. type UsersIDDeleteParams struct { ID ID } func unpackUsersIDDeleteParams(packed middleware.Parameters) (params UsersIDDeleteParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeUsersIDDeleteParams(args [1]string, argsEscaped bool, r *http.Request) (params UsersIDDeleteParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 } // UsersIDGetParams is parameters of GET /users/{id} operation. type UsersIDGetParams struct { ID ID } func unpackUsersIDGetParams(packed middleware.Parameters) (params UsersIDGetParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeUsersIDGetParams(args [1]string, argsEscaped bool, r *http.Request) (params UsersIDGetParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 } // UsersIDPutParams is parameters of PUT /users/{id} operation. type UsersIDPutParams struct { ID ID } func unpackUsersIDPutParams(packed middleware.Parameters) (params UsersIDPutParams) { { key := middleware.ParameterKey{ Name: "id", In: "path", } params.ID = packed[key].(ID) } return params } func decodeUsersIDPutParams(args [1]string, argsEscaped bool, r *http.Request) (params UsersIDPutParams, _ error) { // Decode path: id. if err := func() error { param := args[0] if argsEscaped { unescaped, err := url.PathUnescape(args[0]) if err != nil { return errors.Wrap(err, "unescape path") } param = unescaped } if len(param) > 0 { d := uri.NewPathDecoder(uri.PathDecoderConfig{ Param: "id", Value: param, Style: uri.PathStyleSimple, Explode: false, }) if err := func() error { var paramsDotIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotIDVal = c return nil }(); err != nil { return err } params.ID = ID(paramsDotIDVal) 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 }