Documentation
¶
Index ¶
- func DecodeFromBase64(ctx context.Context, r *http.Request) (interface{}, error)
- func DecodeResponse(_ context.Context, r *http.Response) (interface{}, error)
- func DecodeString(ctx context.Context, r *http.Request) (interface{}, error)
- func EncodeError(c context.Context, err error, w http.ResponseWriter)
- func EncodeErrorRequest(_ context.Context, r *http.Request, request interface{}) error
- func EncodeJsonRequest(_ context.Context, r *http.Request, request interface{}) error
- func EncodeRequest(_ context.Context, r *http.Request, request interface{}) error
- func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error
- func EncodeToBase64(_ context.Context, r *http.Request, request interface{}) error
- func GetChatId(ctx context.Context) uint32
- func GetJWTKeys() jwt.Keyfunc
- func GetServerOpts(logger kitlog.Logger, service machineLearning.Service) []kithttp.ServerOption
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeFromBase64 ¶
func DecodeResponse ¶
DecodeResponse will check the response for an error, and if there is, it will set the body to the error message
func DecodeString ¶
DecodeString will return the the body of the http request as a string
func EncodeError ¶
func EncodeError(c context.Context, err error, w http.ResponseWriter)
EncodeError response back to the client
func EncodeErrorRequest ¶
EncodeErrorRequest will extract the string message from the request error and add it to the body
func EncodeJsonRequest ¶
EncodeJsonRequest will attempt to conver the input request
func EncodeRequest ¶
EncodeRequest converts the input request into a json string and adds it to the request body
func EncodeResponse ¶
func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error
EncodeResponse Convert the response into the response body
func EncodeToBase64 ¶
EncodeToBase64 takes the byte array request and converts it to base64 before adding it to the request body
func GetJWTKeys ¶
func GetJWTKeys() jwt.Keyfunc
func GetServerOpts ¶
func GetServerOpts(logger kitlog.Logger, service machineLearning.Service) []kithttp.ServerOption
GetServerOpts creates a default server option with an error logger, error encoder and a http request logger.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { // error message // // required: true Error string `json:"error"` }
User represents a generic error
swagger:model errorResponse