Victor Lacasse-Beaudoin
7bf489315e
Exposes the API spec in pave format, which intends to show information about all API routes. Also pave V1SeedPOST and V1SpecGET
37 lines
677 B
Go
37 lines
677 B
Go
package apiresponse
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"codeberg.org/vlbeaudoin/voki/response"
|
|
)
|
|
|
|
type Response struct {
|
|
response.ResponseWithError
|
|
}
|
|
|
|
type SimpleResponse struct {
|
|
Message string
|
|
}
|
|
|
|
func (r SimpleResponse) Respond() response.Responder {
|
|
return r
|
|
}
|
|
|
|
func NotFoundResponse() (int, SimpleResponse) {
|
|
return http.StatusNotFound, SimpleResponse{
|
|
Message: "Not Found",
|
|
}
|
|
}
|
|
|
|
func NotImplementedResponse() (int, SimpleResponse) {
|
|
return http.StatusNotImplemented, SimpleResponse{
|
|
Message: "Not Implemented",
|
|
}
|
|
}
|
|
|
|
func InternalServerErrorResponse() (int, SimpleResponse) {
|
|
return http.StatusInternalServerError, SimpleResponse{
|
|
Message: "Internal Server Error",
|
|
}
|
|
}
|