feat(drivers/cloudreve): implement GetDetails (#1960)

This commit is contained in:
MadDogOwner
2026-01-20 00:49:00 +08:00
committed by GitHub
parent a79d8347bd
commit fca993a830
2 changed files with 17 additions and 0 deletions

View File

@@ -204,6 +204,17 @@ func (d *Cloudreve) create(ctx context.Context, dir model.Obj, file model.Obj) e
}, nil)
}
func (d *Cloudreve) GetDetails(ctx context.Context) (*model.StorageDetails, error) {
var r StorageDetails
d.request(http.MethodGet, "/user/storage", nil, &r)
return &model.StorageDetails{
DiskUsage: model.DiskUsage{
TotalSpace: r.Total,
UsedSpace: r.Used,
},
}, nil
}
//func (d *Cloudreve) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) {
// return nil, errs.NotSupport
//}

View File

@@ -69,3 +69,9 @@ type Config struct {
LoginCaptcha bool `json:"loginCaptcha"`
CaptchaType string `json:"captcha_type"`
}
type StorageDetails struct {
Used int64 `json:"used"`
Free int64 `json:"free"`
Total int64 `json:"total"`
}