diff --git a/drivers/alist_v3/driver.go b/drivers/alist_v3/driver.go index bb61172c..6b8bc55e 100644 --- a/drivers/alist_v3/driver.go +++ b/drivers/alist_v3/driver.go @@ -9,7 +9,6 @@ import ( "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/alist-org/alist/v3/server/common" - "github.com/alist-org/alist/v3/server/handles" ) type AListV3 struct { @@ -42,11 +41,11 @@ func (d *AListV3) Drop(ctx context.Context) error { func (d *AListV3) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) { url := d.Address + "/api/fs/list" - var resp common.Resp[handles.FsListResp] + var resp common.Resp[FsListResp] _, err := base.RestyClient.R(). SetResult(&resp). SetHeader("Authorization", d.AccessToken). - SetBody(handles.ListReq{ + SetBody(ListReq{ PageReq: common.PageReq{ Page: 1, PerPage: 0, @@ -81,11 +80,11 @@ func (d *AListV3) List(ctx context.Context, dir model.Obj, args model.ListArgs) func (d *AListV3) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) { url := d.Address + "/api/fs/get" - var resp common.Resp[handles.FsGetResp] + var resp common.Resp[FsGetResp] _, err := base.RestyClient.R(). SetResult(&resp). SetHeader("Authorization", d.AccessToken). - SetBody(handles.FsGetReq{ + SetBody(FsGetReq{ Path: file.GetPath(), Password: d.Password, }).Post(url) diff --git a/drivers/alist_v3/types.go b/drivers/alist_v3/types.go index d86e5347..cf5006a6 100644 --- a/drivers/alist_v3/types.go +++ b/drivers/alist_v3/types.go @@ -1 +1,45 @@ package alist_v3 + +import ( + "time" + + "github.com/alist-org/alist/v3/server/common" +) + +type ListReq struct { + common.PageReq + Path string `json:"path" form:"path"` + Password string `json:"password" form:"password"` + Refresh bool `json:"refresh"` +} + +type ObjResp struct { + Name string `json:"name"` + Size int64 `json:"size"` + IsDir bool `json:"is_dir"` + Modified time.Time `json:"modified"` + Sign string `json:"sign"` + Thumb string `json:"thumb"` + Type int `json:"type"` +} + +type FsListResp struct { + Content []ObjResp `json:"content"` + Total int64 `json:"total"` + Readme string `json:"readme"` + Write bool `json:"write"` + Provider string `json:"provider"` +} + +type FsGetReq struct { + Path string `json:"path" form:"path"` + Password string `json:"password" form:"password"` +} + +type FsGetResp struct { + ObjResp + RawURL string `json:"raw_url"` + Readme string `json:"readme"` + Provider string `json:"provider"` + Related []ObjResp `json:"related"` +}