MCPcopy Index your code
hub / github.com/coder/coder / getMyChatUsageLimitStatus

Method getMyChatUsageLimitStatus

coderd/exp_chats.go:1724–1742  ·  view source on GitHub ↗

@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)

Source from the content-addressed store, hash-verified

1722//
1723//nolint:revive // HTTP handler writes to ResponseWriter.
1724func (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}

Callers

nothing calls this directly

Calls 5

ResolveUsageLimitStatusFunction · 0.92
APIKeyFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected