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
}

2
go.mod
View file

@ -3,7 +3,7 @@ module git.agecem.com/agecem/bottin-ag
go 1.21.0
require (
codeberg.org/vlbeaudoin/voki v1.1.2
codeberg.org/vlbeaudoin/voki v1.2.0
git.agecem.com/agecem/bottin/v5 v5.3.0
github.com/jmoiron/sqlx v1.3.5
github.com/labstack/echo/v4 v4.11.1

4
go.sum
View file

@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
codeberg.org/vlbeaudoin/voki v1.1.2 h1:31xCFeJEGxEpe/o3q+l1np8DUbaWq+TVUf+JVyuUxEc=
codeberg.org/vlbeaudoin/voki v1.1.2/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI=
codeberg.org/vlbeaudoin/voki v1.2.0 h1:MpbZtKvSpkjnduSlNBVikn8OHQFwH9bEBBhUW9LQW34=
codeberg.org/vlbeaudoin/voki v1.2.0/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o=
git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw=

View file

@ -1,11 +1,11 @@
package webresponse
import "git.agecem.com/agecem/bottin-ag/apiresponse"
import "codeberg.org/vlbeaudoin/voki/response"
type IndexGET struct {
apiresponse.Response
response.ResponseWithError
}
type ScanPOST struct {
apiresponse.Response
response.ResponseWithError
}