2024-11-26 01:22:45 +00:00
|
|
|
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2024-12-10 06:06:33 +00:00
|
|
|
"fmt"
|
2024-11-26 01:22:45 +00:00
|
|
|
"io"
|
|
|
|
"mime"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/go-faster/errors"
|
|
|
|
"github.com/go-faster/jx"
|
|
|
|
|
|
|
|
"github.com/ogen-go/ogen/ogenerrors"
|
|
|
|
"github.com/ogen-go/ogen/validate"
|
|
|
|
)
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionPublishResponse(resp *http.Response) (res *ActionSubmissionPublishNoContent, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionPublishNoContent{}, nil
|
2024-11-28 01:46:54 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
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)
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
var response Error
|
2024-11-26 01:22:45 +00:00
|
|
|
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
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
return &ErrorStatusCode{
|
|
|
|
StatusCode: resp.StatusCode,
|
|
|
|
Response: response,
|
|
|
|
}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
default:
|
|
|
|
return res, validate.InvalidContentType(ct)
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
}()
|
|
|
|
if err != nil {
|
|
|
|
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
|
|
}
|
|
|
|
return res, errors.Wrap(defRes, "error")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionRejectResponse(resp *http.Response) (res *ActionSubmissionRejectNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionRejectNoContent{}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionRequestChangesResponse(resp *http.Response) (res *ActionSubmissionRequestChangesNoContent, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionRequestChangesNoContent{}, nil
|
2024-11-28 01:46:54 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
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)
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
var response Error
|
2024-11-26 01:22:45 +00:00
|
|
|
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
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
return &ErrorStatusCode{
|
|
|
|
StatusCode: resp.StatusCode,
|
|
|
|
Response: response,
|
|
|
|
}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
default:
|
|
|
|
return res, validate.InvalidContentType(ct)
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
}()
|
|
|
|
if err != nil {
|
|
|
|
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
|
|
}
|
|
|
|
return res, errors.Wrap(defRes, "error")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionRevokeResponse(resp *http.Response) (res *ActionSubmissionRevokeNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionRevokeNoContent{}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionSubmitResponse(resp *http.Response) (res *ActionSubmissionSubmitNoContent, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionSubmitNoContent{}, nil
|
2024-11-28 01:46:54 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
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)
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
var response Error
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-28 01:46:54 +00:00
|
|
|
if err := response.Decode(d); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
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
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionTriggerPublishResponse(resp *http.Response) (res *ActionSubmissionTriggerPublishNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionTriggerPublishNoContent{}, nil
|
2024-11-28 01:46:54 +00:00
|
|
|
}
|
|
|
|
// 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
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-28 01:46:54 +00:00
|
|
|
if err := response.Decode(d); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := d.Skip(); err != io.EOF {
|
|
|
|
return errors.New("unexpected trailing data")
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
2024-11-28 01:46:54 +00:00
|
|
|
err = &ogenerrors.DecodeBodyError{
|
|
|
|
ContentType: ct,
|
|
|
|
Body: buf,
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
return res, err
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
return &ErrorStatusCode{
|
|
|
|
StatusCode: resp.StatusCode,
|
|
|
|
Response: response,
|
|
|
|
}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
default:
|
|
|
|
return res, validate.InvalidContentType(ct)
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
}()
|
|
|
|
if err != nil {
|
|
|
|
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
|
|
}
|
|
|
|
return res, errors.Wrap(defRes, "error")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionTriggerValidateResponse(resp *http.Response) (res *ActionSubmissionTriggerValidateNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionTriggerValidateNoContent{}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeActionSubmissionValidateResponse(resp *http.Response) (res *ActionSubmissionValidateNoContent, _ error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &ActionSubmissionValidateNoContent{}, nil
|
2024-11-26 20:39:10 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
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)
|
|
|
|
|
2024-11-26 20:39:10 +00:00
|
|
|
var response Error
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
if err := response.Decode(d); err != nil {
|
2024-11-26 01:22:45 +00:00
|
|
|
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
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-12-06 00:36:15 +00:00
|
|
|
func decodeCreateScriptResponse(resp *http.Response) (res *ID, _ error) {
|
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 201:
|
|
|
|
// Code 201.
|
2024-12-06 00:36:15 +00:00
|
|
|
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 {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 201:
|
|
|
|
// Code 201.
|
2024-12-06 00:36:15 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
func decodeCreateSubmissionResponse(resp *http.Response) (res *ID, _ error) {
|
2024-11-26 20:39:10 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 201:
|
|
|
|
// Code 201.
|
2024-11-28 01:46:54 +00:00
|
|
|
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)
|
|
|
|
|
2024-12-06 00:36:15 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeDeleteScriptResponse(resp *http.Response) (res *DeleteScriptNoContent, _ error) {
|
2024-12-06 00:36:15 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &DeleteScriptNoContent{}, nil
|
2024-12-06 00:36:15 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeDeleteScriptPolicyResponse(resp *http.Response) (res *DeleteScriptPolicyNoContent, _ error) {
|
2024-12-06 00:36:15 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &DeleteScriptPolicyNoContent{}, nil
|
2024-12-06 00:36:15 +00:00
|
|
|
}
|
|
|
|
// 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
|
|
|
|
}
|
2024-12-10 06:06:33 +00:00
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if err := response.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
2024-12-06 00:36:15 +00:00
|
|
|
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
|
|
|
|
}
|
2024-12-10 06:06:33 +00:00
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if err := response.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
2024-12-06 00:36:15 +00:00
|
|
|
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
|
2024-11-28 01:46:54 +00:00
|
|
|
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
|
|
|
|
}
|
2024-12-10 06:06:33 +00:00
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if err := response.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
return &response, nil
|
|
|
|
default:
|
|
|
|
return res, validate.InvalidContentType(ct)
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
}
|
|
|
|
// 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
|
2024-11-26 01:22:45 +00:00
|
|
|
if err := func() error {
|
2024-11-26 20:39:10 +00:00
|
|
|
if err := response.Decode(d); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := d.Skip(); err != io.EOF {
|
|
|
|
return errors.New("unexpected trailing data")
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
2024-11-26 20:39:10 +00:00
|
|
|
err = &ogenerrors.DecodeBodyError{
|
|
|
|
ContentType: ct,
|
|
|
|
Body: buf,
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
return res, err
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
return &ErrorStatusCode{
|
|
|
|
StatusCode: resp.StatusCode,
|
|
|
|
Response: response,
|
|
|
|
}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
default:
|
|
|
|
return res, validate.InvalidContentType(ct)
|
|
|
|
}
|
2024-11-26 20:39:10 +00:00
|
|
|
}()
|
|
|
|
if err != nil {
|
|
|
|
return res, errors.Wrapf(err, "default (code %d)", resp.StatusCode)
|
|
|
|
}
|
|
|
|
return res, errors.Wrap(defRes, "error")
|
|
|
|
}
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
func decodeGetSubmissionResponse(resp *http.Response) (res *Submission, _ error) {
|
2024-11-26 20:39:10 +00:00
|
|
|
switch resp.StatusCode {
|
|
|
|
case 200:
|
|
|
|
// Code 200.
|
2024-11-28 01:46:54 +00:00
|
|
|
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 Submission
|
|
|
|
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
|
|
|
|
}
|
2024-12-10 06:06:33 +00:00
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if err := response.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
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)
|
|
|
|
|
2024-12-14 06:15:05 +00:00
|
|
|
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 decodeListScriptPolicyResponse(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 {
|
|
|
|
response = make([]ScriptPolicy, 0)
|
|
|
|
if err := d.Arr(func(d *jx.Decoder) error {
|
|
|
|
var elem ScriptPolicy
|
|
|
|
if err := elem.Decode(d); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
response = append(response, elem)
|
|
|
|
return nil
|
|
|
|
}); 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
|
|
|
|
}
|
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if response == nil {
|
|
|
|
return errors.New("nil is invalid value")
|
|
|
|
}
|
|
|
|
var failures []validate.FieldError
|
|
|
|
for i, elem := range response {
|
|
|
|
if err := func() error {
|
|
|
|
if err := elem.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
failures = append(failures, validate.FieldError{
|
|
|
|
Name: fmt.Sprintf("[%d]", i),
|
|
|
|
Error: err,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(failures) > 0 {
|
|
|
|
return &validate.Error{Fields: failures}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
|
2024-11-28 01:46:54 +00:00
|
|
|
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 decodeListSubmissionsResponse(resp *http.Response) (res []Submission, _ 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 []Submission
|
|
|
|
if err := func() error {
|
|
|
|
response = make([]Submission, 0)
|
|
|
|
if err := d.Arr(func(d *jx.Decoder) error {
|
|
|
|
var elem Submission
|
|
|
|
if err := elem.Decode(d); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
response = append(response, elem)
|
|
|
|
return nil
|
|
|
|
}); 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
|
|
|
|
}
|
|
|
|
// Validate response.
|
|
|
|
if err := func() error {
|
|
|
|
if response == nil {
|
|
|
|
return errors.New("nil is invalid value")
|
|
|
|
}
|
2024-12-10 06:06:33 +00:00
|
|
|
var failures []validate.FieldError
|
|
|
|
for i, elem := range response {
|
|
|
|
if err := func() error {
|
|
|
|
if err := elem.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
failures = append(failures, validate.FieldError{
|
|
|
|
Name: fmt.Sprintf("[%d]", i),
|
|
|
|
Error: err,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(failures) > 0 {
|
|
|
|
return &validate.Error{Fields: failures}
|
|
|
|
}
|
2024-11-28 01:46:54 +00:00
|
|
|
return nil
|
|
|
|
}(); err != nil {
|
|
|
|
return res, errors.Wrap(err, "validate")
|
|
|
|
}
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeSetSubmissionCompletedResponse(resp *http.Response) (res *SetSubmissionCompletedNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &SetSubmissionCompletedNoContent{}, nil
|
2024-11-28 01:46:54 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeUpdateScriptResponse(resp *http.Response) (res *UpdateScriptNoContent, _ error) {
|
2024-11-28 01:46:54 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &UpdateScriptNoContent{}, nil
|
2024-11-26 01:22:45 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-12-06 00:36:15 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeUpdateScriptPolicyResponse(resp *http.Response) (res *UpdateScriptPolicyNoContent, _ error) {
|
2024-12-06 00:36:15 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &UpdateScriptPolicyNoContent{}, nil
|
2024-12-06 00:36:15 +00:00
|
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2024-12-11 06:23:08 +00:00
|
|
|
func decodeUpdateSubmissionModelResponse(resp *http.Response) (res *UpdateSubmissionModelNoContent, _ error) {
|
2024-12-06 00:36:15 +00:00
|
|
|
switch resp.StatusCode {
|
2024-12-11 06:23:08 +00:00
|
|
|
case 204:
|
|
|
|
// Code 204.
|
|
|
|
return &UpdateSubmissionModelNoContent{}, nil
|
2024-12-06 00:36:15 +00:00
|
|
|
}
|
|
|
|
// Convenient error response.
|
|
|
|
defRes, err := func() (res *ErrorStatusCode, err error) {
|
2024-11-26 01:22:45 +00:00
|
|
|
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")
|
|
|
|
}
|