Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions drivers/cloudreve/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
//}
Expand Down
6 changes: 6 additions & 0 deletions drivers/cloudreve/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}