2545 lines
61 KiB
Go
2545 lines
61 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 encodeCreateMaResponse(response CreateMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *MaCreate:
|
|
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 encodeCreateSevResponse(response CreateSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *SevCreate:
|
|
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 encodeCreateUeResponse(response CreateUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UeCreate:
|
|
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 encodeDeleteMaResponse(response DeleteMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteMaNoContent:
|
|
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 encodeDeleteSevResponse(response DeleteSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteSevNoContent:
|
|
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 encodeDeleteUeResponse(response DeleteUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *DeleteUeNoContent:
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 encodeListMaResponse(response ListMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
switch response := response.(type) {
|
|
case *ListMaOKApplicationJSON:
|
|
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 encodeListSevResponse(response ListSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
switch response := response.(type) {
|
|
case *ListSevOKApplicationJSON:
|
|
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 encodeListUeResponse(response ListUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListUeOKApplicationJSON:
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 encodeListUserMaResponse(response ListUserMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
switch response := response.(type) {
|
|
case *ListUserMaOKApplicationJSON:
|
|
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 encodeListUserSevResponse(response ListUserSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListUserSevOKApplicationJSON:
|
|
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 encodeListUserUeResponse(response ListUserUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *ListUserUeOKApplicationJSON:
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 encodeReadMaResponse(response ReadMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
switch response := response.(type) {
|
|
case *MaRead:
|
|
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 encodeReadMaOwnerResponse(response ReadMaOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
switch response := response.(type) {
|
|
case *MaOwnerRead:
|
|
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 encodeReadSevResponse(response ReadSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
switch response := response.(type) {
|
|
case *SevRead:
|
|
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 encodeReadSevOwnerResponse(response ReadSevOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
switch response := response.(type) {
|
|
case *SevOwnerRead:
|
|
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 encodeReadUeResponse(response ReadUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UeRead:
|
|
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 encodeReadUeOwnerResponse(response ReadUeOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UeOwnerRead:
|
|
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 {
|
|
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
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 encodeUpdateMaResponse(response UpdateMaRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *MaUpdate:
|
|
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 encodeUpdateSevResponse(response UpdateSevRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *SevUpdate:
|
|
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 encodeUpdateUeResponse(response UpdateUeRes, w http.ResponseWriter, span trace.Span) error {
|
|
switch response := response.(type) {
|
|
case *UeUpdate:
|
|
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)
|
|
}
|
|
}
|