Skip to content

Commit fca993a

Browse files
authored
feat(drivers/cloudreve): implement GetDetails (OpenListTeam#1960)
1 parent a79d834 commit fca993a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/cloudreve/driver.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ func (d *Cloudreve) create(ctx context.Context, dir model.Obj, file model.Obj) e
204204
}, nil)
205205
}
206206

207+
func (d *Cloudreve) GetDetails(ctx context.Context) (*model.StorageDetails, error) {
208+
var r StorageDetails
209+
d.request(http.MethodGet, "/user/storage", nil, &r)
210+
return &model.StorageDetails{
211+
DiskUsage: model.DiskUsage{
212+
TotalSpace: r.Total,
213+
UsedSpace: r.Used,
214+
},
215+
}, nil
216+
}
217+
207218
//func (d *Cloudreve) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) {
208219
// return nil, errs.NotSupport
209220
//}

drivers/cloudreve/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,9 @@ type Config struct {
6969
LoginCaptcha bool `json:"loginCaptcha"`
7070
CaptchaType string `json:"captcha_type"`
7171
}
72+
73+
type StorageDetails struct {
74+
Used int64 `json:"used"`
75+
Free int64 `json:"free"`
76+
Total int64 `json:"total"`
77+
}

0 commit comments

Comments
 (0)