@Summary Get my chat usage limit status @x-apidocgen {"skip": true} EXPERIMENTAL: this endpoint is experimental and is subject to change. getMyChatUsageLimitStatus returns the current usage-limit status for the authenticated user. No additional RBAC check is required because the endpoint always ope
(rw http.ResponseWriter, r *http.Request)
| 1722 | // |
| 1723 | //nolint:revive // HTTP handler writes to ResponseWriter. |
| 1724 | func (api *API) getMyChatUsageLimitStatus(rw http.ResponseWriter, r *http.Request) { |
| 1725 | ctx := r.Context() |
| 1726 | // TODO(CODAGT-161): pass real organization ID |
| 1727 | // when the HTTP endpoint supports org-scoped queries. |
| 1728 | status, err := chatd.ResolveUsageLimitStatus(ctx, api.Database, httpmw.APIKey(r).UserID, uuid.NullUUID{}, time.Now()) |
| 1729 | if err != nil { |
| 1730 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 1731 | Message: "Failed to get chat usage limit status.", |
| 1732 | Detail: err.Error(), |
| 1733 | }) |
| 1734 | return |
| 1735 | } |
| 1736 | if status == nil { |
| 1737 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.ChatUsageLimitStatus{IsLimited: false}) |
| 1738 | return |
| 1739 | } |
| 1740 | |
| 1741 | httpapi.Write(ctx, rw, http.StatusOK, status) |
| 1742 | } |
| 1743 | |
| 1744 | // @Summary Upsert chat usage limit override |
| 1745 | // @x-apidocgen {"skip": true} |
nothing calls this directly
no test coverage detected