Victor Lacasse-Beaudoin
b3f4547582
Response types ne sont pas équivalents et ont besoin de plus de travail avant d'être changés. Undeprecated pour l'instant.
110 lines
1.6 KiB
Go
110 lines
1.6 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"
|
|
)
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
type HandleAdminDocumentsUploadResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets []Bucket
|
|
}
|
|
}
|
|
|
|
type HandleDocumentationResponse struct {
|
|
APIResponse
|
|
Data struct {
|
|
Buckets []Bucket
|
|
}
|
|
}
|
|
|
|
type UploadDocumentAPIResponse struct {
|
|
APIResponse
|
|
Data UploadDocumentResponseData
|
|
}
|
|
|
|
type UploadDocumentResponseData struct {
|
|
Bucket string
|
|
Object string
|
|
Size float64
|
|
}
|