1179 lines
28 KiB
Go
1179 lines
28 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package ogent
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-faster/errors"
|
|
"github.com/go-faster/jx"
|
|
"go.opentelemetry.io/otel/codes"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
func encodeCreateCardResponse(response CreateCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *CardCreate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeCreateGroupResponse(response CreateGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *GroupCreate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeCreateUserResponse(response CreateUserRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UserCreate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeDeleteCardResponse(response DeleteCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteCardNoContent:
|
|
w.WriteHeader(204)
|
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeDeleteGroupResponse(response DeleteGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteGroupNoContent:
|
|
w.WriteHeader(204)
|
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeDeleteUserResponse(response DeleteUserRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteUserNoContent:
|
|
w.WriteHeader(204)
|
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeDrawDoneResponse(response *DrawDoneNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
w.WriteHeader(204)
|
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
|
|
return nil
|
|
}
|
|
|
|
func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter, span trace.Span) error {
|
|
w.WriteHeader(204)
|
|
span.SetStatus(codes.Ok, http.StatusText(204))
|
|
|
|
return nil
|
|
}
|
|
|
|
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListCardOKApplicationJSON:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeListGroupResponse(response ListGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListGroupOKApplicationJSON:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListGroupUsersOKApplicationJSON:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListUserOKApplicationJSON:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListUserCardOKApplicationJSON:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *CardRead:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *CardOwnerRead:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *GroupRead:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UserRead:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeUpdateCardResponse(response UpdateCardRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *CardUpdate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeUpdateGroupResponse(response UpdateGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *GroupUpdate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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 encodeUpdateUserResponse(response UpdateUserRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UserUpdate:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(200)
|
|
span.SetStatus(codes.Ok, http.StatusText(200))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R400:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(400)
|
|
span.SetStatus(codes.Error, http.StatusText(400))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R404:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(404)
|
|
span.SetStatus(codes.Error, http.StatusText(404))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R409:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(409)
|
|
span.SetStatus(codes.Error, http.StatusText(409))
|
|
|
|
e := jx.GetEncoder()
|
|
response.Encode(e)
|
|
if _, err := e.WriteTo(w); err != nil {
|
|
return errors.Wrap(err, "write")
|
|
}
|
|
return nil
|
|
|
|
case *R500:
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(500)
|
|
span.SetStatus(codes.Error, http.StatusText(500))
|
|
|
|
e := jx.GetEncoder()
|
|
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)
|
|
}
|
|
}
|