openapi: generate
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,9 +14,18 @@ const (
|
||||
ActionSubmissionTriggerPublishOperation OperationName = "ActionSubmissionTriggerPublish"
|
||||
ActionSubmissionTriggerValidateOperation OperationName = "ActionSubmissionTriggerValidate"
|
||||
ActionSubmissionValidateOperation OperationName = "ActionSubmissionValidate"
|
||||
CreateScriptOperation OperationName = "CreateScript"
|
||||
CreateScriptPolicyOperation OperationName = "CreateScriptPolicy"
|
||||
CreateSubmissionOperation OperationName = "CreateSubmission"
|
||||
DeleteScriptOperation OperationName = "DeleteScript"
|
||||
DeleteScriptPolicyOperation OperationName = "DeleteScriptPolicy"
|
||||
GetScriptOperation OperationName = "GetScript"
|
||||
GetScriptPolicyOperation OperationName = "GetScriptPolicy"
|
||||
GetScriptPolicyFromHashOperation OperationName = "GetScriptPolicyFromHash"
|
||||
GetSubmissionOperation OperationName = "GetSubmission"
|
||||
ListSubmissionsOperation OperationName = "ListSubmissions"
|
||||
PatchSubmissionCompletedOperation OperationName = "PatchSubmissionCompleted"
|
||||
PatchSubmissionModelOperation OperationName = "PatchSubmissionModel"
|
||||
UpdateScriptOperation OperationName = "UpdateScript"
|
||||
UpdateScriptPolicyOperation OperationName = "UpdateScriptPolicy"
|
||||
)
|
||||
|
||||
@@ -535,6 +535,331 @@ func decodeActionSubmissionValidateParams(args [1]string, argsEscaped bool, r *h
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// DeleteScriptParams is parameters of deleteScript operation.
|
||||
type DeleteScriptParams struct {
|
||||
ScriptID int64
|
||||
}
|
||||
|
||||
func unpackDeleteScriptParams(packed middleware.Parameters) (params DeleteScriptParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "ScriptID",
|
||||
In: "path",
|
||||
}
|
||||
params.ScriptID = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeDeleteScriptParams(args [1]string, argsEscaped bool, r *http.Request) (params DeleteScriptParams, _ 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
|
||||
}
|
||||
|
||||
// DeleteScriptPolicyParams is parameters of deleteScriptPolicy operation.
|
||||
type DeleteScriptPolicyParams struct {
|
||||
ScriptPolicyID int64
|
||||
}
|
||||
|
||||
func unpackDeleteScriptPolicyParams(packed middleware.Parameters) (params DeleteScriptPolicyParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
}
|
||||
params.ScriptPolicyID = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeDeleteScriptPolicyParams(args [1]string, argsEscaped bool, r *http.Request) (params DeleteScriptPolicyParams, _ error) {
|
||||
// Decode path: ScriptPolicyID.
|
||||
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: "ScriptPolicyID",
|
||||
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.ScriptPolicyID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetScriptParams is parameters of getScript operation.
|
||||
type GetScriptParams struct {
|
||||
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
|
||||
}
|
||||
|
||||
// GetScriptPolicyParams is parameters of getScriptPolicy operation.
|
||||
type GetScriptPolicyParams struct {
|
||||
ScriptPolicyID int64
|
||||
}
|
||||
|
||||
func unpackGetScriptPolicyParams(packed middleware.Parameters) (params GetScriptPolicyParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
}
|
||||
params.ScriptPolicyID = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeGetScriptPolicyParams(args [1]string, argsEscaped bool, r *http.Request) (params GetScriptPolicyParams, _ error) {
|
||||
// Decode path: ScriptPolicyID.
|
||||
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: "ScriptPolicyID",
|
||||
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.ScriptPolicyID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetScriptPolicyFromHashParams is parameters of getScriptPolicyFromHash operation.
|
||||
type GetScriptPolicyFromHashParams struct {
|
||||
FromScriptHash string
|
||||
}
|
||||
|
||||
func unpackGetScriptPolicyFromHashParams(packed middleware.Parameters) (params GetScriptPolicyFromHashParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "FromScriptHash",
|
||||
In: "path",
|
||||
}
|
||||
params.FromScriptHash = packed[key].(string)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeGetScriptPolicyFromHashParams(args [1]string, argsEscaped bool, r *http.Request) (params GetScriptPolicyFromHashParams, _ error) {
|
||||
// Decode path: FromScriptHash.
|
||||
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: "FromScriptHash",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.FromScriptHash = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "FromScriptHash",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetSubmissionParams is parameters of getSubmission operation.
|
||||
type GetSubmissionParams struct {
|
||||
SubmissionID int64
|
||||
@@ -668,7 +993,7 @@ func decodeListSubmissionsParams(args [0]string, argsEscaped bool, r *http.Reque
|
||||
Name: "filter",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
Fields: []uri.QueryParameterObjectField{{Name: "ID", Required: false}, {Name: "DisplayName", Required: false}, {Name: "Creator", Required: false}, {Name: "GameID", Required: false}, {Name: "Date", Required: false}},
|
||||
Fields: []uri.QueryParameterObjectField{{Name: "ID", Required: true}, {Name: "DisplayName", Required: false}, {Name: "Creator", Required: false}, {Name: "GameID", Required: false}, {Name: "Date", Required: false}},
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
@@ -914,3 +1239,133 @@ func decodePatchSubmissionModelParams(args [1]string, argsEscaped bool, r *http.
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// UpdateScriptParams is parameters of updateScript operation.
|
||||
type UpdateScriptParams struct {
|
||||
ScriptID int64
|
||||
}
|
||||
|
||||
func unpackUpdateScriptParams(packed middleware.Parameters) (params UpdateScriptParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "ScriptID",
|
||||
In: "path",
|
||||
}
|
||||
params.ScriptID = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeUpdateScriptParams(args [1]string, argsEscaped bool, r *http.Request) (params UpdateScriptParams, _ 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
|
||||
}
|
||||
|
||||
// UpdateScriptPolicyParams is parameters of updateScriptPolicy operation.
|
||||
type UpdateScriptPolicyParams struct {
|
||||
ScriptPolicyID int64
|
||||
}
|
||||
|
||||
func unpackUpdateScriptPolicyParams(packed middleware.Parameters) (params UpdateScriptPolicyParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
}
|
||||
params.ScriptPolicyID = packed[key].(int64)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeUpdateScriptPolicyParams(args [1]string, argsEscaped bool, r *http.Request) (params UpdateScriptPolicyParams, _ error) {
|
||||
// Decode path: ScriptPolicyID.
|
||||
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: "ScriptPolicyID",
|
||||
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.ScriptPolicyID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "ScriptPolicyID",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,140 @@ import (
|
||||
"github.com/ogen-go/ogen/validate"
|
||||
)
|
||||
|
||||
func (s *Server) decodeCreateScriptRequest(r *http.Request) (
|
||||
req OptScriptCreate,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = multierr.Append(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = multierr.Append(rerr, close())
|
||||
}
|
||||
}()
|
||||
if _, ok := r.Header["Content-Type"]; !ok && r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return req, close, err
|
||||
}
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request OptScriptCreate
|
||||
if err := func() error {
|
||||
request.Reset()
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, close, err
|
||||
}
|
||||
return request, close, nil
|
||||
default:
|
||||
return req, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateScriptPolicyRequest(r *http.Request) (
|
||||
req OptScriptPolicyCreate,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = multierr.Append(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = multierr.Append(rerr, close())
|
||||
}
|
||||
}()
|
||||
if _, ok := r.Header["Content-Type"]; !ok && r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return req, close, err
|
||||
}
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request OptScriptPolicyCreate
|
||||
if err := func() error {
|
||||
request.Reset()
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, close, err
|
||||
}
|
||||
return request, close, nil
|
||||
default:
|
||||
return req, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateSubmissionRequest(r *http.Request) (
|
||||
req OptSubmissionCreate,
|
||||
close func() error,
|
||||
@@ -81,3 +215,137 @@ func (s *Server) decodeCreateSubmissionRequest(r *http.Request) (
|
||||
return req, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeUpdateScriptRequest(r *http.Request) (
|
||||
req OptScriptUpdate,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = multierr.Append(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = multierr.Append(rerr, close())
|
||||
}
|
||||
}()
|
||||
if _, ok := r.Header["Content-Type"]; !ok && r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return req, close, err
|
||||
}
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request OptScriptUpdate
|
||||
if err := func() error {
|
||||
request.Reset()
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, close, err
|
||||
}
|
||||
return request, close, nil
|
||||
default:
|
||||
return req, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeUpdateScriptPolicyRequest(r *http.Request) (
|
||||
req OptScriptPolicyUpdate,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = multierr.Append(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = multierr.Append(rerr, close())
|
||||
}
|
||||
}()
|
||||
if _, ok := r.Header["Content-Type"]; !ok && r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return req, close, err
|
||||
}
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, close, nil
|
||||
}
|
||||
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request OptScriptPolicyUpdate
|
||||
if err := func() error {
|
||||
request.Reset()
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, close, err
|
||||
}
|
||||
return request, close, nil
|
||||
default:
|
||||
return req, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,46 @@ import (
|
||||
ht "github.com/ogen-go/ogen/http"
|
||||
)
|
||||
|
||||
func encodeCreateScriptRequest(
|
||||
req OptScriptCreate,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
if !req.Set {
|
||||
// Keep request with empty body if value is not set.
|
||||
return nil
|
||||
}
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
if req.Set {
|
||||
req.Encode(e)
|
||||
}
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeCreateScriptPolicyRequest(
|
||||
req OptScriptPolicyCreate,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
if !req.Set {
|
||||
// Keep request with empty body if value is not set.
|
||||
return nil
|
||||
}
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
if req.Set {
|
||||
req.Encode(e)
|
||||
}
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeCreateSubmissionRequest(
|
||||
req OptSubmissionCreate,
|
||||
r *http.Request,
|
||||
@@ -30,3 +70,43 @@ func encodeCreateSubmissionRequest(
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeUpdateScriptRequest(
|
||||
req OptScriptUpdate,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
if !req.Set {
|
||||
// Keep request with empty body if value is not set.
|
||||
return nil
|
||||
}
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
if req.Set {
|
||||
req.Encode(e)
|
||||
}
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeUpdateScriptPolicyRequest(
|
||||
req OptScriptPolicyUpdate,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
if !req.Set {
|
||||
// Keep request with empty body if value is not set.
|
||||
return nil
|
||||
}
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
if req.Set {
|
||||
req.Encode(e)
|
||||
}
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -422,6 +422,172 @@ func decodeActionSubmissionValidateResponse(resp *http.Response) (res *ActionSub
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeCreateScriptResponse(resp *http.Response) (res *ID, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response ID
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &response, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeCreateScriptPolicyResponse(resp *http.Response) (res *ID, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response ID
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &response, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeCreateSubmissionResponse(resp *http.Response) (res *ID, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
@@ -505,6 +671,357 @@ func decodeCreateSubmissionResponse(resp *http.Response) (res *ID, _ error) {
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeDeleteScriptResponse(resp *http.Response) (res *DeleteScriptOK, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
return &DeleteScriptOK{}, nil
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeDeleteScriptPolicyResponse(resp *http.Response) (res *DeleteScriptPolicyOK, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
return &DeleteScriptPolicyOK{}, nil
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeGetScriptResponse(resp *http.Response) (res *Script, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Script
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &response, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeGetScriptPolicyResponse(resp *http.Response) (res *ScriptPolicy, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response ScriptPolicy
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &response, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeGetScriptPolicyFromHashResponse(resp *http.Response) (res *ScriptPolicy, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response ScriptPolicy
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &response, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeGetSubmissionResponse(resp *http.Response) (res *Submission, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
@@ -789,3 +1306,105 @@ func decodePatchSubmissionModelResponse(resp *http.Response) (res *PatchSubmissi
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeUpdateScriptResponse(resp *http.Response) (res *UpdateScriptOK, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
return &UpdateScriptOK{}, nil
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
func decodeUpdateScriptPolicyResponse(resp *http.Response) (res *UpdateScriptPolicyOK, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
return &UpdateScriptPolicyOK{}, nil
|
||||
}
|
||||
// Convenient error response.
|
||||
defRes, err := func() (res *ErrorStatusCode, err error) {
|
||||
ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return res, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
buf, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Error
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
return &ErrorStatusCode{
|
||||
StatusCode: resp.StatusCode,
|
||||
Response: response,
|
||||
}, nil
|
||||
default:
|
||||
return res, validate.InvalidContentType(ct)
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
||||
}
|
||||
return res, errors.Wrap(defRes, "error")
|
||||
}
|
||||
|
||||
@@ -69,6 +69,34 @@ func encodeActionSubmissionValidateResponse(response *ActionSubmissionValidateOK
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeCreateScriptResponse(response *ID, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeCreateScriptPolicyResponse(response *ID, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeCreateSubmissionResponse(response *ID, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
@@ -83,6 +111,62 @@ func encodeCreateSubmissionResponse(response *ID, w http.ResponseWriter, span tr
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeDeleteScriptResponse(response *DeleteScriptOK, w http.ResponseWriter, span trace.Span) error {
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeDeleteScriptPolicyResponse(response *DeleteScriptPolicyOK, w http.ResponseWriter, span trace.Span) error {
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeGetScriptResponse(response *Script, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeGetScriptPolicyResponse(response *ScriptPolicy, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeGetScriptPolicyFromHashResponse(response *ScriptPolicy, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeGetSubmissionResponse(response *Submission, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
@@ -129,6 +213,20 @@ func encodePatchSubmissionModelResponse(response *PatchSubmissionModelOK, w http
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeUpdateScriptResponse(response *UpdateScriptOK, w http.ResponseWriter, span trace.Span) error {
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeUpdateScriptPolicyResponse(response *UpdateScriptPolicyOK, w http.ResponseWriter, span trace.Span) error {
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeErrorResponse(response *ErrorStatusCode, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
code := response.StatusCode
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,12 @@ func (s *CookieAuth) SetAPIKey(val string) {
|
||||
s.APIKey = val
|
||||
}
|
||||
|
||||
// DeleteScriptOK is response for DeleteScript operation.
|
||||
type DeleteScriptOK struct{}
|
||||
|
||||
// DeleteScriptPolicyOK is response for DeleteScriptPolicy operation.
|
||||
type DeleteScriptPolicyOK struct{}
|
||||
|
||||
// Represents error object.
|
||||
// Ref: #/components/schemas/Error
|
||||
type Error struct {
|
||||
@@ -103,65 +109,19 @@ func (s *ErrorStatusCode) SetResponse(val Error) {
|
||||
|
||||
// Ref: #/components/schemas/Id
|
||||
type ID struct {
|
||||
ID OptInt64 `json:"ID"`
|
||||
ID int64 `json:"ID"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *ID) GetID() OptInt64 {
|
||||
func (s *ID) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *ID) SetID(val OptInt64) {
|
||||
func (s *ID) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// NewOptBool returns new OptBool with value set to v.
|
||||
func NewOptBool(v bool) OptBool {
|
||||
return OptBool{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptBool is optional bool.
|
||||
type OptBool struct {
|
||||
Value bool
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptBool was set.
|
||||
func (o OptBool) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptBool) Reset() {
|
||||
var v bool
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptBool) SetTo(v bool) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptBool) Get() (v bool, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptBool) Or(d bool) bool {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptInt32 returns new OptInt32 with value set to v.
|
||||
func NewOptInt32(v int32) OptInt32 {
|
||||
return OptInt32{
|
||||
@@ -254,6 +214,190 @@ func (o OptInt64) Or(d int64) int64 {
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptScriptCreate returns new OptScriptCreate with value set to v.
|
||||
func NewOptScriptCreate(v ScriptCreate) OptScriptCreate {
|
||||
return OptScriptCreate{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptScriptCreate is optional ScriptCreate.
|
||||
type OptScriptCreate struct {
|
||||
Value ScriptCreate
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptScriptCreate was set.
|
||||
func (o OptScriptCreate) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptScriptCreate) Reset() {
|
||||
var v ScriptCreate
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptScriptCreate) SetTo(v ScriptCreate) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptScriptCreate) Get() (v ScriptCreate, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptScriptCreate) Or(d ScriptCreate) ScriptCreate {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptScriptPolicyCreate returns new OptScriptPolicyCreate with value set to v.
|
||||
func NewOptScriptPolicyCreate(v ScriptPolicyCreate) OptScriptPolicyCreate {
|
||||
return OptScriptPolicyCreate{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptScriptPolicyCreate is optional ScriptPolicyCreate.
|
||||
type OptScriptPolicyCreate struct {
|
||||
Value ScriptPolicyCreate
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptScriptPolicyCreate was set.
|
||||
func (o OptScriptPolicyCreate) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptScriptPolicyCreate) Reset() {
|
||||
var v ScriptPolicyCreate
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptScriptPolicyCreate) SetTo(v ScriptPolicyCreate) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptScriptPolicyCreate) Get() (v ScriptPolicyCreate, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptScriptPolicyCreate) Or(d ScriptPolicyCreate) ScriptPolicyCreate {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptScriptPolicyUpdate returns new OptScriptPolicyUpdate with value set to v.
|
||||
func NewOptScriptPolicyUpdate(v ScriptPolicyUpdate) OptScriptPolicyUpdate {
|
||||
return OptScriptPolicyUpdate{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptScriptPolicyUpdate is optional ScriptPolicyUpdate.
|
||||
type OptScriptPolicyUpdate struct {
|
||||
Value ScriptPolicyUpdate
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptScriptPolicyUpdate was set.
|
||||
func (o OptScriptPolicyUpdate) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptScriptPolicyUpdate) Reset() {
|
||||
var v ScriptPolicyUpdate
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptScriptPolicyUpdate) SetTo(v ScriptPolicyUpdate) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptScriptPolicyUpdate) Get() (v ScriptPolicyUpdate, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptScriptPolicyUpdate) Or(d ScriptPolicyUpdate) ScriptPolicyUpdate {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptScriptUpdate returns new OptScriptUpdate with value set to v.
|
||||
func NewOptScriptUpdate(v ScriptUpdate) OptScriptUpdate {
|
||||
return OptScriptUpdate{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptScriptUpdate is optional ScriptUpdate.
|
||||
type OptScriptUpdate struct {
|
||||
Value ScriptUpdate
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptScriptUpdate was set.
|
||||
func (o OptScriptUpdate) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptScriptUpdate) Reset() {
|
||||
var v ScriptUpdate
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptScriptUpdate) SetTo(v ScriptUpdate) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptScriptUpdate) Get() (v ScriptUpdate, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
return o.Value, true
|
||||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptScriptUpdate) Or(d ScriptUpdate) ScriptUpdate {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// NewOptString returns new OptString with value set to v.
|
||||
func NewOptString(v string) OptString {
|
||||
return OptString{
|
||||
@@ -424,69 +568,313 @@ type PatchSubmissionCompletedOK struct{}
|
||||
// PatchSubmissionModelOK is response for PatchSubmissionModel operation.
|
||||
type PatchSubmissionModelOK struct{}
|
||||
|
||||
// Ref: #/components/schemas/Submission
|
||||
type Submission struct {
|
||||
ID OptInt64 `json:"ID"`
|
||||
DisplayName OptString `json:"DisplayName"`
|
||||
Creator OptString `json:"Creator"`
|
||||
GameID OptInt32 `json:"GameID"`
|
||||
Date OptInt64 `json:"Date"`
|
||||
Submitter OptInt64 `json:"Submitter"`
|
||||
AssetID OptInt64 `json:"AssetID"`
|
||||
AssetVersion OptInt64 `json:"AssetVersion"`
|
||||
Completed OptBool `json:"Completed"`
|
||||
SubmissionType OptInt32 `json:"SubmissionType"`
|
||||
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
||||
StatusID OptInt32 `json:"StatusID"`
|
||||
// Ref: #/components/schemas/Script
|
||||
type Script struct {
|
||||
ID int64 `json:"ID"`
|
||||
Hash string `json:"Hash"`
|
||||
Source string `json:"Source"`
|
||||
SubmissionID OptInt64 `json:"SubmissionID"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *Submission) GetID() OptInt64 {
|
||||
func (s *Script) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetHash returns the value of Hash.
|
||||
func (s *Script) GetHash() string {
|
||||
return s.Hash
|
||||
}
|
||||
|
||||
// GetSource returns the value of Source.
|
||||
func (s *Script) GetSource() string {
|
||||
return s.Source
|
||||
}
|
||||
|
||||
// GetSubmissionID returns the value of SubmissionID.
|
||||
func (s *Script) GetSubmissionID() OptInt64 {
|
||||
return s.SubmissionID
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *Script) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetHash sets the value of Hash.
|
||||
func (s *Script) SetHash(val string) {
|
||||
s.Hash = val
|
||||
}
|
||||
|
||||
// SetSource sets the value of Source.
|
||||
func (s *Script) SetSource(val string) {
|
||||
s.Source = val
|
||||
}
|
||||
|
||||
// SetSubmissionID sets the value of SubmissionID.
|
||||
func (s *Script) SetSubmissionID(val OptInt64) {
|
||||
s.SubmissionID = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/ScriptCreate
|
||||
type ScriptCreate struct {
|
||||
Source string `json:"Source"`
|
||||
SubmissionID OptInt64 `json:"SubmissionID"`
|
||||
}
|
||||
|
||||
// GetSource returns the value of Source.
|
||||
func (s *ScriptCreate) GetSource() string {
|
||||
return s.Source
|
||||
}
|
||||
|
||||
// GetSubmissionID returns the value of SubmissionID.
|
||||
func (s *ScriptCreate) GetSubmissionID() OptInt64 {
|
||||
return s.SubmissionID
|
||||
}
|
||||
|
||||
// SetSource sets the value of Source.
|
||||
func (s *ScriptCreate) SetSource(val string) {
|
||||
s.Source = val
|
||||
}
|
||||
|
||||
// SetSubmissionID sets the value of SubmissionID.
|
||||
func (s *ScriptCreate) SetSubmissionID(val OptInt64) {
|
||||
s.SubmissionID = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/ScriptPolicy
|
||||
type ScriptPolicy struct {
|
||||
ID int64 `json:"ID"`
|
||||
FromScriptHash string `json:"FromScriptHash"`
|
||||
ToScriptID int64 `json:"ToScriptID"`
|
||||
Policy int32 `json:"Policy"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *ScriptPolicy) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetFromScriptHash returns the value of FromScriptHash.
|
||||
func (s *ScriptPolicy) GetFromScriptHash() string {
|
||||
return s.FromScriptHash
|
||||
}
|
||||
|
||||
// GetToScriptID returns the value of ToScriptID.
|
||||
func (s *ScriptPolicy) GetToScriptID() int64 {
|
||||
return s.ToScriptID
|
||||
}
|
||||
|
||||
// GetPolicy returns the value of Policy.
|
||||
func (s *ScriptPolicy) GetPolicy() int32 {
|
||||
return s.Policy
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *ScriptPolicy) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetFromScriptHash sets the value of FromScriptHash.
|
||||
func (s *ScriptPolicy) SetFromScriptHash(val string) {
|
||||
s.FromScriptHash = val
|
||||
}
|
||||
|
||||
// SetToScriptID sets the value of ToScriptID.
|
||||
func (s *ScriptPolicy) SetToScriptID(val int64) {
|
||||
s.ToScriptID = val
|
||||
}
|
||||
|
||||
// SetPolicy sets the value of Policy.
|
||||
func (s *ScriptPolicy) SetPolicy(val int32) {
|
||||
s.Policy = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/ScriptPolicyCreate
|
||||
type ScriptPolicyCreate struct {
|
||||
FromScriptID int64 `json:"FromScriptID"`
|
||||
ToScriptID int64 `json:"ToScriptID"`
|
||||
Policy int32 `json:"Policy"`
|
||||
}
|
||||
|
||||
// GetFromScriptID returns the value of FromScriptID.
|
||||
func (s *ScriptPolicyCreate) GetFromScriptID() int64 {
|
||||
return s.FromScriptID
|
||||
}
|
||||
|
||||
// GetToScriptID returns the value of ToScriptID.
|
||||
func (s *ScriptPolicyCreate) GetToScriptID() int64 {
|
||||
return s.ToScriptID
|
||||
}
|
||||
|
||||
// GetPolicy returns the value of Policy.
|
||||
func (s *ScriptPolicyCreate) GetPolicy() int32 {
|
||||
return s.Policy
|
||||
}
|
||||
|
||||
// SetFromScriptID sets the value of FromScriptID.
|
||||
func (s *ScriptPolicyCreate) SetFromScriptID(val int64) {
|
||||
s.FromScriptID = val
|
||||
}
|
||||
|
||||
// SetToScriptID sets the value of ToScriptID.
|
||||
func (s *ScriptPolicyCreate) SetToScriptID(val int64) {
|
||||
s.ToScriptID = val
|
||||
}
|
||||
|
||||
// SetPolicy sets the value of Policy.
|
||||
func (s *ScriptPolicyCreate) SetPolicy(val int32) {
|
||||
s.Policy = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/ScriptPolicyUpdate
|
||||
type ScriptPolicyUpdate struct {
|
||||
ID int64 `json:"ID"`
|
||||
FromScriptID OptInt64 `json:"FromScriptID"`
|
||||
ToScriptID OptInt64 `json:"ToScriptID"`
|
||||
Policy OptInt32 `json:"Policy"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *ScriptPolicyUpdate) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetFromScriptID returns the value of FromScriptID.
|
||||
func (s *ScriptPolicyUpdate) GetFromScriptID() OptInt64 {
|
||||
return s.FromScriptID
|
||||
}
|
||||
|
||||
// GetToScriptID returns the value of ToScriptID.
|
||||
func (s *ScriptPolicyUpdate) GetToScriptID() OptInt64 {
|
||||
return s.ToScriptID
|
||||
}
|
||||
|
||||
// GetPolicy returns the value of Policy.
|
||||
func (s *ScriptPolicyUpdate) GetPolicy() OptInt32 {
|
||||
return s.Policy
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *ScriptPolicyUpdate) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetFromScriptID sets the value of FromScriptID.
|
||||
func (s *ScriptPolicyUpdate) SetFromScriptID(val OptInt64) {
|
||||
s.FromScriptID = val
|
||||
}
|
||||
|
||||
// SetToScriptID sets the value of ToScriptID.
|
||||
func (s *ScriptPolicyUpdate) SetToScriptID(val OptInt64) {
|
||||
s.ToScriptID = val
|
||||
}
|
||||
|
||||
// SetPolicy sets the value of Policy.
|
||||
func (s *ScriptPolicyUpdate) SetPolicy(val OptInt32) {
|
||||
s.Policy = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/ScriptUpdate
|
||||
type ScriptUpdate struct {
|
||||
ID int64 `json:"ID"`
|
||||
Source OptString `json:"Source"`
|
||||
SubmissionID OptInt64 `json:"SubmissionID"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *ScriptUpdate) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetSource returns the value of Source.
|
||||
func (s *ScriptUpdate) GetSource() OptString {
|
||||
return s.Source
|
||||
}
|
||||
|
||||
// GetSubmissionID returns the value of SubmissionID.
|
||||
func (s *ScriptUpdate) GetSubmissionID() OptInt64 {
|
||||
return s.SubmissionID
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *ScriptUpdate) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetSource sets the value of Source.
|
||||
func (s *ScriptUpdate) SetSource(val OptString) {
|
||||
s.Source = val
|
||||
}
|
||||
|
||||
// SetSubmissionID sets the value of SubmissionID.
|
||||
func (s *ScriptUpdate) SetSubmissionID(val OptInt64) {
|
||||
s.SubmissionID = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/Submission
|
||||
type Submission struct {
|
||||
ID int64 `json:"ID"`
|
||||
DisplayName string `json:"DisplayName"`
|
||||
Creator string `json:"Creator"`
|
||||
GameID int32 `json:"GameID"`
|
||||
Date int64 `json:"Date"`
|
||||
Submitter int64 `json:"Submitter"`
|
||||
AssetID int64 `json:"AssetID"`
|
||||
AssetVersion int64 `json:"AssetVersion"`
|
||||
Completed bool `json:"Completed"`
|
||||
SubmissionType int32 `json:"SubmissionType"`
|
||||
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
||||
StatusID int32 `json:"StatusID"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *Submission) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetDisplayName returns the value of DisplayName.
|
||||
func (s *Submission) GetDisplayName() OptString {
|
||||
func (s *Submission) GetDisplayName() string {
|
||||
return s.DisplayName
|
||||
}
|
||||
|
||||
// GetCreator returns the value of Creator.
|
||||
func (s *Submission) GetCreator() OptString {
|
||||
func (s *Submission) GetCreator() string {
|
||||
return s.Creator
|
||||
}
|
||||
|
||||
// GetGameID returns the value of GameID.
|
||||
func (s *Submission) GetGameID() OptInt32 {
|
||||
func (s *Submission) GetGameID() int32 {
|
||||
return s.GameID
|
||||
}
|
||||
|
||||
// GetDate returns the value of Date.
|
||||
func (s *Submission) GetDate() OptInt64 {
|
||||
func (s *Submission) GetDate() int64 {
|
||||
return s.Date
|
||||
}
|
||||
|
||||
// GetSubmitter returns the value of Submitter.
|
||||
func (s *Submission) GetSubmitter() OptInt64 {
|
||||
func (s *Submission) GetSubmitter() int64 {
|
||||
return s.Submitter
|
||||
}
|
||||
|
||||
// GetAssetID returns the value of AssetID.
|
||||
func (s *Submission) GetAssetID() OptInt64 {
|
||||
func (s *Submission) GetAssetID() int64 {
|
||||
return s.AssetID
|
||||
}
|
||||
|
||||
// GetAssetVersion returns the value of AssetVersion.
|
||||
func (s *Submission) GetAssetVersion() OptInt64 {
|
||||
func (s *Submission) GetAssetVersion() int64 {
|
||||
return s.AssetVersion
|
||||
}
|
||||
|
||||
// GetCompleted returns the value of Completed.
|
||||
func (s *Submission) GetCompleted() OptBool {
|
||||
func (s *Submission) GetCompleted() bool {
|
||||
return s.Completed
|
||||
}
|
||||
|
||||
// GetSubmissionType returns the value of SubmissionType.
|
||||
func (s *Submission) GetSubmissionType() OptInt32 {
|
||||
func (s *Submission) GetSubmissionType() int32 {
|
||||
return s.SubmissionType
|
||||
}
|
||||
|
||||
@@ -496,57 +884,57 @@ func (s *Submission) GetTargetAssetID() OptInt64 {
|
||||
}
|
||||
|
||||
// GetStatusID returns the value of StatusID.
|
||||
func (s *Submission) GetStatusID() OptInt32 {
|
||||
func (s *Submission) GetStatusID() int32 {
|
||||
return s.StatusID
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *Submission) SetID(val OptInt64) {
|
||||
func (s *Submission) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetDisplayName sets the value of DisplayName.
|
||||
func (s *Submission) SetDisplayName(val OptString) {
|
||||
func (s *Submission) SetDisplayName(val string) {
|
||||
s.DisplayName = val
|
||||
}
|
||||
|
||||
// SetCreator sets the value of Creator.
|
||||
func (s *Submission) SetCreator(val OptString) {
|
||||
func (s *Submission) SetCreator(val string) {
|
||||
s.Creator = val
|
||||
}
|
||||
|
||||
// SetGameID sets the value of GameID.
|
||||
func (s *Submission) SetGameID(val OptInt32) {
|
||||
func (s *Submission) SetGameID(val int32) {
|
||||
s.GameID = val
|
||||
}
|
||||
|
||||
// SetDate sets the value of Date.
|
||||
func (s *Submission) SetDate(val OptInt64) {
|
||||
func (s *Submission) SetDate(val int64) {
|
||||
s.Date = val
|
||||
}
|
||||
|
||||
// SetSubmitter sets the value of Submitter.
|
||||
func (s *Submission) SetSubmitter(val OptInt64) {
|
||||
func (s *Submission) SetSubmitter(val int64) {
|
||||
s.Submitter = val
|
||||
}
|
||||
|
||||
// SetAssetID sets the value of AssetID.
|
||||
func (s *Submission) SetAssetID(val OptInt64) {
|
||||
func (s *Submission) SetAssetID(val int64) {
|
||||
s.AssetID = val
|
||||
}
|
||||
|
||||
// SetAssetVersion sets the value of AssetVersion.
|
||||
func (s *Submission) SetAssetVersion(val OptInt64) {
|
||||
func (s *Submission) SetAssetVersion(val int64) {
|
||||
s.AssetVersion = val
|
||||
}
|
||||
|
||||
// SetCompleted sets the value of Completed.
|
||||
func (s *Submission) SetCompleted(val OptBool) {
|
||||
func (s *Submission) SetCompleted(val bool) {
|
||||
s.Completed = val
|
||||
}
|
||||
|
||||
// SetSubmissionType sets the value of SubmissionType.
|
||||
func (s *Submission) SetSubmissionType(val OptInt32) {
|
||||
func (s *Submission) SetSubmissionType(val int32) {
|
||||
s.SubmissionType = val
|
||||
}
|
||||
|
||||
@@ -556,54 +944,54 @@ func (s *Submission) SetTargetAssetID(val OptInt64) {
|
||||
}
|
||||
|
||||
// SetStatusID sets the value of StatusID.
|
||||
func (s *Submission) SetStatusID(val OptInt32) {
|
||||
func (s *Submission) SetStatusID(val int32) {
|
||||
s.StatusID = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/SubmissionCreate
|
||||
type SubmissionCreate struct {
|
||||
DisplayName OptString `json:"DisplayName"`
|
||||
Creator OptString `json:"Creator"`
|
||||
GameID OptInt32 `json:"GameID"`
|
||||
Submitter OptInt64 `json:"Submitter"`
|
||||
AssetID OptInt64 `json:"AssetID"`
|
||||
AssetVersion OptInt64 `json:"AssetVersion"`
|
||||
SubmissionType OptInt32 `json:"SubmissionType"`
|
||||
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
||||
DisplayName string `json:"DisplayName"`
|
||||
Creator string `json:"Creator"`
|
||||
GameID int32 `json:"GameID"`
|
||||
Submitter int64 `json:"Submitter"`
|
||||
AssetID int64 `json:"AssetID"`
|
||||
AssetVersion int64 `json:"AssetVersion"`
|
||||
SubmissionType int32 `json:"SubmissionType"`
|
||||
TargetAssetID OptInt64 `json:"TargetAssetID"`
|
||||
}
|
||||
|
||||
// GetDisplayName returns the value of DisplayName.
|
||||
func (s *SubmissionCreate) GetDisplayName() OptString {
|
||||
func (s *SubmissionCreate) GetDisplayName() string {
|
||||
return s.DisplayName
|
||||
}
|
||||
|
||||
// GetCreator returns the value of Creator.
|
||||
func (s *SubmissionCreate) GetCreator() OptString {
|
||||
func (s *SubmissionCreate) GetCreator() string {
|
||||
return s.Creator
|
||||
}
|
||||
|
||||
// GetGameID returns the value of GameID.
|
||||
func (s *SubmissionCreate) GetGameID() OptInt32 {
|
||||
func (s *SubmissionCreate) GetGameID() int32 {
|
||||
return s.GameID
|
||||
}
|
||||
|
||||
// GetSubmitter returns the value of Submitter.
|
||||
func (s *SubmissionCreate) GetSubmitter() OptInt64 {
|
||||
func (s *SubmissionCreate) GetSubmitter() int64 {
|
||||
return s.Submitter
|
||||
}
|
||||
|
||||
// GetAssetID returns the value of AssetID.
|
||||
func (s *SubmissionCreate) GetAssetID() OptInt64 {
|
||||
func (s *SubmissionCreate) GetAssetID() int64 {
|
||||
return s.AssetID
|
||||
}
|
||||
|
||||
// GetAssetVersion returns the value of AssetVersion.
|
||||
func (s *SubmissionCreate) GetAssetVersion() OptInt64 {
|
||||
func (s *SubmissionCreate) GetAssetVersion() int64 {
|
||||
return s.AssetVersion
|
||||
}
|
||||
|
||||
// GetSubmissionType returns the value of SubmissionType.
|
||||
func (s *SubmissionCreate) GetSubmissionType() OptInt32 {
|
||||
func (s *SubmissionCreate) GetSubmissionType() int32 {
|
||||
return s.SubmissionType
|
||||
}
|
||||
|
||||
@@ -613,37 +1001,37 @@ func (s *SubmissionCreate) GetTargetAssetID() OptInt64 {
|
||||
}
|
||||
|
||||
// SetDisplayName sets the value of DisplayName.
|
||||
func (s *SubmissionCreate) SetDisplayName(val OptString) {
|
||||
func (s *SubmissionCreate) SetDisplayName(val string) {
|
||||
s.DisplayName = val
|
||||
}
|
||||
|
||||
// SetCreator sets the value of Creator.
|
||||
func (s *SubmissionCreate) SetCreator(val OptString) {
|
||||
func (s *SubmissionCreate) SetCreator(val string) {
|
||||
s.Creator = val
|
||||
}
|
||||
|
||||
// SetGameID sets the value of GameID.
|
||||
func (s *SubmissionCreate) SetGameID(val OptInt32) {
|
||||
func (s *SubmissionCreate) SetGameID(val int32) {
|
||||
s.GameID = val
|
||||
}
|
||||
|
||||
// SetSubmitter sets the value of Submitter.
|
||||
func (s *SubmissionCreate) SetSubmitter(val OptInt64) {
|
||||
func (s *SubmissionCreate) SetSubmitter(val int64) {
|
||||
s.Submitter = val
|
||||
}
|
||||
|
||||
// SetAssetID sets the value of AssetID.
|
||||
func (s *SubmissionCreate) SetAssetID(val OptInt64) {
|
||||
func (s *SubmissionCreate) SetAssetID(val int64) {
|
||||
s.AssetID = val
|
||||
}
|
||||
|
||||
// SetAssetVersion sets the value of AssetVersion.
|
||||
func (s *SubmissionCreate) SetAssetVersion(val OptInt64) {
|
||||
func (s *SubmissionCreate) SetAssetVersion(val int64) {
|
||||
s.AssetVersion = val
|
||||
}
|
||||
|
||||
// SetSubmissionType sets the value of SubmissionType.
|
||||
func (s *SubmissionCreate) SetSubmissionType(val OptInt32) {
|
||||
func (s *SubmissionCreate) SetSubmissionType(val int32) {
|
||||
s.SubmissionType = val
|
||||
}
|
||||
|
||||
@@ -654,7 +1042,7 @@ func (s *SubmissionCreate) SetTargetAssetID(val OptInt64) {
|
||||
|
||||
// Ref: #/components/schemas/SubmissionFilter
|
||||
type SubmissionFilter struct {
|
||||
ID OptInt64 `json:"ID"`
|
||||
ID int64 `json:"ID"`
|
||||
DisplayName OptString `json:"DisplayName"`
|
||||
Creator OptString `json:"Creator"`
|
||||
GameID OptInt32 `json:"GameID"`
|
||||
@@ -662,7 +1050,7 @@ type SubmissionFilter struct {
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *SubmissionFilter) GetID() OptInt64 {
|
||||
func (s *SubmissionFilter) GetID() int64 {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
@@ -687,7 +1075,7 @@ func (s *SubmissionFilter) GetDate() OptInt64 {
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *SubmissionFilter) SetID(val OptInt64) {
|
||||
func (s *SubmissionFilter) SetID(val int64) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
@@ -710,3 +1098,9 @@ func (s *SubmissionFilter) SetGameID(val OptInt32) {
|
||||
func (s *SubmissionFilter) SetDate(val OptInt64) {
|
||||
s.Date = val
|
||||
}
|
||||
|
||||
// UpdateScriptOK is response for UpdateScript operation.
|
||||
type UpdateScriptOK struct{}
|
||||
|
||||
// UpdateScriptPolicyOK is response for UpdateScriptPolicy operation.
|
||||
type UpdateScriptPolicyOK struct{}
|
||||
|
||||
@@ -56,12 +56,54 @@ type Handler interface {
|
||||
//
|
||||
// PATCH /submissions/{SubmissionID}/status/validate
|
||||
ActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) error
|
||||
// CreateScript implements createScript operation.
|
||||
//
|
||||
// Create a new script.
|
||||
//
|
||||
// POST /scripts
|
||||
CreateScript(ctx context.Context, req OptScriptCreate) (*ID, error)
|
||||
// CreateScriptPolicy implements createScriptPolicy operation.
|
||||
//
|
||||
// Create a new script policy.
|
||||
//
|
||||
// POST /script-policy
|
||||
CreateScriptPolicy(ctx context.Context, req OptScriptPolicyCreate) (*ID, error)
|
||||
// CreateSubmission implements createSubmission operation.
|
||||
//
|
||||
// Create new submission.
|
||||
//
|
||||
// POST /submissions
|
||||
CreateSubmission(ctx context.Context, req OptSubmissionCreate) (*ID, error)
|
||||
// DeleteScript implements deleteScript operation.
|
||||
//
|
||||
// Delete the specified script by ID.
|
||||
//
|
||||
// DELETE /scripts/{ScriptID}
|
||||
DeleteScript(ctx context.Context, params DeleteScriptParams) error
|
||||
// DeleteScriptPolicy implements deleteScriptPolicy operation.
|
||||
//
|
||||
// Delete the specified script policy by ID.
|
||||
//
|
||||
// DELETE /script-policy/id/{ScriptPolicyID}
|
||||
DeleteScriptPolicy(ctx context.Context, params DeleteScriptPolicyParams) error
|
||||
// GetScript implements getScript operation.
|
||||
//
|
||||
// Get the specified script by ID.
|
||||
//
|
||||
// GET /scripts/{ScriptID}
|
||||
GetScript(ctx context.Context, params GetScriptParams) (*Script, error)
|
||||
// GetScriptPolicy implements getScriptPolicy operation.
|
||||
//
|
||||
// Get the specified script policy by ID.
|
||||
//
|
||||
// GET /script-policy/id/{ScriptPolicyID}
|
||||
GetScriptPolicy(ctx context.Context, params GetScriptPolicyParams) (*ScriptPolicy, error)
|
||||
// GetScriptPolicyFromHash implements getScriptPolicyFromHash operation.
|
||||
//
|
||||
// Get the policy for the given hash of script source code.
|
||||
//
|
||||
// GET /script-policy/hash/{FromScriptHash}
|
||||
GetScriptPolicyFromHash(ctx context.Context, params GetScriptPolicyFromHashParams) (*ScriptPolicy, error)
|
||||
// GetSubmission implements getSubmission operation.
|
||||
//
|
||||
// Retrieve map with ID.
|
||||
@@ -86,6 +128,18 @@ type Handler interface {
|
||||
//
|
||||
// PATCH /submissions/{SubmissionID}/model
|
||||
PatchSubmissionModel(ctx context.Context, params PatchSubmissionModelParams) error
|
||||
// UpdateScript implements updateScript operation.
|
||||
//
|
||||
// Update the specified script by ID.
|
||||
//
|
||||
// PATCH /scripts/{ScriptID}
|
||||
UpdateScript(ctx context.Context, req OptScriptUpdate, params UpdateScriptParams) error
|
||||
// UpdateScriptPolicy implements updateScriptPolicy operation.
|
||||
//
|
||||
// Update the specified script policy by ID.
|
||||
//
|
||||
// PATCH /script-policy/id/{ScriptPolicyID}
|
||||
UpdateScriptPolicy(ctx context.Context, req OptScriptPolicyUpdate, params UpdateScriptPolicyParams) error
|
||||
// NewError creates *ErrorStatusCode from error returned by handler.
|
||||
//
|
||||
// Used for common default response.
|
||||
|
||||
@@ -85,6 +85,24 @@ func (UnimplementedHandler) ActionSubmissionValidate(ctx context.Context, params
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateScript implements createScript operation.
|
||||
//
|
||||
// Create a new script.
|
||||
//
|
||||
// POST /scripts
|
||||
func (UnimplementedHandler) CreateScript(ctx context.Context, req OptScriptCreate) (r *ID, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateScriptPolicy implements createScriptPolicy operation.
|
||||
//
|
||||
// Create a new script policy.
|
||||
//
|
||||
// POST /script-policy
|
||||
func (UnimplementedHandler) CreateScriptPolicy(ctx context.Context, req OptScriptPolicyCreate) (r *ID, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateSubmission implements createSubmission operation.
|
||||
//
|
||||
// Create new submission.
|
||||
@@ -94,6 +112,51 @@ func (UnimplementedHandler) CreateSubmission(ctx context.Context, req OptSubmiss
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// DeleteScript implements deleteScript operation.
|
||||
//
|
||||
// Delete the specified script by ID.
|
||||
//
|
||||
// DELETE /scripts/{ScriptID}
|
||||
func (UnimplementedHandler) DeleteScript(ctx context.Context, params DeleteScriptParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// DeleteScriptPolicy implements deleteScriptPolicy operation.
|
||||
//
|
||||
// Delete the specified script policy by ID.
|
||||
//
|
||||
// DELETE /script-policy/id/{ScriptPolicyID}
|
||||
func (UnimplementedHandler) DeleteScriptPolicy(ctx context.Context, params DeleteScriptPolicyParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetScript implements getScript operation.
|
||||
//
|
||||
// Get the specified script by ID.
|
||||
//
|
||||
// GET /scripts/{ScriptID}
|
||||
func (UnimplementedHandler) GetScript(ctx context.Context, params GetScriptParams) (r *Script, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetScriptPolicy implements getScriptPolicy operation.
|
||||
//
|
||||
// Get the specified script policy by ID.
|
||||
//
|
||||
// GET /script-policy/id/{ScriptPolicyID}
|
||||
func (UnimplementedHandler) GetScriptPolicy(ctx context.Context, params GetScriptPolicyParams) (r *ScriptPolicy, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetScriptPolicyFromHash implements getScriptPolicyFromHash operation.
|
||||
//
|
||||
// Get the policy for the given hash of script source code.
|
||||
//
|
||||
// GET /script-policy/hash/{FromScriptHash}
|
||||
func (UnimplementedHandler) GetScriptPolicyFromHash(ctx context.Context, params GetScriptPolicyFromHashParams) (r *ScriptPolicy, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetSubmission implements getSubmission operation.
|
||||
//
|
||||
// Retrieve map with ID.
|
||||
@@ -130,6 +193,24 @@ func (UnimplementedHandler) PatchSubmissionModel(ctx context.Context, params Pat
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// UpdateScript implements updateScript operation.
|
||||
//
|
||||
// Update the specified script by ID.
|
||||
//
|
||||
// PATCH /scripts/{ScriptID}
|
||||
func (UnimplementedHandler) UpdateScript(ctx context.Context, req OptScriptUpdate, params UpdateScriptParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// UpdateScriptPolicy implements updateScriptPolicy operation.
|
||||
//
|
||||
// Update the specified script policy by ID.
|
||||
//
|
||||
// PATCH /script-policy/id/{ScriptPolicyID}
|
||||
func (UnimplementedHandler) UpdateScriptPolicy(ctx context.Context, req OptScriptPolicyUpdate, params UpdateScriptPolicyParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// NewError creates *ErrorStatusCode from error returned by handler.
|
||||
//
|
||||
// Used for common default response.
|
||||
|
||||
@@ -124,10 +124,7 @@ func (s *Pagination) DecodeURI(d uri.Decoder) error {
|
||||
// EncodeURI encodes SubmissionFilter as URI form.
|
||||
func (s *SubmissionFilter) EncodeURI(e uri.Encoder) error {
|
||||
if err := e.EncodeField("ID", func(e uri.Encoder) error {
|
||||
if val, ok := s.ID.Get(); ok {
|
||||
return e.EncodeValue(conv.Int64ToString(val))
|
||||
}
|
||||
return nil
|
||||
return e.EncodeValue(conv.Int64ToString(s.ID))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode field \"ID\"")
|
||||
}
|
||||
@@ -179,29 +176,24 @@ func (s *SubmissionFilter) DecodeURI(d uri.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode SubmissionFilter to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
if err := d.DecodeFields(func(k string, d uri.Decoder) error {
|
||||
switch k {
|
||||
case "ID":
|
||||
requiredBitSet[0] |= 1 << 0
|
||||
if err := func() error {
|
||||
var sDotIDVal int64
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToInt64(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sDotIDVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.ID.SetTo(sDotIDVal)
|
||||
|
||||
c, err := conv.ToInt64(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.ID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrap(err, "decode field \"ID\"")
|
||||
@@ -309,6 +301,38 @@ func (s *SubmissionFilter) DecodeURI(d uri.Decoder) error {
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode SubmissionFilter")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
for i, mask := range [1]uint8{
|
||||
0b00000001,
|
||||
} {
|
||||
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
|
||||
// Mask only required fields and check equality to mask using XOR.
|
||||
//
|
||||
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
|
||||
// Bits of fields which would be set are actually bits of missed fields.
|
||||
missed := bits.OnesCount8(result)
|
||||
for bitN := 0; bitN < missed; bitN++ {
|
||||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(uriFieldsNameOfSubmissionFilter) {
|
||||
name = uriFieldsNameOfSubmissionFilter[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
failures = append(failures, validate.FieldError{
|
||||
Name: name,
|
||||
Error: validate.ErrFieldRequired,
|
||||
})
|
||||
// Reset bit.
|
||||
result &^= 1 << bitIdx
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(failures) > 0 {
|
||||
return &validate.Error{Fields: failures}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user