feat: support RESTful api (#33)

This commit is contained in:
monkeyWie authored and GitHub committed 2022-09-09 18:31:57 +08:00
1 parent e292926697
commit c6aa83194f
22 files changed
+603 -125

No files matched your search

+11 -8
View File
@@ -6,15 +6,17 @@ import (
"github.com/monkeyWie/gopeed-core/pkg/base"
"github.com/monkeyWie/gopeed-core/pkg/util"
"sync"
"time"
)
type Task struct {
ID string
Res *base.Resource
Opts *base.Options
Status base.Status
Files map[string]*base.FileInfo
Progress *Progress
ID string `json:"id"`
Res *base.Resource `json:"res"`
Opts *base.Options `json:"opts"`
Status base.Status `json:"status"`
Files map[string]*base.FileInfo `json:"files"`
Progress *Progress `json:"progress"`
CreateTime time.Time `json:"create_time"`
fetcher fetcher.Fetcher
timer *util.Timer
@@ -23,7 +25,8 @@ type Task struct {
func NewTask() *Task {
return &Task{
ID: uuid.New().String(),
Status: base.DownloadStatusPrepare,
ID: uuid.New().String(),
Status: base.DownloadStatusReady,
CreateTime: time.Now(),
}
}