2015-12-07 12:01:03 +08:00
|
|
|
package src
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Delete will remove specified file/folder from Yandex Disk
|
|
|
|
func (c *Client) Delete(remotePath string, permanently bool) error {
|
|
|
|
|
|
|
|
values := url.Values{}
|
|
|
|
values.Add("permanently", strconv.FormatBool(permanently))
|
|
|
|
values.Add("path", remotePath)
|
|
|
|
urlPath := "/v1/disk/resources?" + values.Encode()
|
|
|
|
fullURL := RootAddr
|
|
|
|
if urlPath[:1] != "/" {
|
|
|
|
fullURL += "/" + urlPath
|
|
|
|
} else {
|
|
|
|
fullURL += urlPath
|
|
|
|
}
|
|
|
|
|
2017-09-20 05:30:08 +08:00
|
|
|
return c.PerformDelete(fullURL)
|
2015-12-07 12:01:03 +08:00
|
|
|
}
|