Déplacer api responses vers apiresponse/
This commit is contained in:
parent
cb977f767d
commit
0962ea5a20
5 changed files with 42 additions and 29 deletions
|
@ -1,92 +0,0 @@
|
|||
package models
|
||||
|
||||
import "net/http"
|
||||
|
||||
type Responder interface {
|
||||
Respond() Responder
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
StatusCode int `json:"status_code"`
|
||||
Message string
|
||||
Error string
|
||||
}
|
||||
|
||||
func (r Response) Respond() Responder {
|
||||
return r
|
||||
}
|
||||
|
||||
type SimpleResponse struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
func (r SimpleResponse) Respond() Responder {
|
||||
return r
|
||||
}
|
||||
|
||||
func NotFoundResponse() (int, SimpleResponse) {
|
||||
return http.StatusNotFound, SimpleResponse{
|
||||
Message: "Not Found",
|
||||
}
|
||||
}
|
||||
|
||||
func NotImplementedResponse() (int, SimpleResponse) {
|
||||
return http.StatusNotImplemented, SimpleResponse{
|
||||
Message: "Not Implemented",
|
||||
}
|
||||
}
|
||||
|
||||
type HandleAdminDocumentsUploadResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Buckets []Bucket
|
||||
}
|
||||
}
|
||||
|
||||
type HandleDocumentationResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Buckets []Bucket
|
||||
}
|
||||
}
|
||||
|
||||
type UploadDocumentResponse struct {
|
||||
Response
|
||||
Data UploadDocumentResponseData
|
||||
}
|
||||
|
||||
type UploadDocumentResponseData struct {
|
||||
Bucket string
|
||||
Object string
|
||||
Size float64
|
||||
}
|
||||
|
||||
type V1SeedResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Buckets []string
|
||||
}
|
||||
}
|
||||
|
||||
type V1BucketListResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Buckets map[string]string
|
||||
}
|
||||
}
|
||||
|
||||
type V1BucketReadResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Keys []string
|
||||
}
|
||||
}
|
||||
|
||||
type V1DocumentCreateResponse struct {
|
||||
Response
|
||||
Data struct {
|
||||
Bucket string
|
||||
Key string
|
||||
Size int64
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue