MM-43918: freemium limit for storage (#20225)
Summary Adds an API end point to return storage usage Ticket Link https://mattermost.atlassian.net/browse/MM-43918
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1f6e2fe846
Коммит
8f912b697e
@@ -8122,7 +8122,20 @@ func (c *Client4) GetPostsUsage() (*PostsUsage, *Response, error) {
|
||||
return usage, BuildResponse(r), err
|
||||
}
|
||||
|
||||
// GetTeamsUsage returns total usage of teams for the instance
|
||||
// GetStorageUsage returns the file storage usage for the instance,
|
||||
// rounded down the most signigicant digit
|
||||
func (c *Client4) GetStorageUsage() (*StorageUsage, *Response, error) {
|
||||
r, err := c.DoAPIGet(c.usageRoute()+"/storage", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var usage *StorageUsage
|
||||
err = json.NewDecoder(r.Body).Decode(&usage)
|
||||
return usage, BuildResponse(r), err
|
||||
}
|
||||
|
||||
// GetTeamsUsage returns total usage of teams for the instance
|
||||
func (c *Client4) GetTeamsUsage() (*TeamsUsage, *Response, error) {
|
||||
r, err := c.DoAPIGet(c.usageRoute()+"/teams", "")
|
||||
|
||||
@@ -7,6 +7,10 @@ type PostsUsage struct {
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
type StorageUsage struct {
|
||||
Bytes int64 `json:"bytes"`
|
||||
}
|
||||
|
||||
type TeamsUsage struct {
|
||||
Active int64 `json:"active"`
|
||||
CloudArchived int64 `json:"cloud_archived"`
|
||||
|
||||
Ссылка в новой задаче
Block a user