Create a basic addItem

This commit is contained in:
2023-09-17 16:27:40 +02:00
parent f53e4f82f4
commit 3f1b4a9a5b
6 changed files with 148 additions and 30 deletions
+15
View File
@@ -0,0 +1,15 @@
package models
type ItemType string
const (
Torrent ItemType = "torrent"
Magnet ItemType = "magnet"
Direct ItemType = "direct"
)
type NewItem struct {
Uri string
Type *ItemType
Path *string
}
+44 -17
View File
@@ -1,30 +1,57 @@
package models
import "time";
import "time"
type State string
const (
Stale State = "stale"
Stale State = "stale"
Downloading State = "downloading"
Seeding State = "seeding"
Finished State = "finished"
Seeding State = "seeding"
Finished State = "finished"
Paused State = "paused"
Errored State = "errored"
)
type Priority string
const (
None Priority = "none"
Low Priority = "low"
Medium Priority = "medium"
High Priority = "high"
)
type File struct {
Name string
Priority int
Size uint64
AvailableSize uint64
Path string
Index uint `json:"index"`
Name string `json:"name"`
Priority Priority `json:"priority"`
Size uint64 `json:"size"`
AvailableSize uint64 `json:"availableSize"`
Path string `json:"path"`
}
type Item struct {
Id string
Name string
State State
Size uint64
AvailableSize uint64
Path string
AddedDate time.Time
Files []File
Id string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
AddedDate time.Time `json:"addedDate"`
Files []File `json:"files"`
State State `json:"state"`
Size uint64 `json:"size"`
AvailableSize uint64 `json:"availableSize"`
UploadedSize uint64 `json:"uploadedSize"`
// Hexadecimal representation of the download progress.
// The highest bit corresponds to the piece at index 0. Any set bits indicate loaded pieces,
// while unset bits indicate not yet loaded and/or missing pieces.
// Any overflow bits at the end are set to zero.
// When the download was not started yet, this will be an empty string.
BitField string `json:"bitfield"`
DownloadSpeed uint `json:"downloadSpeed"`
UploadSpeed uint `json:"uploadSpeed"`
SeedCount uint `json:"seedCount"`
Connections uint `json:"connections"`
ErrorMessage *string `json:"errorMessage"`
}