Migrer redéfinitions de Response à voki

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-18 18:44:20 -04:00
parent 78ea51e2c5
commit 3052a989b0
4 changed files with 10 additions and 23 deletions

View file

@ -1,24 +1,11 @@
// Package apiresponse provides response types for API routes
package apiresponse
// Response defines the basic response types fields
type Response struct {
Error string
Message string
StatusCode int
}
type Responder interface {
Respond() Responder
}
func (r Response) Respond() Responder {
return r
}
import "codeberg.org/vlbeaudoin/voki/response"
// HealthGET is the response type for `GET /v:version/health/ http/1.1`
type HealthGET struct {
Response
response.ResponseWithError
Data struct {
BottinStatus string
}
@ -26,7 +13,7 @@ type HealthGET struct {
// ScanGET is the response type for `GET /v:version/scan/ http/1.1`
type ScanGET struct {
Response
response.ResponseWithError
Data struct {
IsScanned bool
}
@ -34,5 +21,5 @@ type ScanGET struct {
// ScanPOST is the response type for `POST /v:version/scan/ http/1.1`
type ScanPOST struct {
Response
response.ResponseWithError
}