Added API to return user count bands and user count (#25796)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cac50f593b
Коммит
a59f5ccded
@@ -567,6 +567,10 @@ func (c *Client4) permissionsRoute() string {
|
||||
return "/permissions"
|
||||
}
|
||||
|
||||
func (c *Client4) limitsRoute() string {
|
||||
return "/limits"
|
||||
}
|
||||
|
||||
func (c *Client4) DoAPIGet(ctx context.Context, url string, etag string) (*http.Response, error) {
|
||||
return c.DoAPIRequest(ctx, http.MethodGet, c.APIURL+url, "", etag)
|
||||
}
|
||||
@@ -8795,3 +8799,19 @@ func (c *Client4) SubmitTrueUpReview(ctx context.Context, req map[string]any) (*
|
||||
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) GetUserLimits(ctx context.Context) (*UserLimits, *Response, error) {
|
||||
r, err := c.DoAPIGet(ctx, c.limitsRoute()+"/users", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
var userLimits UserLimits
|
||||
if r.StatusCode == http.StatusNotModified {
|
||||
return &userLimits, BuildResponse(r), nil
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&userLimits); err != nil {
|
||||
return nil, nil, NewAppError("GetUserLimits", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return &userLimits, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user