-
Notifications
You must be signed in to change notification settings - Fork 27
/
uploads.go
33 lines (27 loc) · 1.32 KB
/
uploads.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package api
import "time"
type AddUploadsRequest struct {
Uploads []Upload `json:"uploads" validate:"required"` // List of unfinished uploads
Artifacts []Artifact `json:"artifacts"` // List of created artifacts
}
type Upload struct {
Uuid string `json:"uuid"` // Upload UUID, use with public API
Href string `json:"href"` // HREF to the unfinished upload, use with internal API
Sha256 string `json:"sha256"` // SHA256 sum of the uploaded file
}
type Artifact struct {
Href string // HREF to the completed artifact
Sha256 string // SHA256 sum of the completed artifact
}
type UploadChunkRequest struct {
UploadUuid string `param:"upload_uuid" validate:"required"` // Upload UUID
File string `form:"file" validate:"required"` // A chunk of the uploaded file
Sha256 string `form:"sha256" validate:"required"` // SHA-256 checksum of the chunk
}
type UploadResponse struct {
UploadUuid *string `json:"upload_uuid"` // Upload UUID
Created *time.Time `json:"created"` // Timestamp of creation
LastUpdated *time.Time `json:"last_updated"` // Timestamp of last update
Size int64 `json:"size"` // Size of the upload in bytes
Completed *time.Time `json:"completed,omitempty"` // Timestamp when upload is committed
}