Delete cancels and removes a download.
(id string)
| 228 | |
| 229 | // Delete cancels and removes a download. |
| 230 | func (s *RemoteDownloadService) Delete(id string) error { |
| 231 | resp, err := s.doRequest("POST", "/delete?id="+url.QueryEscape(id), nil) |
| 232 | // Some APIs use DELETE method, checking previous implementation in server it supports both POST and DELETE |
| 233 | // but mostly POST for actions. Let's stick to POST as per server implementation. |
| 234 | if err != nil { |
| 235 | return err |
| 236 | } |
| 237 | defer func() { _, _ = io.Copy(io.Discard, resp.Body); _ = resp.Body.Close() }() |
| 238 | return nil |
| 239 | } |
| 240 | |
| 241 | // Purge cancels and removes a download, and deletes its files from disk. |
| 242 | func (s *RemoteDownloadService) Purge(id string) error { |