2024-11-26 01:22:45 +00:00
|
|
|
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
// GetSubmissionParams is parameters of getSubmission operation.
|
|
|
|
type GetSubmissionParams struct {
|
|
|
|
SubmissionID int64
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func unpackGetSubmissionParams(packed middleware.Parameters) (params GetSubmissionParams) {
|
2024-11-26 01:22:45 +00:00
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "path",
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.SubmissionID = packed[key].(int64)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func decodeGetSubmissionParams(args [1]string, argsEscaped bool, r *http.Request) (params GetSubmissionParams, _ error) {
|
|
|
|
// Decode path: SubmissionID.
|
2024-11-26 01:22:45 +00:00
|
|
|
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{
|
2024-11-26 20:39:10 +00:00
|
|
|
Param: "SubmissionID",
|
2024-11-26 01:22:45 +00:00
|
|
|
Value: param,
|
|
|
|
Style: uri.PathStyleSimple,
|
|
|
|
Explode: false,
|
|
|
|
})
|
|
|
|
|
|
|
|
if err := func() error {
|
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
c, err := conv.ToInt64(val)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
params.SubmissionID = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "path",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return params, nil
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
// ListSubmissionsParams is parameters of listSubmissions operation.
|
|
|
|
type ListSubmissionsParams struct {
|
|
|
|
Page Pagination
|
|
|
|
Filter OptSubmissionFilter
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func unpackListSubmissionsParams(packed middleware.Parameters) (params ListSubmissionsParams) {
|
2024-11-26 01:22:45 +00:00
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "page",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.Page = packed[key].(Pagination)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "filter",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
if v, ok := packed[key]; ok {
|
|
|
|
params.Filter = v.(OptSubmissionFilter)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func decodeListSubmissionsParams(args [0]string, argsEscaped bool, r *http.Request) (params ListSubmissionsParams, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
q := uri.NewQueryDecoder(r.URL.Query())
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode query: page.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
|
|
|
Name: "page",
|
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
|
|
|
Fields: []uri.QueryParameterObjectField{{Name: "Page", Required: true}, {Name: "Limit", Required: true}},
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
|
|
|
return params.Page.DecodeURI(d)
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
if err := params.Page.Validate(); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "page",
|
|
|
|
In: "query",
|
2024-11-26 01:22:45 +00:00
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode query: filter.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "filter",
|
2024-11-26 01:22:45 +00:00
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
2024-11-26 20:39:10 +00:00
|
|
|
Fields: []uri.QueryParameterObjectField{{Name: "ID", Required: false}, {Name: "DisplayName", Required: false}, {Name: "Creator", Required: false}, {Name: "GameID", Required: false}, {Name: "Date", Required: false}},
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
2024-11-26 20:39:10 +00:00
|
|
|
var paramsDotFilterVal SubmissionFilter
|
|
|
|
if err := func() error {
|
|
|
|
return paramsDotFilterVal.DecodeURI(d)
|
|
|
|
}(); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.Filter.SetTo(paramsDotFilterVal)
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "filter",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
return params, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// PatchSubmissionCompletedParams is parameters of patchSubmissionCompleted operation.
|
|
|
|
type PatchSubmissionCompletedParams struct {
|
|
|
|
SubmissionID int64
|
|
|
|
Completed bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func unpackPatchSubmissionCompletedParams(packed middleware.Parameters) (params PatchSubmissionCompletedParams) {
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
|
|
|
}
|
|
|
|
params.SubmissionID = packed[key].(int64)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
|
|
|
Name: "Completed",
|
|
|
|
In: "query",
|
|
|
|
}
|
|
|
|
params.Completed = packed[key].(bool)
|
|
|
|
}
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
|
|
|
func decodePatchSubmissionCompletedParams(args [1]string, argsEscaped bool, r *http.Request) (params PatchSubmissionCompletedParams, _ error) {
|
|
|
|
q := uri.NewQueryDecoder(r.URL.Query())
|
|
|
|
// Decode path: SubmissionID.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
param := args[0]
|
|
|
|
if argsEscaped {
|
|
|
|
unescaped, err := url.PathUnescape(args[0])
|
|
|
|
if err != nil {
|
|
|
|
return errors.Wrap(err, "unescape path")
|
|
|
|
}
|
|
|
|
param = unescaped
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
if len(param) > 0 {
|
|
|
|
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
|
|
|
Param: "SubmissionID",
|
|
|
|
Value: param,
|
|
|
|
Style: uri.PathStyleSimple,
|
|
|
|
Explode: false,
|
|
|
|
})
|
2024-11-26 01:22:45 +00:00
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
if err := func() error {
|
2024-11-26 01:22:45 +00:00
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
c, err := conv.ToInt64(val)
|
2024-11-26 01:22:45 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
params.SubmissionID = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
2024-11-26 20:39:10 +00:00
|
|
|
}(); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
2024-11-26 01:22:45 +00:00
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode query: Completed.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "Completed",
|
2024-11-26 01:22:45 +00:00
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
c, err := conv.ToBool(val)
|
2024-11-26 01:22:45 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
params.Completed = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "Completed",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return params, nil
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
// PatchSubmissionModelParams is parameters of patchSubmissionModel operation.
|
|
|
|
type PatchSubmissionModelParams struct {
|
|
|
|
SubmissionID int64
|
|
|
|
ModelID int64
|
|
|
|
VersionID int64
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func unpackPatchSubmissionModelParams(packed middleware.Parameters) (params PatchSubmissionModelParams) {
|
2024-11-26 01:22:45 +00:00
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.SubmissionID = packed[key].(int64)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "ModelID",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.ModelID = packed[key].(int64)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
|
|
|
Name: "VersionID",
|
|
|
|
In: "query",
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.VersionID = packed[key].(int64)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func decodePatchSubmissionModelParams(args [1]string, argsEscaped bool, r *http.Request) (params PatchSubmissionModelParams, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
q := uri.NewQueryDecoder(r.URL.Query())
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode path: SubmissionID.
|
|
|
|
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: "SubmissionID",
|
|
|
|
Value: param,
|
|
|
|
Style: uri.PathStyleSimple,
|
|
|
|
Explode: false,
|
|
|
|
})
|
|
|
|
|
|
|
|
if err := func() error {
|
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
c, err := conv.ToInt64(val)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
params.SubmissionID = c
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Decode query: ModelID.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "ModelID",
|
2024-11-26 01:22:45 +00:00
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
2024-11-26 20:39:10 +00:00
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
c, err := conv.ToInt64(val)
|
|
|
|
if err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
|
|
|
|
params.ModelID = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
2024-11-26 20:39:10 +00:00
|
|
|
}); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "ModelID",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode query: VersionID.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "VersionID",
|
2024-11-26 01:22:45 +00:00
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
2024-11-26 20:39:10 +00:00
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
|
|
|
|
c, err := conv.ToInt64(val)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
params.VersionID = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "VersionID",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return params, nil
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
// PatchSubmissionStatusParams is parameters of patchSubmissionStatus operation.
|
|
|
|
type PatchSubmissionStatusParams struct {
|
|
|
|
SubmissionID int64
|
|
|
|
Status int32
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func unpackPatchSubmissionStatusParams(packed middleware.Parameters) (params PatchSubmissionStatusParams) {
|
2024-11-26 01:22:45 +00:00
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.SubmissionID = packed[key].(int64)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
key := middleware.ParameterKey{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "Status",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
params.Status = packed[key].(int32)
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
func decodePatchSubmissionStatusParams(args [1]string, argsEscaped bool, r *http.Request) (params PatchSubmissionStatusParams, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
q := uri.NewQueryDecoder(r.URL.Query())
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode path: SubmissionID.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
param := args[0]
|
|
|
|
if argsEscaped {
|
|
|
|
unescaped, err := url.PathUnescape(args[0])
|
|
|
|
if err != nil {
|
|
|
|
return errors.Wrap(err, "unescape path")
|
|
|
|
}
|
|
|
|
param = unescaped
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
if len(param) > 0 {
|
|
|
|
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
|
|
|
Param: "SubmissionID",
|
|
|
|
Value: param,
|
|
|
|
Style: uri.PathStyleSimple,
|
|
|
|
Explode: false,
|
|
|
|
})
|
2024-11-26 01:22:45 +00:00
|
|
|
|
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
|
|
|
|
c, err := conv.ToInt64(val)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
params.SubmissionID = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "SubmissionID",
|
|
|
|
In: "path",
|
2024-11-26 01:22:45 +00:00
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
// Decode query: Status.
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
|
|
|
cfg := uri.QueryParameterDecodingConfig{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "Status",
|
2024-11-26 01:22:45 +00:00
|
|
|
Style: uri.QueryStyleForm,
|
|
|
|
Explode: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
2024-11-26 20:39:10 +00:00
|
|
|
val, err := d.DecodeValue()
|
|
|
|
if err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
|
|
|
|
c, err := conv.ToInt32(val)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
params.Status = c
|
2024-11-26 01:22:45 +00:00
|
|
|
return nil
|
|
|
|
}); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
} else {
|
|
|
|
return validate.ErrFieldRequired
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return params, &ogenerrors.DecodeParamError{
|
2024-11-26 20:39:10 +00:00
|
|
|
Name: "Status",
|
2024-11-26 01:22:45 +00:00
|
|
|
In: "query",
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return params, nil
|
|
|
|
}
|