// Code generated by ogen, DO NOT EDIT. package api import ( "net/http" "github.com/go-faster/errors" "github.com/go-faster/jx" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" 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)) return nil } func encodeActionSubmissionRejectResponse(response *ActionSubmissionRejectOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionRequestChangesResponse(response *ActionSubmissionRequestChangesOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionRevokeResponse(response *ActionSubmissionRevokeOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionSubmitResponse(response *ActionSubmissionSubmitOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionTriggerPublishResponse(response *ActionSubmissionTriggerPublishOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionTriggerValidateResponse(response *ActionSubmissionTriggerValidateOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodeActionSubmissionValidateResponse(response *ActionSubmissionValidateOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) 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) 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 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) 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 encodeListSubmissionsResponse(response []Submission, 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) e.ArrStart() for _, elem := range response { elem.Encode(e) } e.ArrEnd() if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } return nil } func encodePatchSubmissionCompletedResponse(response *PatchSubmissionCompletedOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) return nil } func encodePatchSubmissionModelResponse(response *PatchSubmissionModelOK, w http.ResponseWriter, span trace.Span) error { w.WriteHeader(200) span.SetStatus(codes.Ok, http.StatusText(200)) 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 if code == 0 { // Set default status code. code = http.StatusOK } w.WriteHeader(code) if st := http.StatusText(code); code >= http.StatusBadRequest { span.SetStatus(codes.Error, st) } else { span.SetStatus(codes.Ok, st) } e := new(jx.Encoder) response.Response.Encode(e) if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } if code >= http.StatusInternalServerError { return errors.Wrapf(ht.ErrInternalServerErrorResponse, "code: %d, message: %s", code, http.StatusText(code)) } return nil }