115 lines
1.8 KiB
Go
115 lines
1.8 KiB
Go
/*
|
|
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.
|
|
*/
|
|
package main
|
|
|
|
import (
|
|
"codeberg.org/vlbeaudoin/voki/v3"
|
|
"git.agecem.com/agecem/agecem-org/models"
|
|
)
|
|
|
|
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
|
|
}
|
|
|
|
type ListBucketsResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets map[string]string
|
|
}
|
|
}
|
|
|
|
type ReadBucketResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Keys []string
|
|
}
|
|
}
|
|
|
|
type DataDocument struct {
|
|
Key string
|
|
Size int64
|
|
}
|
|
|
|
type CreateDocumentsResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Bucket string
|
|
Documents []DataDocument
|
|
}
|
|
}
|
|
|
|
type CreateDocumentResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Bucket string
|
|
DataDocument
|
|
}
|
|
}
|
|
|
|
type DeleteDocumentResponse struct {
|
|
APIResponse
|
|
}
|
|
|
|
type UpdateDocumentKeyResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Bucket string
|
|
Key string
|
|
}
|
|
}
|
|
|
|
type ExecuteSeedResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets []string
|
|
}
|
|
}
|
|
|
|
type ReadSpecResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Spec string
|
|
}
|
|
}
|
|
|
|
// Deprecated: Use ListBucketsResponse instead
|
|
type HandleAdminDocumentsUploadResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets []models.Bucket
|
|
}
|
|
}
|
|
|
|
// Deprecated: Use ListBucketsResponse instead
|
|
type HandleDocumentationResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets []models.Bucket
|
|
}
|
|
}
|
|
|
|
// Deprecated: Use CreateDocumentResponse instead
|
|
type UploadDocumentAPIResponse struct {
|
|
APIResponse
|
|
Data UploadDocumentResponseData
|
|
}
|
|
|
|
// Deprecated: Use DataDocument instead
|
|
type UploadDocumentResponseData struct {
|
|
Bucket string
|
|
Object string
|
|
Size float64
|
|
}
|