Skip to content

Commit

Permalink
feat(aliyundrive_open): optional delete file directly (close #3769)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Mar 8, 2023
1 parent 2379cb8 commit 5596661
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/aliyundrive_open/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func (d *AliyundriveOpen) Copy(ctx context.Context, srcObj, dstDir model.Obj) er
}

func (d *AliyundriveOpen) Remove(ctx context.Context, obj model.Obj) error {
_, err := d.request("/adrive/v1.0/openFile/recyclebin/trash", http.MethodPost, func(req *resty.Request) {
uri := "/adrive/v1.0/openFile/recyclebin/trash"
if d.RemoveWay == "delete" {
uri = "/adrive/v1.0/openFile/delete"
}
_, err := d.request(uri, http.MethodPost, func(req *resty.Request) {
req.SetBody(base.Json{
"drive_id": d.DriveId,
"file_id": obj.GetID(),
Expand Down
1 change: 1 addition & 0 deletions drivers/aliyundrive_open/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Addition struct {
OauthTokenURL string `json:"oauth_token_url" default:"https://api.nn.ci/alist/ali_open/token"`
ClientID string `json:"client_id" required:"false" help:"Keep it empty if you don't have one"`
ClientSecret string `json:"client_secret" required:"false" help:"Keep it empty if you don't have one"`
RemoveWay string `json:"remove_way" required:"true" type:"select" options:"trash,delete"`
}

var config = driver.Config{
Expand Down

0 comments on commit 5596661

Please sign in to comment.