From 88056344f453c3d8e9ccc885f79d5256d4384349 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 10 Dec 2024 22:23:08 -0800 Subject: [PATCH] openapi: generate --- pkg/api/oas_client_gen.go | 94 +++-------------- pkg/api/oas_handlers_gen.go | 148 +++++---------------------- pkg/api/oas_response_decoders_gen.go | 124 +++++++++++----------- pkg/api/oas_response_encoders_gen.go | 96 ++++++++--------- pkg/api/oas_schemas_gen.go | 56 +++++----- 5 files changed, 180 insertions(+), 338 deletions(-) diff --git a/pkg/api/oas_client_gen.go b/pkg/api/oas_client_gen.go index 0f91d04..5adc5f9 100644 --- a/pkg/api/oas_client_gen.go +++ b/pkg/api/oas_client_gen.go @@ -222,7 +222,7 @@ func (c *Client) ActionSubmissionPublish(ctx context.Context, params ActionSubmi return err } -func (c *Client) sendActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) (res *ActionSubmissionPublishOK, err error) { +func (c *Client) sendActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) (res *ActionSubmissionPublishNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionPublish"), semconv.HTTPRequestMethodKey.String("POST"), @@ -287,39 +287,6 @@ func (c *Client) sendActionSubmissionPublish(ctx context.Context, params ActionS return res, errors.Wrap(err, "create request") } - { - type bitset = [1]uint8 - var satisfied bitset - { - stage = "Security:CookieAuth" - switch err := c.securityCookieAuth(ctx, ActionSubmissionPublishOperation, r); { - case err == nil: // if NO error - satisfied[0] |= 1 << 0 - case errors.Is(err, ogenerrors.ErrSkipClientSecurity): - // Skip this security. - default: - return res, errors.Wrap(err, "security \"CookieAuth\"") - } - } - - if ok := func() bool { - nextRequirement: - for _, requirement := range []bitset{ - {0b00000001}, - } { - for i, mask := range requirement { - if satisfied[i]&mask != mask { - continue nextRequirement - } - } - return true - } - return false - }(); !ok { - return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied - } - } - stage = "SendRequest" resp, err := c.cfg.Client.Do(r) if err != nil { @@ -346,7 +313,7 @@ func (c *Client) ActionSubmissionReject(ctx context.Context, params ActionSubmis return err } -func (c *Client) sendActionSubmissionReject(ctx context.Context, params ActionSubmissionRejectParams) (res *ActionSubmissionRejectOK, err error) { +func (c *Client) sendActionSubmissionReject(ctx context.Context, params ActionSubmissionRejectParams) (res *ActionSubmissionRejectNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionReject"), semconv.HTTPRequestMethodKey.String("POST"), @@ -470,7 +437,7 @@ func (c *Client) ActionSubmissionRequestChanges(ctx context.Context, params Acti return err } -func (c *Client) sendActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) (res *ActionSubmissionRequestChangesOK, err error) { +func (c *Client) sendActionSubmissionRequestChanges(ctx context.Context, params ActionSubmissionRequestChangesParams) (res *ActionSubmissionRequestChangesNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionRequestChanges"), semconv.HTTPRequestMethodKey.String("POST"), @@ -594,7 +561,7 @@ func (c *Client) ActionSubmissionRevoke(ctx context.Context, params ActionSubmis return err } -func (c *Client) sendActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) (res *ActionSubmissionRevokeOK, err error) { +func (c *Client) sendActionSubmissionRevoke(ctx context.Context, params ActionSubmissionRevokeParams) (res *ActionSubmissionRevokeNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionRevoke"), semconv.HTTPRequestMethodKey.String("POST"), @@ -718,7 +685,7 @@ func (c *Client) ActionSubmissionSubmit(ctx context.Context, params ActionSubmis return err } -func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) (res *ActionSubmissionSubmitOK, err error) { +func (c *Client) sendActionSubmissionSubmit(ctx context.Context, params ActionSubmissionSubmitParams) (res *ActionSubmissionSubmitNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionSubmit"), semconv.HTTPRequestMethodKey.String("POST"), @@ -842,7 +809,7 @@ func (c *Client) ActionSubmissionTriggerPublish(ctx context.Context, params Acti return err } -func (c *Client) sendActionSubmissionTriggerPublish(ctx context.Context, params ActionSubmissionTriggerPublishParams) (res *ActionSubmissionTriggerPublishOK, err error) { +func (c *Client) sendActionSubmissionTriggerPublish(ctx context.Context, params ActionSubmissionTriggerPublishParams) (res *ActionSubmissionTriggerPublishNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionTriggerPublish"), semconv.HTTPRequestMethodKey.String("POST"), @@ -966,7 +933,7 @@ func (c *Client) ActionSubmissionTriggerValidate(ctx context.Context, params Act return err } -func (c *Client) sendActionSubmissionTriggerValidate(ctx context.Context, params ActionSubmissionTriggerValidateParams) (res *ActionSubmissionTriggerValidateOK, err error) { +func (c *Client) sendActionSubmissionTriggerValidate(ctx context.Context, params ActionSubmissionTriggerValidateParams) (res *ActionSubmissionTriggerValidateNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionTriggerValidate"), semconv.HTTPRequestMethodKey.String("POST"), @@ -1090,7 +1057,7 @@ func (c *Client) ActionSubmissionValidate(ctx context.Context, params ActionSubm return err } -func (c *Client) sendActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) (res *ActionSubmissionValidateOK, err error) { +func (c *Client) sendActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) (res *ActionSubmissionValidateNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("actionSubmissionValidate"), semconv.HTTPRequestMethodKey.String("POST"), @@ -1155,39 +1122,6 @@ func (c *Client) sendActionSubmissionValidate(ctx context.Context, params Action return res, errors.Wrap(err, "create request") } - { - type bitset = [1]uint8 - var satisfied bitset - { - stage = "Security:CookieAuth" - switch err := c.securityCookieAuth(ctx, ActionSubmissionValidateOperation, r); { - case err == nil: // if NO error - satisfied[0] |= 1 << 0 - case errors.Is(err, ogenerrors.ErrSkipClientSecurity): - // Skip this security. - default: - return res, errors.Wrap(err, "security \"CookieAuth\"") - } - } - - if ok := func() bool { - nextRequirement: - for _, requirement := range []bitset{ - {0b00000001}, - } { - for i, mask := range requirement { - if satisfied[i]&mask != mask { - continue nextRequirement - } - } - return true - } - return false - }(); !ok { - return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied - } - } - stage = "SendRequest" resp, err := c.cfg.Client.Do(r) if err != nil { @@ -1538,7 +1472,7 @@ func (c *Client) DeleteScript(ctx context.Context, params DeleteScriptParams) er return err } -func (c *Client) sendDeleteScript(ctx context.Context, params DeleteScriptParams) (res *DeleteScriptOK, err error) { +func (c *Client) sendDeleteScript(ctx context.Context, params DeleteScriptParams) (res *DeleteScriptNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("deleteScript"), semconv.HTTPRequestMethodKey.String("DELETE"), @@ -1661,7 +1595,7 @@ func (c *Client) DeleteScriptPolicy(ctx context.Context, params DeleteScriptPoli return err } -func (c *Client) sendDeleteScriptPolicy(ctx context.Context, params DeleteScriptPolicyParams) (res *DeleteScriptPolicyOK, err error) { +func (c *Client) sendDeleteScriptPolicy(ctx context.Context, params DeleteScriptPolicyParams) (res *DeleteScriptPolicyNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("deleteScriptPolicy"), semconv.HTTPRequestMethodKey.String("DELETE"), @@ -2416,7 +2350,7 @@ func (c *Client) SetSubmissionCompleted(ctx context.Context, params SetSubmissio return err } -func (c *Client) sendSetSubmissionCompleted(ctx context.Context, params SetSubmissionCompletedParams) (res *SetSubmissionCompletedOK, err error) { +func (c *Client) sendSetSubmissionCompleted(ctx context.Context, params SetSubmissionCompletedParams) (res *SetSubmissionCompletedNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("setSubmissionCompleted"), semconv.HTTPRequestMethodKey.String("POST"), @@ -2540,7 +2474,7 @@ func (c *Client) UpdateScript(ctx context.Context, request *ScriptUpdate, params return err } -func (c *Client) sendUpdateScript(ctx context.Context, request *ScriptUpdate, params UpdateScriptParams) (res *UpdateScriptOK, err error) { +func (c *Client) sendUpdateScript(ctx context.Context, request *ScriptUpdate, params UpdateScriptParams) (res *UpdateScriptNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("updateScript"), semconv.HTTPRequestMethodKey.String("POST"), @@ -2666,7 +2600,7 @@ func (c *Client) UpdateScriptPolicy(ctx context.Context, request *ScriptPolicyUp return err } -func (c *Client) sendUpdateScriptPolicy(ctx context.Context, request *ScriptPolicyUpdate, params UpdateScriptPolicyParams) (res *UpdateScriptPolicyOK, err error) { +func (c *Client) sendUpdateScriptPolicy(ctx context.Context, request *ScriptPolicyUpdate, params UpdateScriptPolicyParams) (res *UpdateScriptPolicyNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("updateScriptPolicy"), semconv.HTTPRequestMethodKey.String("POST"), @@ -2792,7 +2726,7 @@ func (c *Client) UpdateSubmissionModel(ctx context.Context, params UpdateSubmiss return err } -func (c *Client) sendUpdateSubmissionModel(ctx context.Context, params UpdateSubmissionModelParams) (res *UpdateSubmissionModelOK, err error) { +func (c *Client) sendUpdateSubmissionModel(ctx context.Context, params UpdateSubmissionModelParams) (res *UpdateSubmissionModelNoContent, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("updateSubmissionModel"), semconv.HTTPRequestMethodKey.String("POST"), diff --git a/pkg/api/oas_handlers_gen.go b/pkg/api/oas_handlers_gen.go index 43af71f..7503f8a 100644 --- a/pkg/api/oas_handlers_gen.go +++ b/pkg/api/oas_handlers_gen.go @@ -104,52 +104,6 @@ func (s *Server) handleActionSubmissionPublishRequest(args [1]string, argsEscape ID: "actionSubmissionPublish", } ) - { - type bitset = [1]uint8 - var satisfied bitset - { - sctx, ok, err := s.securityCookieAuth(ctx, ActionSubmissionPublishOperation, r) - if err != nil { - err = &ogenerrors.SecurityError{ - OperationContext: opErrContext, - Security: "CookieAuth", - Err: err, - } - if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { - defer recordError("Security:CookieAuth", err) - } - return - } - if ok { - satisfied[0] |= 1 << 0 - ctx = sctx - } - } - - if ok := func() bool { - nextRequirement: - for _, requirement := range []bitset{ - {0b00000001}, - } { - for i, mask := range requirement { - if satisfied[i]&mask != mask { - continue nextRequirement - } - } - return true - } - return false - }(); !ok { - err = &ogenerrors.SecurityError{ - OperationContext: opErrContext, - Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, - } - if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { - defer recordError("Security", err) - } - return - } - } params, err := decodeActionSubmissionPublishParams(args, argsEscaped, r) if err != nil { err = &ogenerrors.DecodeParamsError{ @@ -161,7 +115,7 @@ func (s *Server) handleActionSubmissionPublishRequest(args [1]string, argsEscape return } - var response *ActionSubmissionPublishOK + var response *ActionSubmissionPublishNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -181,7 +135,7 @@ func (s *Server) handleActionSubmissionPublishRequest(args [1]string, argsEscape type ( Request = struct{} Params = ActionSubmissionPublishParams - Response = *ActionSubmissionPublishOK + Response = *ActionSubmissionPublishNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -356,7 +310,7 @@ func (s *Server) handleActionSubmissionRejectRequest(args [1]string, argsEscaped return } - var response *ActionSubmissionRejectOK + var response *ActionSubmissionRejectNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -376,7 +330,7 @@ func (s *Server) handleActionSubmissionRejectRequest(args [1]string, argsEscaped type ( Request = struct{} Params = ActionSubmissionRejectParams - Response = *ActionSubmissionRejectOK + Response = *ActionSubmissionRejectNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -551,7 +505,7 @@ func (s *Server) handleActionSubmissionRequestChangesRequest(args [1]string, arg return } - var response *ActionSubmissionRequestChangesOK + var response *ActionSubmissionRequestChangesNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -571,7 +525,7 @@ func (s *Server) handleActionSubmissionRequestChangesRequest(args [1]string, arg type ( Request = struct{} Params = ActionSubmissionRequestChangesParams - Response = *ActionSubmissionRequestChangesOK + Response = *ActionSubmissionRequestChangesNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -746,7 +700,7 @@ func (s *Server) handleActionSubmissionRevokeRequest(args [1]string, argsEscaped return } - var response *ActionSubmissionRevokeOK + var response *ActionSubmissionRevokeNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -766,7 +720,7 @@ func (s *Server) handleActionSubmissionRevokeRequest(args [1]string, argsEscaped type ( Request = struct{} Params = ActionSubmissionRevokeParams - Response = *ActionSubmissionRevokeOK + Response = *ActionSubmissionRevokeNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -941,7 +895,7 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped return } - var response *ActionSubmissionSubmitOK + var response *ActionSubmissionSubmitNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -961,7 +915,7 @@ func (s *Server) handleActionSubmissionSubmitRequest(args [1]string, argsEscaped type ( Request = struct{} Params = ActionSubmissionSubmitParams - Response = *ActionSubmissionSubmitOK + Response = *ActionSubmissionSubmitNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -1136,7 +1090,7 @@ func (s *Server) handleActionSubmissionTriggerPublishRequest(args [1]string, arg return } - var response *ActionSubmissionTriggerPublishOK + var response *ActionSubmissionTriggerPublishNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -1156,7 +1110,7 @@ func (s *Server) handleActionSubmissionTriggerPublishRequest(args [1]string, arg type ( Request = struct{} Params = ActionSubmissionTriggerPublishParams - Response = *ActionSubmissionTriggerPublishOK + Response = *ActionSubmissionTriggerPublishNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -1331,7 +1285,7 @@ func (s *Server) handleActionSubmissionTriggerValidateRequest(args [1]string, ar return } - var response *ActionSubmissionTriggerValidateOK + var response *ActionSubmissionTriggerValidateNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -1351,7 +1305,7 @@ func (s *Server) handleActionSubmissionTriggerValidateRequest(args [1]string, ar type ( Request = struct{} Params = ActionSubmissionTriggerValidateParams - Response = *ActionSubmissionTriggerValidateOK + Response = *ActionSubmissionTriggerValidateNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -1469,52 +1423,6 @@ func (s *Server) handleActionSubmissionValidateRequest(args [1]string, argsEscap ID: "actionSubmissionValidate", } ) - { - type bitset = [1]uint8 - var satisfied bitset - { - sctx, ok, err := s.securityCookieAuth(ctx, ActionSubmissionValidateOperation, r) - if err != nil { - err = &ogenerrors.SecurityError{ - OperationContext: opErrContext, - Security: "CookieAuth", - Err: err, - } - if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { - defer recordError("Security:CookieAuth", err) - } - return - } - if ok { - satisfied[0] |= 1 << 0 - ctx = sctx - } - } - - if ok := func() bool { - nextRequirement: - for _, requirement := range []bitset{ - {0b00000001}, - } { - for i, mask := range requirement { - if satisfied[i]&mask != mask { - continue nextRequirement - } - } - return true - } - return false - }(); !ok { - err = &ogenerrors.SecurityError{ - OperationContext: opErrContext, - Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, - } - if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil { - defer recordError("Security", err) - } - return - } - } params, err := decodeActionSubmissionValidateParams(args, argsEscaped, r) if err != nil { err = &ogenerrors.DecodeParamsError{ @@ -1526,7 +1434,7 @@ func (s *Server) handleActionSubmissionValidateRequest(args [1]string, argsEscap return } - var response *ActionSubmissionValidateOK + var response *ActionSubmissionValidateNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -1546,7 +1454,7 @@ func (s *Server) handleActionSubmissionValidateRequest(args [1]string, argsEscap type ( Request = struct{} Params = ActionSubmissionValidateParams - Response = *ActionSubmissionValidateOK + Response = *ActionSubmissionValidateNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -2306,7 +2214,7 @@ func (s *Server) handleDeleteScriptRequest(args [1]string, argsEscaped bool, w h return } - var response *DeleteScriptOK + var response *DeleteScriptNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -2326,7 +2234,7 @@ func (s *Server) handleDeleteScriptRequest(args [1]string, argsEscaped bool, w h type ( Request = struct{} Params = DeleteScriptParams - Response = *DeleteScriptOK + Response = *DeleteScriptNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -2501,7 +2409,7 @@ func (s *Server) handleDeleteScriptPolicyRequest(args [1]string, argsEscaped boo return } - var response *DeleteScriptPolicyOK + var response *DeleteScriptPolicyNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -2521,7 +2429,7 @@ func (s *Server) handleDeleteScriptPolicyRequest(args [1]string, argsEscaped boo type ( Request = struct{} Params = DeleteScriptPolicyParams - Response = *DeleteScriptPolicyOK + Response = *DeleteScriptPolicyNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -3675,7 +3583,7 @@ func (s *Server) handleSetSubmissionCompletedRequest(args [1]string, argsEscaped return } - var response *SetSubmissionCompletedOK + var response *SetSubmissionCompletedNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -3695,7 +3603,7 @@ func (s *Server) handleSetSubmissionCompletedRequest(args [1]string, argsEscaped type ( Request = struct{} Params = SetSubmissionCompletedParams - Response = *SetSubmissionCompletedOK + Response = *SetSubmissionCompletedNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -3885,7 +3793,7 @@ func (s *Server) handleUpdateScriptRequest(args [1]string, argsEscaped bool, w h } }() - var response *UpdateScriptOK + var response *UpdateScriptNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -3905,7 +3813,7 @@ func (s *Server) handleUpdateScriptRequest(args [1]string, argsEscaped bool, w h type ( Request = *ScriptUpdate Params = UpdateScriptParams - Response = *UpdateScriptOK + Response = *UpdateScriptNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -4095,7 +4003,7 @@ func (s *Server) handleUpdateScriptPolicyRequest(args [1]string, argsEscaped boo } }() - var response *UpdateScriptPolicyOK + var response *UpdateScriptPolicyNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -4115,7 +4023,7 @@ func (s *Server) handleUpdateScriptPolicyRequest(args [1]string, argsEscaped boo type ( Request = *ScriptPolicyUpdate Params = UpdateScriptPolicyParams - Response = *UpdateScriptPolicyOK + Response = *UpdateScriptPolicyNoContent ) response, err = middleware.HookMiddleware[ Request, @@ -4290,7 +4198,7 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped return } - var response *UpdateSubmissionModelOK + var response *UpdateSubmissionModelNoContent if m := s.cfg.Middleware; m != nil { mreq := middleware.Request{ Context: ctx, @@ -4318,7 +4226,7 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped type ( Request = struct{} Params = UpdateSubmissionModelParams - Response = *UpdateSubmissionModelOK + Response = *UpdateSubmissionModelNoContent ) response, err = middleware.HookMiddleware[ Request, diff --git a/pkg/api/oas_response_decoders_gen.go b/pkg/api/oas_response_decoders_gen.go index ba27517..db875be 100644 --- a/pkg/api/oas_response_decoders_gen.go +++ b/pkg/api/oas_response_decoders_gen.go @@ -15,11 +15,11 @@ import ( "github.com/ogen-go/ogen/validate" ) -func decodeActionSubmissionPublishResponse(resp *http.Response) (res *ActionSubmissionPublishOK, _ error) { +func decodeActionSubmissionPublishResponse(resp *http.Response) (res *ActionSubmissionPublishNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionPublishOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionPublishNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -66,11 +66,11 @@ func decodeActionSubmissionPublishResponse(resp *http.Response) (res *ActionSubm return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionRejectResponse(resp *http.Response) (res *ActionSubmissionRejectOK, _ error) { +func decodeActionSubmissionRejectResponse(resp *http.Response) (res *ActionSubmissionRejectNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionRejectOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionRejectNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -117,11 +117,11 @@ func decodeActionSubmissionRejectResponse(resp *http.Response) (res *ActionSubmi return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionRequestChangesResponse(resp *http.Response) (res *ActionSubmissionRequestChangesOK, _ error) { +func decodeActionSubmissionRequestChangesResponse(resp *http.Response) (res *ActionSubmissionRequestChangesNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionRequestChangesOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionRequestChangesNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -168,11 +168,11 @@ func decodeActionSubmissionRequestChangesResponse(resp *http.Response) (res *Act return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionRevokeResponse(resp *http.Response) (res *ActionSubmissionRevokeOK, _ error) { +func decodeActionSubmissionRevokeResponse(resp *http.Response) (res *ActionSubmissionRevokeNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionRevokeOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionRevokeNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -219,11 +219,11 @@ func decodeActionSubmissionRevokeResponse(resp *http.Response) (res *ActionSubmi return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionSubmitResponse(resp *http.Response) (res *ActionSubmissionSubmitOK, _ error) { +func decodeActionSubmissionSubmitResponse(resp *http.Response) (res *ActionSubmissionSubmitNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionSubmitOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionSubmitNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -270,11 +270,11 @@ func decodeActionSubmissionSubmitResponse(resp *http.Response) (res *ActionSubmi return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionTriggerPublishResponse(resp *http.Response) (res *ActionSubmissionTriggerPublishOK, _ error) { +func decodeActionSubmissionTriggerPublishResponse(resp *http.Response) (res *ActionSubmissionTriggerPublishNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionTriggerPublishOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionTriggerPublishNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -321,11 +321,11 @@ func decodeActionSubmissionTriggerPublishResponse(resp *http.Response) (res *Act return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionTriggerValidateResponse(resp *http.Response) (res *ActionSubmissionTriggerValidateOK, _ error) { +func decodeActionSubmissionTriggerValidateResponse(resp *http.Response) (res *ActionSubmissionTriggerValidateNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionTriggerValidateOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionTriggerValidateNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -372,11 +372,11 @@ func decodeActionSubmissionTriggerValidateResponse(resp *http.Response) (res *Ac return res, errors.Wrap(defRes, "error") } -func decodeActionSubmissionValidateResponse(resp *http.Response) (res *ActionSubmissionValidateOK, _ error) { +func decodeActionSubmissionValidateResponse(resp *http.Response) (res *ActionSubmissionValidateNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &ActionSubmissionValidateOK{}, nil + case 204: + // Code 204. + return &ActionSubmissionValidateNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -425,8 +425,8 @@ func decodeActionSubmissionValidateResponse(resp *http.Response) (res *ActionSub func decodeCreateScriptResponse(resp *http.Response) (res *ID, _ error) { switch resp.StatusCode { - case 200: - // Code 200. + case 201: + // Code 201. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -508,8 +508,8 @@ func decodeCreateScriptResponse(resp *http.Response) (res *ID, _ error) { func decodeCreateScriptPolicyResponse(resp *http.Response) (res *ID, _ error) { switch resp.StatusCode { - case 200: - // Code 200. + case 201: + // Code 201. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -591,8 +591,8 @@ func decodeCreateScriptPolicyResponse(resp *http.Response) (res *ID, _ error) { func decodeCreateSubmissionResponse(resp *http.Response) (res *ID, _ error) { switch resp.StatusCode { - case 200: - // Code 200. + case 201: + // Code 201. ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) if err != nil { return res, errors.Wrap(err, "parse media type") @@ -672,11 +672,11 @@ func decodeCreateSubmissionResponse(resp *http.Response) (res *ID, _ error) { return res, errors.Wrap(defRes, "error") } -func decodeDeleteScriptResponse(resp *http.Response) (res *DeleteScriptOK, _ error) { +func decodeDeleteScriptResponse(resp *http.Response) (res *DeleteScriptNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &DeleteScriptOK{}, nil + case 204: + // Code 204. + return &DeleteScriptNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -723,11 +723,11 @@ func decodeDeleteScriptResponse(resp *http.Response) (res *DeleteScriptOK, _ err return res, errors.Wrap(defRes, "error") } -func decodeDeleteScriptPolicyResponse(resp *http.Response) (res *DeleteScriptPolicyOK, _ error) { +func decodeDeleteScriptPolicyResponse(resp *http.Response) (res *DeleteScriptPolicyNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &DeleteScriptPolicyOK{}, nil + case 204: + // Code 204. + return &DeleteScriptPolicyNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -1259,11 +1259,11 @@ func decodeListSubmissionsResponse(resp *http.Response) (res []Submission, _ err return res, errors.Wrap(defRes, "error") } -func decodeSetSubmissionCompletedResponse(resp *http.Response) (res *SetSubmissionCompletedOK, _ error) { +func decodeSetSubmissionCompletedResponse(resp *http.Response) (res *SetSubmissionCompletedNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &SetSubmissionCompletedOK{}, nil + case 204: + // Code 204. + return &SetSubmissionCompletedNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -1310,11 +1310,11 @@ func decodeSetSubmissionCompletedResponse(resp *http.Response) (res *SetSubmissi return res, errors.Wrap(defRes, "error") } -func decodeUpdateScriptResponse(resp *http.Response) (res *UpdateScriptOK, _ error) { +func decodeUpdateScriptResponse(resp *http.Response) (res *UpdateScriptNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &UpdateScriptOK{}, nil + case 204: + // Code 204. + return &UpdateScriptNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -1361,11 +1361,11 @@ func decodeUpdateScriptResponse(resp *http.Response) (res *UpdateScriptOK, _ err return res, errors.Wrap(defRes, "error") } -func decodeUpdateScriptPolicyResponse(resp *http.Response) (res *UpdateScriptPolicyOK, _ error) { +func decodeUpdateScriptPolicyResponse(resp *http.Response) (res *UpdateScriptPolicyNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &UpdateScriptPolicyOK{}, nil + case 204: + // Code 204. + return &UpdateScriptPolicyNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { @@ -1412,11 +1412,11 @@ func decodeUpdateScriptPolicyResponse(resp *http.Response) (res *UpdateScriptPol return res, errors.Wrap(defRes, "error") } -func decodeUpdateSubmissionModelResponse(resp *http.Response) (res *UpdateSubmissionModelOK, _ error) { +func decodeUpdateSubmissionModelResponse(resp *http.Response) (res *UpdateSubmissionModelNoContent, _ error) { switch resp.StatusCode { - case 200: - // Code 200. - return &UpdateSubmissionModelOK{}, nil + case 204: + // Code 204. + return &UpdateSubmissionModelNoContent{}, nil } // Convenient error response. defRes, err := func() (res *ErrorStatusCode, err error) { diff --git a/pkg/api/oas_response_encoders_gen.go b/pkg/api/oas_response_encoders_gen.go index 86bf87f..e5b235c 100644 --- a/pkg/api/oas_response_encoders_gen.go +++ b/pkg/api/oas_response_encoders_gen.go @@ -13,66 +13,66 @@ import ( ht "github.com/ogen-go/ogen/http" ) -func encodeActionSubmissionPublishResponse(response *ActionSubmissionPublishOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionPublishResponse(response *ActionSubmissionPublishNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionRejectResponse(response *ActionSubmissionRejectOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionRejectResponse(response *ActionSubmissionRejectNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionRequestChangesResponse(response *ActionSubmissionRequestChangesOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionRequestChangesResponse(response *ActionSubmissionRequestChangesNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionRevokeResponse(response *ActionSubmissionRevokeOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionRevokeResponse(response *ActionSubmissionRevokeNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionSubmitResponse(response *ActionSubmissionSubmitOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionSubmitResponse(response *ActionSubmissionSubmitNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionTriggerPublishResponse(response *ActionSubmissionTriggerPublishOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionTriggerPublishResponse(response *ActionSubmissionTriggerPublishNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionTriggerValidateResponse(response *ActionSubmissionTriggerValidateOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionTriggerValidateResponse(response *ActionSubmissionTriggerValidateNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeActionSubmissionValidateResponse(response *ActionSubmissionValidateOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeActionSubmissionValidateResponse(response *ActionSubmissionValidateNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) 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)) + w.WriteHeader(201) + span.SetStatus(codes.Ok, http.StatusText(201)) e := new(jx.Encoder) response.Encode(e) @@ -85,8 +85,8 @@ func encodeCreateScriptResponse(response *ID, w http.ResponseWriter, span trace. 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)) + w.WriteHeader(201) + span.SetStatus(codes.Ok, http.StatusText(201)) e := new(jx.Encoder) response.Encode(e) @@ -99,8 +99,8 @@ func encodeCreateScriptPolicyResponse(response *ID, w http.ResponseWriter, span func encodeCreateSubmissionResponse(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)) + w.WriteHeader(201) + span.SetStatus(codes.Ok, http.StatusText(201)) e := new(jx.Encoder) response.Encode(e) @@ -111,16 +111,16 @@ 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)) +func encodeDeleteScriptResponse(response *DeleteScriptNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeDeleteScriptPolicyResponse(response *DeleteScriptPolicyOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeDeleteScriptPolicyResponse(response *DeleteScriptPolicyNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } @@ -199,30 +199,30 @@ func encodeListSubmissionsResponse(response []Submission, w http.ResponseWriter, return nil } -func encodeSetSubmissionCompletedResponse(response *SetSubmissionCompletedOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeSetSubmissionCompletedResponse(response *SetSubmissionCompletedNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeUpdateScriptResponse(response *UpdateScriptOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeUpdateScriptResponse(response *UpdateScriptNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeUpdateScriptPolicyResponse(response *UpdateScriptPolicyOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeUpdateScriptPolicyResponse(response *UpdateScriptPolicyNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } -func encodeUpdateSubmissionModelResponse(response *UpdateSubmissionModelOK, w http.ResponseWriter, span trace.Span) error { - w.WriteHeader(200) - span.SetStatus(codes.Ok, http.StatusText(200)) +func encodeUpdateSubmissionModelResponse(response *UpdateSubmissionModelNoContent, w http.ResponseWriter, span trace.Span) error { + w.WriteHeader(204) + span.SetStatus(codes.Ok, http.StatusText(204)) return nil } diff --git a/pkg/api/oas_schemas_gen.go b/pkg/api/oas_schemas_gen.go index 2ba4e30..fb6c9b6 100644 --- a/pkg/api/oas_schemas_gen.go +++ b/pkg/api/oas_schemas_gen.go @@ -10,29 +10,29 @@ func (s *ErrorStatusCode) Error() string { return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response) } -// ActionSubmissionPublishOK is response for ActionSubmissionPublish operation. -type ActionSubmissionPublishOK struct{} +// ActionSubmissionPublishNoContent is response for ActionSubmissionPublish operation. +type ActionSubmissionPublishNoContent struct{} -// ActionSubmissionRejectOK is response for ActionSubmissionReject operation. -type ActionSubmissionRejectOK struct{} +// ActionSubmissionRejectNoContent is response for ActionSubmissionReject operation. +type ActionSubmissionRejectNoContent struct{} -// ActionSubmissionRequestChangesOK is response for ActionSubmissionRequestChanges operation. -type ActionSubmissionRequestChangesOK struct{} +// ActionSubmissionRequestChangesNoContent is response for ActionSubmissionRequestChanges operation. +type ActionSubmissionRequestChangesNoContent struct{} -// ActionSubmissionRevokeOK is response for ActionSubmissionRevoke operation. -type ActionSubmissionRevokeOK struct{} +// ActionSubmissionRevokeNoContent is response for ActionSubmissionRevoke operation. +type ActionSubmissionRevokeNoContent struct{} -// ActionSubmissionSubmitOK is response for ActionSubmissionSubmit operation. -type ActionSubmissionSubmitOK struct{} +// ActionSubmissionSubmitNoContent is response for ActionSubmissionSubmit operation. +type ActionSubmissionSubmitNoContent struct{} -// ActionSubmissionTriggerPublishOK is response for ActionSubmissionTriggerPublish operation. -type ActionSubmissionTriggerPublishOK struct{} +// ActionSubmissionTriggerPublishNoContent is response for ActionSubmissionTriggerPublish operation. +type ActionSubmissionTriggerPublishNoContent struct{} -// ActionSubmissionTriggerValidateOK is response for ActionSubmissionTriggerValidate operation. -type ActionSubmissionTriggerValidateOK struct{} +// ActionSubmissionTriggerValidateNoContent is response for ActionSubmissionTriggerValidate operation. +type ActionSubmissionTriggerValidateNoContent struct{} -// ActionSubmissionValidateOK is response for ActionSubmissionValidate operation. -type ActionSubmissionValidateOK struct{} +// ActionSubmissionValidateNoContent is response for ActionSubmissionValidate operation. +type ActionSubmissionValidateNoContent struct{} type CookieAuth struct { APIKey string @@ -48,11 +48,11 @@ func (s *CookieAuth) SetAPIKey(val string) { s.APIKey = val } -// DeleteScriptOK is response for DeleteScript operation. -type DeleteScriptOK struct{} +// DeleteScriptNoContent is response for DeleteScript operation. +type DeleteScriptNoContent struct{} -// DeleteScriptPolicyOK is response for DeleteScriptPolicy operation. -type DeleteScriptPolicyOK struct{} +// DeleteScriptPolicyNoContent is response for DeleteScriptPolicy operation. +type DeleteScriptPolicyNoContent struct{} // Represents error object. // Ref: #/components/schemas/Error @@ -576,8 +576,8 @@ func (s *ScriptUpdate) SetSubmissionID(val OptInt64) { s.SubmissionID = val } -// SetSubmissionCompletedOK is response for SetSubmissionCompleted operation. -type SetSubmissionCompletedOK struct{} +// SetSubmissionCompletedNoContent is response for SetSubmissionCompleted operation. +type SetSubmissionCompletedNoContent struct{} // Ref: #/components/schemas/Submission type Submission struct { @@ -844,11 +844,11 @@ func (s *SubmissionFilter) SetGameID(val OptInt32) { s.GameID = val } -// UpdateScriptOK is response for UpdateScript operation. -type UpdateScriptOK struct{} +// UpdateScriptNoContent is response for UpdateScript operation. +type UpdateScriptNoContent struct{} -// UpdateScriptPolicyOK is response for UpdateScriptPolicy operation. -type UpdateScriptPolicyOK struct{} +// UpdateScriptPolicyNoContent is response for UpdateScriptPolicy operation. +type UpdateScriptPolicyNoContent struct{} -// UpdateSubmissionModelOK is response for UpdateSubmissionModel operation. -type UpdateSubmissionModelOK struct{} +// UpdateSubmissionModelNoContent is response for UpdateSubmissionModel operation. +type UpdateSubmissionModelNoContent struct{}