(123pan)Add Copy
This commit is contained in:
parent
ffa03bfda1
commit
9178088fb0
@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
"github.com/alist-org/alist/v3/drivers/base"
|
"github.com/alist-org/alist/v3/drivers/base"
|
||||||
"github.com/alist-org/alist/v3/internal/driver"
|
"github.com/alist-org/alist/v3/internal/driver"
|
||||||
"github.com/alist-org/alist/v3/internal/errs"
|
|
||||||
"github.com/alist-org/alist/v3/internal/model"
|
"github.com/alist-org/alist/v3/internal/model"
|
||||||
"github.com/alist-org/alist/v3/internal/stream"
|
"github.com/alist-org/alist/v3/internal/stream"
|
||||||
"github.com/alist-org/alist/v3/pkg/utils"
|
"github.com/alist-org/alist/v3/pkg/utils"
|
||||||
@ -164,7 +163,27 @@ func (d *Pan123) Rename(ctx context.Context, srcObj model.Obj, newName string) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Pan123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
|
func (d *Pan123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
|
||||||
return errs.NotSupport
|
if f, ok := srcObj.(File); ok {
|
||||||
|
data := base.Json{
|
||||||
|
"fileList": []map[string]interface{}{
|
||||||
|
{
|
||||||
|
"driveId": 0,
|
||||||
|
"etag": f.Etag,
|
||||||
|
"fileId": f.FileId,
|
||||||
|
"fileName": f.FileName,
|
||||||
|
"size": f.Size,
|
||||||
|
"type": f.Type,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"targetFileId": dstDir.GetID(),
|
||||||
|
}
|
||||||
|
_, err := d.Request(Copy, http.MethodPost, func(req *resty.Request) {
|
||||||
|
req.SetBody(data)
|
||||||
|
}, nil)
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("can't convert srcObj to File")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Pan123) Remove(ctx context.Context, obj model.Obj) error {
|
func (d *Pan123) Remove(ctx context.Context, obj model.Obj) error {
|
||||||
|
@ -36,6 +36,7 @@ const (
|
|||||||
Mkdir = MainApi + "/file/upload_request"
|
Mkdir = MainApi + "/file/upload_request"
|
||||||
Move = MainApi + "/file/mod_pid"
|
Move = MainApi + "/file/mod_pid"
|
||||||
Rename = MainApi + "/file/rename"
|
Rename = MainApi + "/file/rename"
|
||||||
|
Copy = MainApi + "/restful/goapi/v1/file/copy/async"
|
||||||
Trash = MainApi + "/file/trash"
|
Trash = MainApi + "/file/trash"
|
||||||
UploadRequest = MainApi + "/file/upload_request"
|
UploadRequest = MainApi + "/file/upload_request"
|
||||||
UploadComplete = MainApi + "/file/upload_complete"
|
UploadComplete = MainApi + "/file/upload_complete"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user