// Code generated by ogen, DO NOT EDIT.

package api

import (
	"io"
	"net/http"

	"github.com/go-faster/errors"
	"github.com/go-faster/jx"
	"go.opentelemetry.io/otel/codes"
	"go.opentelemetry.io/otel/trace"

	"github.com/ogen-go/ogen/conv"
	"github.com/ogen-go/ogen/uri"
)

func encodeAPIV2BufferGoodsTaskGetResponse(response APIV2BufferGoodsTaskGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseGoodBufferHistories:
		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

	case *APIV2BufferGoodsTaskGetBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2BufferTasksGetResponse(response APIV2BufferTasksGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseTaskBuffer:
		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

	case *APIV2BufferTasksGetBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2HistoryGoodsTaskGetResponse(response APIV2HistoryGoodsTaskGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseGoodHistories:
		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

	case *APIV2HistoryGoodsTaskGetBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2HistoryTasksGetResponse(response APIV2HistoryTasksGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseTaskHistory:
		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

	case *APIV2HistoryTasksGetBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2ListGoodsFilterGetResponse(response APIV2ListGoodsFilterGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseGoodsLists:
		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

	case *ResponseError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2ListGoodsSizeNmGetResponse(response APIV2ListGoodsSizeNmGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseSizeLists:
		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

	case *ResponseError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2QuarantineGoodsGetResponse(response APIV2QuarantineGoodsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseQuarantineGoods:
		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

	case *APIV2QuarantineGoodsGetBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2QuarantineGoodsGetUnprocessableEntity:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(422)
		span.SetStatus(codes.Error, http.StatusText(422))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2UploadTaskClubDiscountPostResponse(response APIV2UploadTaskClubDiscountPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *TaskCreated:
		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

	case *RequestAlreadyExistsError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(208)
		span.SetStatus(codes.Ok, http.StatusText(208))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskClubDiscountPostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskClubDiscountPostUnprocessableEntity:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(422)
		span.SetStatus(codes.Error, http.StatusText(422))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2UploadTaskPostResponse(response APIV2UploadTaskPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *TaskCreated:
		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

	case *RequestAlreadyExistsError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(208)
		span.SetStatus(codes.Ok, http.StatusText(208))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskPostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskPostUnprocessableEntity:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(422)
		span.SetStatus(codes.Error, http.StatusText(422))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV2UploadTaskSizePostResponse(response APIV2UploadTaskSizePostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *TaskCreated:
		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

	case *RequestAlreadyExistsError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(208)
		span.SetStatus(codes.Ok, http.StatusText(208))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskSizePostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV2UploadTaskSizePostUnprocessableEntity:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(422)
		span.SetStatus(codes.Error, http.StatusText(422))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3OfficesGetResponse(response APIV3OfficesGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3OfficesGetOKApplicationJSON:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *Error:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3StocksWarehouseIdDeleteResponse(response APIV3StocksWarehouseIdDeleteRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3StocksWarehouseIdDeleteNoContent:
		w.WriteHeader(204)
		span.SetStatus(codes.Ok, http.StatusText(204))

		return nil

	case *APIV3StocksWarehouseIdDeleteBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdDeleteForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdDeleteNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdDeleteConflict:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(409)
		span.SetStatus(codes.Error, http.StatusText(409))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3StocksWarehouseIdPostResponse(response APIV3StocksWarehouseIdPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3StocksWarehouseIdPostOK:
		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

	case *APIV3StocksWarehouseIdPostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPostForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPostNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3StocksWarehouseIdPutResponse(response APIV3StocksWarehouseIdPutRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3StocksWarehouseIdPutNoContent:
		w.WriteHeader(204)
		span.SetStatus(codes.Ok, http.StatusText(204))

		return nil

	case *StocksWarehouseError:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPutForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPutNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPutNotAcceptableApplicationJSON:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(406)
		span.SetStatus(codes.Error, http.StatusText(406))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3StocksWarehouseIdPutConflict:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(409)
		span.SetStatus(codes.Error, http.StatusText(409))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3WarehousesGetResponse(response APIV3WarehousesGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3WarehousesGetOKApplicationJSON:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *Error:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3WarehousesPostResponse(response APIV3WarehousesPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3WarehousesPostCreated:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(201)
		span.SetStatus(codes.Ok, http.StatusText(201))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesPostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesPostForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesPostNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesPostConflict:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(409)
		span.SetStatus(codes.Error, http.StatusText(409))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3WarehousesWarehouseIdDeleteResponse(response APIV3WarehousesWarehouseIdDeleteRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3WarehousesWarehouseIdDeleteNoContent:
		w.WriteHeader(204)
		span.SetStatus(codes.Ok, http.StatusText(204))

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesWarehouseIdDeleteForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesWarehouseIdDeleteNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeAPIV3WarehousesWarehouseIdPutResponse(response APIV3WarehousesWarehouseIdPutRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *APIV3WarehousesWarehouseIdPutNoContent:
		w.WriteHeader(204)
		span.SetStatus(codes.Ok, http.StatusText(204))

		return nil

	case *APIV3WarehousesWarehouseIdPutBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesWarehouseIdPutForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesWarehouseIdPutNotFound:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(404)
		span.SetStatus(codes.Error, http.StatusText(404))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *APIV3WarehousesWarehouseIdPutConflict:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(409)
		span.SetStatus(codes.Error, http.StatusText(409))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2BarcodesPostResponse(response ContentV2BarcodesPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2BarcodesPostOK:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsDeleteTrashPostResponse(response ContentV2CardsDeleteTrashPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2CardsDeleteTrashPostOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsErrorListGetResponse(response ContentV2CardsErrorListGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2CardsErrorListGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsLimitsGetResponse(response ContentV2CardsLimitsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2CardsLimitsGetOK:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsRecoverPostResponse(response ContentV2CardsRecoverPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2CardsRecoverPostOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsUpdatePostResponse(response ContentV2CardsUpdatePostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseCardCreate:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV2CardsUpdatePostRequestEntityTooLarge:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(413)
		span.SetStatus(codes.Error, http.StatusText(413))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsUploadAddPostResponse(response ContentV2CardsUploadAddPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseCardCreate:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV2CardsUploadAddPostRequestEntityTooLarge:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(413)
		span.SetStatus(codes.Error, http.StatusText(413))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2CardsUploadPostResponse(response ContentV2CardsUploadPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseCardCreate:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV2CardsUploadPostRequestEntityTooLarge:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(413)
		span.SetStatus(codes.Error, http.StatusText(413))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectoryColorsGetResponse(response ContentV2DirectoryColorsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectoryColorsGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectoryCountriesGetResponse(response ContentV2DirectoryCountriesGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectoryCountriesGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectoryKindsGetResponse(response ContentV2DirectoryKindsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectoryKindsGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectorySeasonsGetResponse(response ContentV2DirectorySeasonsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectorySeasonsGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectoryTnvedGetResponse(response ContentV2DirectoryTnvedGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectoryTnvedGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2DirectoryVatGetResponse(response ContentV2DirectoryVatGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2DirectoryVatGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2GetCardsListPostResponse(response ContentV2GetCardsListPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2GetCardsListPostOKHeaders:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Remaining" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Remaining",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRemaining.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Remaining header")
				}
			}
		}
		w.WriteHeader(200)
		span.SetStatus(codes.Ok, http.StatusText(200))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV2GetCardsListPostBadRequestPlainText:
		w.Header().Set("Content-Type", "plain/text")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		writer := w
		if closer, ok := response.Data.(io.Closer); ok {
			defer closer.Close()
		}
		if _, err := io.Copy(writer, response); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2GetCardsTrashPostResponse(response ContentV2GetCardsTrashPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2GetCardsTrashPostOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV2GetCardsTrashPostBadRequestPlainText:
		w.Header().Set("Content-Type", "plain/text")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		writer := w
		if closer, ok := response.Data.(io.Closer); ok {
			defer closer.Close()
		}
		if _, err := io.Copy(writer, response); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2ObjectAllGetResponse(response ContentV2ObjectAllGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2ObjectAllGetOK:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2ObjectCharcsSubjectIdGetResponse(response ContentV2ObjectCharcsSubjectIdGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2ObjectCharcsSubjectIdGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2ObjectParentAllGetResponse(response ContentV2ObjectParentAllGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2ObjectParentAllGetOK:
		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

	case *ResponseBodyContentError400:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2TagNomenclatureLinkPostResponse(response ContentV2TagNomenclatureLinkPostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ResponseContentError6:
		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

	case *ResponseContentError4:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV2TagsGetResponse(response ContentV2TagsGetRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV2TagsGetOK:
		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

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ResponseBodyContentError403:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV3MediaFilePostResponse(response ContentV3MediaFilePostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV3MediaFilePostOK:
		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

	case *ContentV3MediaFilePostApplicationJSONBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV3MediaFilePostBadRequestPlainText:
		w.Header().Set("Content-Type", "plain/text")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		writer := w
		if closer, ok := response.Data.(io.Closer); ok {
			defer closer.Close()
		}
		if _, err := io.Copy(writer, response); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV3MediaFilePostForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}

func encodeContentV3MediaSavePostResponse(response ContentV3MediaSavePostRes, w http.ResponseWriter, span trace.Span) error {
	switch response := response.(type) {
	case *ContentV3MediaSavePostOK:
		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

	case *ContentV3MediaSavePostBadRequest:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(400)
		span.SetStatus(codes.Error, http.StatusText(400))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R401:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(401)
		span.SetStatus(codes.Error, http.StatusText(401))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV3MediaSavePostForbidden:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(403)
		span.SetStatus(codes.Error, http.StatusText(403))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV3MediaSavePostConflict:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(409)
		span.SetStatus(codes.Error, http.StatusText(409))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *ContentV3MediaSavePostUnprocessableEntity:
		w.Header().Set("Content-Type", "application/json; charset=utf-8")
		w.WriteHeader(422)
		span.SetStatus(codes.Error, http.StatusText(422))

		e := new(jx.Encoder)
		response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	case *R429Headers:
		w.Header().Set("Content-Type", "application/problem+json")
		// Encoding response headers.
		{
			h := uri.NewHeaderEncoder(w.Header())
			// Encode "X-Ratelimit-Limit" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Limit",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitLimit.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Limit header")
				}
			}
			// Encode "X-Ratelimit-Reset" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Reset",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitReset.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Reset header")
				}
			}
			// Encode "X-Ratelimit-Retry" header.
			{
				cfg := uri.HeaderParameterEncodingConfig{
					Name:    "X-Ratelimit-Retry",
					Explode: false,
				}
				if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
					if val, ok := response.XRatelimitRetry.Get(); ok {
						return e.EncodeValue(conv.IntToString(val))
					}
					return nil
				}); err != nil {
					return errors.Wrap(err, "encode X-Ratelimit-Retry header")
				}
			}
		}
		w.WriteHeader(429)
		span.SetStatus(codes.Error, http.StatusText(429))

		e := new(jx.Encoder)
		response.Response.Encode(e)
		if _, err := e.WriteTo(w); err != nil {
			return errors.Wrap(err, "write")
		}

		return nil

	default:
		return errors.Errorf("unexpected response type: %T", response)
	}
}
