[MM-43917] Cloud Freemium limits API: messages/posts (#20152)
* WIP - Add api and app funcs * Add test cases * Add utils testcases * Exclude deleted posts * Add doc for func * Move api from cloud to usage * Allow api access to authenticated users * Change int to int64 * Fix lint issue * Simplify err check Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>
Этот коммит содержится в:
@@ -324,6 +324,10 @@ func (c *Client4) cloudRoute() string {
|
||||
return "/cloud"
|
||||
}
|
||||
|
||||
func (c *Client4) usageRoute() string {
|
||||
return "/usage"
|
||||
}
|
||||
|
||||
func (c *Client4) testEmailRoute() string {
|
||||
return "/email/test"
|
||||
}
|
||||
@@ -8078,3 +8082,18 @@ func (c *Client4) GetAppliedSchemaMigrations() ([]AppliedMigration, *Response, e
|
||||
}
|
||||
return list, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// Usage Section
|
||||
|
||||
// GetPostsUsage returns rounded off total usage of posts for the instance
|
||||
func (c *Client4) GetPostsUsage() (*PostsUsage, *Response, error) {
|
||||
r, err := c.DoAPIGet(c.usageRoute()+"/posts", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
|
||||
var usage *PostsUsage
|
||||
err = json.NewDecoder(r.Body).Decode(&usage)
|
||||
return usage, BuildResponse(r), err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user