change!: renommer apiresponse.V1BucketList à V1BucketsGET
Fait partie d'une suite de changements pour normaliser noms d'objets BREAKING: renommer `V1BucketList` à `V1BucketsGET`
This commit is contained in:
parent
7bf489315e
commit
8e40050f81
5 changed files with 19 additions and 19 deletions
|
@ -101,7 +101,7 @@ func (a *API) UploadDocument(bucket string, file_header *multipart.FileHeader) (
|
|||
return response, err
|
||||
}
|
||||
|
||||
func (a *API) ListBuckets() (response apiresponse.V1BucketList, err error) {
|
||||
func (a *API) ListBuckets() (response apiresponse.V1BucketsGET, err error) {
|
||||
return response, a.Voki.Unmarshal(http.MethodGet, "/v1/bucket", nil, true, &response)
|
||||
}
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ func (h *V1Handler) HandleV1Seed(c echo.Context) error {
|
|||
return c.JSON(response.StatusCode, response)
|
||||
}
|
||||
|
||||
// HandleV1BucketList affiche les buckets permis par server.documents.buckets, qui existent.
|
||||
func (h *V1Handler) HandleV1BucketList(c echo.Context) error {
|
||||
var response apiresponse.V1BucketList
|
||||
// V1BucketsGET affiche les buckets permis par server.documents.buckets, qui existent.
|
||||
func (h *V1Handler) V1BucketsGET(c echo.Context) error {
|
||||
var response apiresponse.V1BucketsGET
|
||||
|
||||
var buckets = make(map[string]string)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package apiresponse
|
||||
|
||||
type V1BucketList struct {
|
||||
type V1BucketsGET struct {
|
||||
Response
|
||||
Data struct {
|
||||
Buckets map[string]string
|
||||
|
|
|
@ -230,7 +230,7 @@ func RunServer() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
groupV1.GET("/bucket", v1Handler.HandleV1BucketList)
|
||||
groupV1.GET("/bucket", v1Handler.V1BucketsGET)
|
||||
|
||||
groupV1.GET("/bucket/:bucket", v1Handler.HandleV1BucketRead)
|
||||
|
||||
|
|
|
@ -53,18 +53,18 @@ func HandleVieEtudianteOrganisme(c echo.Context) error {
|
|||
func (h *WebHandler) HandleDocumentation(c echo.Context) error {
|
||||
var response webresponse.HandleDocumentationResponse
|
||||
|
||||
v1BucketListResponse, err := h.ApiClient.ListBuckets()
|
||||
v1BucketsGET, err := h.ApiClient.ListBuckets()
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
response.Message = v1BucketListResponse.Message
|
||||
response.StatusCode = v1BucketListResponse.StatusCode
|
||||
response.Message = v1BucketsGET.Message
|
||||
response.StatusCode = v1BucketsGET.StatusCode
|
||||
|
||||
return c.Render(response.StatusCode, "documentation-html", response)
|
||||
}
|
||||
|
||||
//TODO check v1BucketListRespone StatusCode and Error
|
||||
//TODO check v1BucketsGET StatusCode and Error
|
||||
|
||||
for bucket, displayName := range v1BucketListResponse.Data.Buckets {
|
||||
for bucket, displayName := range v1BucketsGET.Data.Buckets {
|
||||
// TODO move call to dedicated API client method
|
||||
var v1BucketReadResponse apiresponse.V1BucketRead
|
||||
|
||||
|
@ -134,16 +134,16 @@ func HandleAdmin(c echo.Context) error {
|
|||
func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error {
|
||||
var response webresponse.HandleAdminDocumentsUploadResponse
|
||||
|
||||
v1BucketListResponse, err := h.ApiClient.ListBuckets()
|
||||
v1BucketsGET, err := h.ApiClient.ListBuckets()
|
||||
if err != nil {
|
||||
response.StatusCode = v1BucketListResponse.StatusCode
|
||||
response.StatusCode = v1BucketsGET.StatusCode
|
||||
response.Error = err.Error()
|
||||
response.Message = v1BucketListResponse.Message
|
||||
response.Message = v1BucketsGET.Message
|
||||
|
||||
return c.Render(response.StatusCode, "admin-upload-html", nil)
|
||||
}
|
||||
|
||||
for bucketName, displayName := range v1BucketListResponse.Data.Buckets {
|
||||
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
||||
response.Data.Buckets = append(response.Data.Buckets, models.Bucket{
|
||||
Name: bucketName,
|
||||
DisplayName: displayName,
|
||||
|
@ -157,16 +157,16 @@ func (h *WebHandler) HandleAdminDocumentsUpload(c echo.Context) error {
|
|||
func (h *WebHandler) HandleAdminDocumentsUploadPOST(c echo.Context) error {
|
||||
var response webresponse.HandleAdminDocumentsUploadResponse
|
||||
|
||||
v1BucketListResponse, err := h.ApiClient.ListBuckets()
|
||||
v1BucketsGET, err := h.ApiClient.ListBuckets()
|
||||
if err != nil {
|
||||
response.StatusCode = v1BucketListResponse.StatusCode
|
||||
response.Message = v1BucketListResponse.Message
|
||||
response.StatusCode = v1BucketsGET.StatusCode
|
||||
response.Message = v1BucketsGET.Message
|
||||
response.Error = err.Error()
|
||||
|
||||
return c.Render(response.StatusCode, "admin-upload-html", response)
|
||||
}
|
||||
|
||||
for bucketName, displayName := range v1BucketListResponse.Data.Buckets {
|
||||
for bucketName, displayName := range v1BucketsGET.Data.Buckets {
|
||||
response.Data.Buckets = append(response.Data.Buckets, models.Bucket{
|
||||
Name: bucketName,
|
||||
DisplayName: displayName,
|
||||
|
|
Loading…
Reference in a new issue