diff --git a/sdks/storage/cdsapi/user.go b/sdks/storage/cdsapi/user.go index 2230451..01c8870 100644 --- a/sdks/storage/cdsapi/user.go +++ b/sdks/storage/cdsapi/user.go @@ -48,3 +48,25 @@ func (r *UserDeleteResp) ParseResponse(resp *http.Response) error { func (c *Client) UserDelete(req *UserDelete) error { return JSONAPINoData(c.cfg, http.DefaultClient, req) } + +const UserBatchGetStatsPath = "/v1/user/batchGetStats" + +type UserBatchGetStats struct { + UserIDs []cdssdk.UserID `json:"userIDs" binding:"required"` +} + +func (r *UserBatchGetStats) MakeParam() *sdks.RequestParam { + return sdks.MakeJSONParam(http.MethodPost, UserBatchGetStatsPath, r) +} + +type UserBatchGetStatsResp struct { + Stats []*cdssdk.UserStats `json:"stats"` +} + +func (r *UserBatchGetStatsResp) ParseResponse(resp *http.Response) error { + return sdks.ParseCodeDataJSONResponse(resp, r) +} + +func (c *Client) UserBatchGetStats(req *UserBatchGetStats) (*UserBatchGetStatsResp, error) { + return JSONAPI(c.cfg, http.DefaultClient, req, &UserBatchGetStatsResp{}) +} diff --git a/sdks/storage/models.go b/sdks/storage/models.go index 9a53072..e1c622f 100644 --- a/sdks/storage/models.go +++ b/sdks/storage/models.go @@ -390,3 +390,9 @@ type PackageHash struct { // 16进制字符串格式的sha256哈希值 Hash string `json:"hash"` } + +type UserStats struct { + UserID UserID `json:"userID" gorm:"column:UserID"` + FileCount int64 `json:"fileCount" gorm:"column:FileCount"` + TotalSize int64 `json:"totalSize" gorm:"column:TotalSize"` +}