MCPcopy Create free account
hub / github.com/codeaashu/claude-code / fetchOverageCreditGrant

Function fetchOverageCreditGrant

src/services/api/overageCreditGrant.ts:29–41  ·  view source on GitHub ↗

* Fetch the current user's overage credit grant eligibility from the backend. * The backend resolves tier-specific amounts and role-based claim permission, * so the CLI just reads the response without replicating that logic.

()

Source from the content-addressed store, hash-verified

27 * so the CLI just reads the response without replicating that logic.
28 */
29async function fetchOverageCreditGrant(): Promise<OverageCreditGrantInfo | null> {
30 try {
31 const { accessToken, orgUUID } = await prepareApiRequest()
32 const url = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/overage_credit_grant`
33 const response = await axios.get<OverageCreditGrantInfo>(url, {
34 headers: getOAuthHeaders(accessToken),
35 })
36 return response.data
37 } catch (err) {
38 logError(err)
39 return null
40 }
41}
42
43/**
44 * Get cached grant info. Returns null if no cache or cache is stale.

Callers 1

Calls 4

prepareApiRequestFunction · 0.85
getOauthConfigFunction · 0.85
getOAuthHeadersFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected