Déplacer déclarations de route à pave pour API spec autogénérée #176
4 changed files with 5 additions and 5 deletions
|
@ -37,8 +37,8 @@ func (h *V1Handler) V1BucketsGET(c echo.Context) error {
|
||||||
return c.JSON(response.StatusCode, response)
|
return c.JSON(response.StatusCode, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *V1Handler) HandleV1BucketRead(c echo.Context) error {
|
func (h *V1Handler) V1BucketGET(c echo.Context) error {
|
||||||
var response apiresponse.V1BucketRead
|
var response apiresponse.V1BucketGET
|
||||||
|
|
||||||
bucket := c.Param("bucket")
|
bucket := c.Param("bucket")
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ type V1BucketsGET struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type V1BucketRead struct {
|
type V1BucketGET struct {
|
||||||
Response
|
Response
|
||||||
Data struct {
|
Data struct {
|
||||||
Keys []string
|
Keys []string
|
||||||
|
|
|
@ -232,7 +232,7 @@ func RunServer() {
|
||||||
|
|
||||||
groupV1.GET("/bucket", v1Handler.V1BucketsGET)
|
groupV1.GET("/bucket", v1Handler.V1BucketsGET)
|
||||||
|
|
||||||
groupV1.GET("/bucket/:bucket", v1Handler.HandleV1BucketRead)
|
groupV1.GET("/bucket/:bucket", v1Handler.V1BucketGET)
|
||||||
|
|
||||||
groupV1.POST("/bucket/:bucket", v1Handler.HandleV1DocumentCreate)
|
groupV1.POST("/bucket/:bucket", v1Handler.HandleV1DocumentCreate)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (h *WebHandler) HandleDocumentation(c echo.Context) error {
|
||||||
|
|
||||||
for bucket, displayName := range v1BucketsGET.Data.Buckets {
|
for bucket, displayName := range v1BucketsGET.Data.Buckets {
|
||||||
// TODO move call to dedicated API client method
|
// TODO move call to dedicated API client method
|
||||||
var v1BucketReadResponse apiresponse.V1BucketRead
|
var v1BucketReadResponse apiresponse.V1BucketGET
|
||||||
|
|
||||||
if err = h.ApiClient.Voki.Unmarshal(http.MethodGet, fmt.Sprintf("/v1/bucket/%s", bucket), nil, true, &v1BucketReadResponse); err != nil {
|
if err = h.ApiClient.Voki.Unmarshal(http.MethodGet, fmt.Sprintf("/v1/bucket/%s", bucket), nil, true, &v1BucketReadResponse); err != nil {
|
||||||
response.Error = err.Error()
|
response.Error = err.Error()
|
||||||
|
|
Loading…
Reference in a new issue