2024-08-22 12:44:50 -04:00
|
|
|
/*
|
|
|
|
File response.go contains the JSON and HTML response types for HTTP endpoints.
|
|
|
|
|
|
|
|
Le fichier response.go contient les types de réponses JSON et HTML pour les endpoints HTTP.
|
|
|
|
*/
|
2024-08-22 12:07:40 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"codeberg.org/vlbeaudoin/voki/v3"
|
|
|
|
)
|
|
|
|
|
|
|
|
type APIResponse struct {
|
|
|
|
voki.MessageResponse
|
|
|
|
statusCode int
|
|
|
|
Error string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (R APIResponse) StatusCode() int {
|
|
|
|
return R.statusCode
|
|
|
|
}
|
|
|
|
|
|
|
|
func (R *APIResponse) SetStatusCode(code int) {
|
|
|
|
R.statusCode = code
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type ListBucketsResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Buckets map[string]string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type ReadBucketResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Keys []string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type DataDocument struct {
|
|
|
|
Key string
|
|
|
|
Size int64
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type CreateDocumentsResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Bucket string
|
|
|
|
Documents []DataDocument
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type CreateDocumentResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Bucket string
|
|
|
|
DataDocument
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type DeleteDocumentResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type UpdateDocumentKeyResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Bucket string
|
|
|
|
Key string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type ExecuteSeedResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Buckets []string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-22 12:26:32 -04:00
|
|
|
type ReadSpecResponse struct {
|
2024-08-22 12:07:40 -04:00
|
|
|
APIResponse
|
|
|
|
Data struct {
|
|
|
|
Spec string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type HandleAdminDocumentsUploadResponse struct {
|
|
|
|
APIResponse
|
|
|
|
Data struct {
|
2024-08-22 13:24:20 -04:00
|
|
|
Buckets []Bucket
|
2024-08-22 12:07:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type HandleDocumentationResponse struct {
|
|
|
|
APIResponse
|
|
|
|
Data struct {
|
2024-08-22 13:24:20 -04:00
|
|
|
Buckets []Bucket
|
2024-08-22 12:07:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type UploadDocumentAPIResponse struct {
|
|
|
|
APIResponse
|
|
|
|
Data UploadDocumentResponseData
|
|
|
|
}
|
|
|
|
|
|
|
|
type UploadDocumentResponseData struct {
|
|
|
|
Bucket string
|
|
|
|
Object string
|
|
|
|
Size float64
|
|
|
|
}
|