// 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" ) // ActionSubmissionAcceptedParams is parameters of actionSubmissionAccepted operation. type ActionSubmissionAcceptedParams struct { // The unique identifier for a submission. SubmissionID int64 } func unpackActionSubmissionAcceptedParams(packed middleware.Parameters) (params ActionSubmissionAcceptedParams) { { key := middleware.ParameterKey{ Name: "SubmissionID", In: "path", } params.SubmissionID = packed[key].(int64) } return params } func decodeActionSubmissionAcceptedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionAcceptedParams, _ error) { // 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, } } return params, nil } // ActionSubmissionReleasedParams is parameters of actionSubmissionReleased operation. type ActionSubmissionReleasedParams struct { // The unique identifier for a submission. SubmissionID int64 } func unpackActionSubmissionReleasedParams(packed middleware.Parameters) (params ActionSubmissionReleasedParams) { { key := middleware.ParameterKey{ Name: "SubmissionID", In: "path", } params.SubmissionID = packed[key].(int64) } return params } func decodeActionSubmissionReleasedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionReleasedParams, _ error) { // 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, } } return params, nil } // ActionSubmissionUploadedParams is parameters of actionSubmissionUploaded operation. type ActionSubmissionUploadedParams struct { // The unique identifier for a submission. SubmissionID int64 TargetAssetID OptInt64 } func unpackActionSubmissionUploadedParams(packed middleware.Parameters) (params ActionSubmissionUploadedParams) { { key := middleware.ParameterKey{ Name: "SubmissionID", In: "path", } params.SubmissionID = packed[key].(int64) } { key := middleware.ParameterKey{ Name: "TargetAssetID", In: "query", } if v, ok := packed[key]; ok { params.TargetAssetID = v.(OptInt64) } } return params } func decodeActionSubmissionUploadedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionUploadedParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) // 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: TargetAssetID. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "TargetAssetID", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotTargetAssetIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotTargetAssetIDVal = c return nil }(); err != nil { return err } params.TargetAssetID.SetTo(paramsDotTargetAssetIDVal) return nil }); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "TargetAssetID", In: "query", Err: err, } } return params, nil } // ActionSubmissionValidatedParams is parameters of actionSubmissionValidated operation. type ActionSubmissionValidatedParams struct { // The unique identifier for a submission. SubmissionID int64 } func unpackActionSubmissionValidatedParams(packed middleware.Parameters) (params ActionSubmissionValidatedParams) { { key := middleware.ParameterKey{ Name: "SubmissionID", In: "path", } params.SubmissionID = packed[key].(int64) } return params } func decodeActionSubmissionValidatedParams(args [1]string, argsEscaped bool, r *http.Request) (params ActionSubmissionValidatedParams, _ error) { // 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, } } return params, nil } // GetScriptParams is parameters of getScript operation. type GetScriptParams struct { // The unique identifier for a script. ScriptID int64 } func unpackGetScriptParams(packed middleware.Parameters) (params GetScriptParams) { { key := middleware.ParameterKey{ Name: "ScriptID", In: "path", } params.ScriptID = packed[key].(int64) } return params } func decodeGetScriptParams(args [1]string, argsEscaped bool, r *http.Request) (params GetScriptParams, _ error) { // Decode path: ScriptID. 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: "ScriptID", 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.ScriptID = c return nil }(); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "ScriptID", In: "path", Err: err, } } return params, nil } // ListScriptPolicyParams is parameters of listScriptPolicy operation. type ListScriptPolicyParams struct { Page int32 Limit int32 FromScriptHash OptString ToScriptID OptInt64 Policy OptInt32 } func unpackListScriptPolicyParams(packed middleware.Parameters) (params ListScriptPolicyParams) { { key := middleware.ParameterKey{ Name: "Page", In: "query", } params.Page = packed[key].(int32) } { key := middleware.ParameterKey{ Name: "Limit", In: "query", } params.Limit = packed[key].(int32) } { key := middleware.ParameterKey{ Name: "FromScriptHash", In: "query", } if v, ok := packed[key]; ok { params.FromScriptHash = v.(OptString) } } { key := middleware.ParameterKey{ Name: "ToScriptID", In: "query", } if v, ok := packed[key]; ok { params.ToScriptID = v.(OptInt64) } } { key := middleware.ParameterKey{ Name: "Policy", In: "query", } if v, ok := packed[key]; ok { params.Policy = v.(OptInt32) } } return params } func decodeListScriptPolicyParams(args [0]string, argsEscaped bool, r *http.Request) (params ListScriptPolicyParams, _ 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 { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt32(val) if err != nil { return err } params.Page = c return nil }); err != nil { return err } 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)); err != nil { return errors.Wrap(err, "int") } return nil }(); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Page", In: "query", Err: err, } } // Decode query: Limit. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Limit", 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 } c, err := conv.ToInt32(val) if err != nil { return err } params.Limit = c return nil }); err != nil { return err } if err := func() error { if err := (validate.Int{ MinSet: true, Min: 1, MaxSet: true, Max: 100, MinExclusive: false, MaxExclusive: false, MultipleOfSet: false, MultipleOf: 0, }).Validate(int64(params.Limit)); err != nil { return errors.Wrap(err, "int") } return nil }(); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Limit", In: "query", Err: err, } } // Decode query: FromScriptHash. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "FromScriptHash", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotFromScriptHashVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToString(val) if err != nil { return err } paramsDotFromScriptHashVal = c return nil }(); err != nil { return err } params.FromScriptHash.SetTo(paramsDotFromScriptHashVal) return nil }); err != nil { return err } if err := func() error { if value, ok := params.FromScriptHash.Get(); ok { if err := func() error { if err := (validate.String{ MinLength: 16, MinLengthSet: true, MaxLength: 16, MaxLengthSet: true, Email: false, Hostname: false, Regex: nil, }).Validate(string(value)); err != nil { return errors.Wrap(err, "string") } return nil }(); err != nil { return err } } return nil }(); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "FromScriptHash", In: "query", Err: err, } } // Decode query: ToScriptID. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "ToScriptID", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotToScriptIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotToScriptIDVal = c return nil }(); err != nil { return err } params.ToScriptID.SetTo(paramsDotToScriptIDVal) return nil }); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "ToScriptID", In: "query", Err: err, } } // Decode query: Policy. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Policy", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotPolicyVal int32 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt32(val) if err != nil { return err } paramsDotPolicyVal = c return nil }(); err != nil { return err } params.Policy.SetTo(paramsDotPolicyVal) return nil }); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Policy", In: "query", Err: err, } } return params, nil } // ListScriptsParams is parameters of listScripts operation. type ListScriptsParams struct { Page int32 Limit int32 Hash OptString Name OptString Source OptString SubmissionID OptInt64 } func unpackListScriptsParams(packed middleware.Parameters) (params ListScriptsParams) { { key := middleware.ParameterKey{ Name: "Page", In: "query", } params.Page = packed[key].(int32) } { key := middleware.ParameterKey{ Name: "Limit", In: "query", } params.Limit = packed[key].(int32) } { key := middleware.ParameterKey{ Name: "Hash", In: "query", } if v, ok := packed[key]; ok { params.Hash = v.(OptString) } } { key := middleware.ParameterKey{ Name: "Name", In: "query", } if v, ok := packed[key]; ok { params.Name = v.(OptString) } } { key := middleware.ParameterKey{ Name: "Source", In: "query", } if v, ok := packed[key]; ok { params.Source = v.(OptString) } } { key := middleware.ParameterKey{ Name: "SubmissionID", In: "query", } if v, ok := packed[key]; ok { params.SubmissionID = v.(OptInt64) } } return params } func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request) (params ListScriptsParams, _ 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 { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt32(val) if err != nil { return err } params.Page = c return nil }); err != nil { return err } 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)); err != nil { return errors.Wrap(err, "int") } return nil }(); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Page", In: "query", Err: err, } } // Decode query: Limit. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Limit", 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 } c, err := conv.ToInt32(val) if err != nil { return err } params.Limit = c return nil }); err != nil { return err } if err := func() error { if err := (validate.Int{ MinSet: true, Min: 1, MaxSet: true, Max: 100, MinExclusive: false, MaxExclusive: false, MultipleOfSet: false, MultipleOf: 0, }).Validate(int64(params.Limit)); err != nil { return errors.Wrap(err, "int") } return nil }(); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Limit", In: "query", Err: err, } } // Decode query: Hash. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Hash", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotHashVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToString(val) if err != nil { return err } paramsDotHashVal = c return nil }(); err != nil { return err } params.Hash.SetTo(paramsDotHashVal) return nil }); err != nil { return err } if err := func() error { if value, ok := params.Hash.Get(); ok { if err := func() error { if err := (validate.String{ MinLength: 16, MinLengthSet: true, MaxLength: 16, MaxLengthSet: true, Email: false, Hostname: false, Regex: nil, }).Validate(string(value)); err != nil { return errors.Wrap(err, "string") } return nil }(); err != nil { return err } } return nil }(); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Hash", In: "query", Err: err, } } // Decode query: Name. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Name", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotNameVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToString(val) if err != nil { return err } paramsDotNameVal = c return nil }(); err != nil { return err } params.Name.SetTo(paramsDotNameVal) return nil }); err != nil { return err } if err := func() error { if value, ok := params.Name.Get(); ok { if err := func() error { if err := (validate.String{ MinLength: 0, MinLengthSet: false, MaxLength: 128, MaxLengthSet: true, Email: false, Hostname: false, Regex: nil, }).Validate(string(value)); err != nil { return errors.Wrap(err, "string") } return nil }(); err != nil { return err } } return nil }(); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Name", In: "query", Err: err, } } // Decode query: Source. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "Source", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotSourceVal string if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToString(val) if err != nil { return err } paramsDotSourceVal = c return nil }(); err != nil { return err } params.Source.SetTo(paramsDotSourceVal) return nil }); err != nil { return err } if err := func() error { if value, ok := params.Source.Get(); ok { if err := func() error { if err := (validate.String{ MinLength: 0, MinLengthSet: false, MaxLength: 1048576, MaxLengthSet: true, Email: false, Hostname: false, Regex: nil, }).Validate(string(value)); err != nil { return errors.Wrap(err, "string") } return nil }(); err != nil { return err } } return nil }(); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "Source", In: "query", Err: err, } } // Decode query: SubmissionID. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "SubmissionID", Style: uri.QueryStyleForm, Explode: true, } if err := q.HasParam(cfg); err == nil { if err := q.DecodeParam(cfg, func(d uri.Decoder) error { var paramsDotSubmissionIDVal int64 if err := func() error { val, err := d.DecodeValue() if err != nil { return err } c, err := conv.ToInt64(val) if err != nil { return err } paramsDotSubmissionIDVal = c return nil }(); err != nil { return err } params.SubmissionID.SetTo(paramsDotSubmissionIDVal) return nil }); err != nil { return err } } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "SubmissionID", In: "query", Err: err, } } return params, nil } // UpdateSubmissionModelParams is parameters of updateSubmissionModel operation. type UpdateSubmissionModelParams struct { // The unique identifier for a submission. SubmissionID int64 ModelID int64 VersionID int64 } func unpackUpdateSubmissionModelParams(packed middleware.Parameters) (params UpdateSubmissionModelParams) { { key := middleware.ParameterKey{ Name: "SubmissionID", In: "path", } params.SubmissionID = packed[key].(int64) } { key := middleware.ParameterKey{ Name: "ModelID", In: "query", } params.ModelID = packed[key].(int64) } { key := middleware.ParameterKey{ Name: "VersionID", In: "query", } params.VersionID = packed[key].(int64) } return params } func decodeUpdateSubmissionModelParams(args [1]string, argsEscaped bool, r *http.Request) (params UpdateSubmissionModelParams, _ error) { q := uri.NewQueryDecoder(r.URL.Query()) // 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. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "ModelID", 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 } c, err := conv.ToInt64(val) if err != nil { return err } params.ModelID = c return nil }); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "ModelID", In: "query", Err: err, } } // Decode query: VersionID. if err := func() error { cfg := uri.QueryParameterDecodingConfig{ Name: "VersionID", 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 } c, err := conv.ToInt64(val) if err != nil { return err } params.VersionID = c return nil }); err != nil { return err } } else { return validate.ErrFieldRequired } return nil }(); err != nil { return params, &ogenerrors.DecodeParamError{ Name: "VersionID", In: "query", Err: err, } } return params, nil }