change!: renommer HandleV1 à V1GET

BREAKING: renommer `HandleV1` à `V1GET`
This commit is contained in:
Victor Lacasse-Beaudoin 2023-11-20 15:40:52 -05:00
parent 9a8a0abe2e
commit a54fff1192
3 changed files with 12 additions and 12 deletions

View file

@ -19,9 +19,9 @@ type V1Handler struct {
// API Handlers // API Handlers
// HandleV1 affiche les routes accessibles. // V1GET affiche les routes accessibles.
// Les routes sont triées selon .Path, pour les rendre plus facilement navigables. // Les routes sont triées selon .Path, pour les rendre plus facilement navigables.
func (h *V1Handler) HandleV1(c echo.Context) error { func (h *V1Handler) V1GET(c echo.Context) error {
routes := c.Echo().Routes() routes := c.Echo().Routes()
sort.Slice(routes, func(i, j int) bool { return routes[i].Path < routes[j].Path }) sort.Slice(routes, func(i, j int) bool { return routes[i].Path < routes[j].Path })
return c.JSON(http.StatusOK, routes) return c.JSON(http.StatusOK, routes)

View file

@ -69,8 +69,8 @@ func (h *V1Handler) V1DocumentPOST(c echo.Context) error {
return c.JSON(response.StatusCode, response) return c.JSON(response.StatusCode, response)
} }
// HandleV1DocumentRead permet de lire le contenu d'un fichier et protentiellement de le télécharger // V1DocumentGET permet de lire le contenu d'un fichier et protentiellement de le télécharger
func (h *V1Handler) HandleV1DocumentRead(c echo.Context) error { func (h *V1Handler) V1DocumentGET(c echo.Context) error {
bucket := c.Param("bucket") bucket := c.Param("bucket")
document := c.Param("document") document := c.Param("document")
@ -125,13 +125,13 @@ func (h *V1Handler) HandleV1DocumentRead(c echo.Context) error {
return c.Stream(http.StatusOK, document_info.ContentType, document_object) return c.Stream(http.StatusOK, document_info.ContentType, document_object)
} }
// HandleV1DocumentUpdate permet de mettre à jour certains champs d'un object, comme le Content-Type ou le Filename // V1DocumentPUT permet de mettre à jour certains champs d'un object, comme le Content-Type ou le Filename
func (h *V1Handler) HandleV1DocumentUpdate(c echo.Context) error { func (h *V1Handler) V1DocumentPUT(c echo.Context) error {
return c.JSON(apiresponse.NotImplementedResponse()) return c.JSON(apiresponse.NotImplementedResponse())
} }
// HandleV1DocumentDelete permet de supprimer un object // V1DocumentDELETE permet de supprimer un object
func (h *V1Handler) HandleV1DocumentDelete(c echo.Context) error { func (h *V1Handler) V1DocumentDELETE(c echo.Context) error {
bucket := c.Param("bucket") bucket := c.Param("bucket")
document := c.Param("document") document := c.Param("document")

View file

@ -216,7 +216,7 @@ func RunServer() {
Pave: &p, Pave: &p,
} }
groupV1.GET("", v1Handler.HandleV1) groupV1.GET("", v1Handler.V1GET)
if err := pave.EchoRegister[ if err := pave.EchoRegister[
apirequest.V1SeedPOST, apirequest.V1SeedPOST,
@ -236,11 +236,11 @@ func RunServer() {
groupV1.POST("/bucket/:bucket", v1Handler.V1DocumentPOST) groupV1.POST("/bucket/:bucket", v1Handler.V1DocumentPOST)
groupV1.GET("/bucket/:bucket/:document", v1Handler.HandleV1DocumentRead) groupV1.GET("/bucket/:bucket/:document", v1Handler.V1DocumentGET)
groupV1.PUT("/bucket/:bucket/:document", v1Handler.HandleV1DocumentUpdate) groupV1.PUT("/bucket/:bucket/:document", v1Handler.V1DocumentPUT)
groupV1.DELETE("/bucket/:bucket/:document", v1Handler.HandleV1DocumentDelete) groupV1.DELETE("/bucket/:bucket/:document", v1Handler.V1DocumentDELETE)
// HTML Routes // HTML Routes
client := http.DefaultClient client := http.DefaultClient