MCPcopy
hub / github.com/GopeedLab/gopeed / CreateTaskBatch

Function CreateTaskBatch

pkg/rest/api.go:61–75  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

59}
60
61func CreateTaskBatch(w http.ResponseWriter, r *http.Request) {
62 var req base.CreateTaskBatch
63 if ReadJson(r, w, &req) {
64 if len(req.Reqs) == 0 {
65 WriteJson(w, model.NewErrorResult("param invalid: reqs", model.CodeInvalidParam))
66 return
67 }
68 taskIds, err := Downloader.CreateDirectBatch(&req)
69 if err != nil {
70 WriteJson(w, model.NewErrorResult(err.Error()))
71 return
72 }
73 WriteJson(w, model.NewOkResult(taskIds))
74 }
75}
76
77func PatchTask(w http.ResponseWriter, r *http.Request) {
78 vars := mux.Vars(r)

Callers

nothing calls this directly

Calls 6

NewErrorResultFunction · 0.92
NewOkResultFunction · 0.92
ReadJsonFunction · 0.85
WriteJsonFunction · 0.85
CreateDirectBatchMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected