Repository navigation
Expand file tree
/
Copy pathuploads.go
More file actions
36 lines (29 loc) · 1.59 KB
/
Copy pathuploads.go
File metadata and controls
36 lines (29 loc) · 1.59 KB
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
34
35
36
package api
import "time"
type AddUploadsRequest struct {
Uploads []Upload `json:"uploads"` // 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 {
ArtifactHref *string `json:"artifact_href,omitempty"` // Artifact href if one exists (on create only)
CompletedChecksums []string `json:"completed_checksums,omitempty"` // A list of already completed checksums
UploadUuid *string `json:"upload_uuid"` // Upload UUID
Created *time.Time `json:"created,omitempty"` // Timestamp of creation
LastUpdated *time.Time `json:"last_updated,omitempty"` // 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
}