MCPcopy Create free account
hub / github.com/Noumena-Network/code / fetchOverageCreditGrant

Function fetchOverageCreditGrant

src/services/api/overageCreditGrant.ts:59–73  ·  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

57 * so the CLI just reads the response without replicating that logic.
58 */
59async function fetchOverageCreditGrant(): Promise<OverageCreditGrantInfo | null> {
60 try {
61 const { accessToken, orgUUID } = await prepareApiRequest()
62 const url = buildNoumenaPlatformUrl(
63 `/api/oauth/organizations/${orgUUID}/overage_credit_grant`,
64 )
65 const response = await axios.get<OverageCreditGrantInfo>(url, {
66 headers: getOAuthHeaders(accessToken),
67 })
68 return response.data
69 } catch (err) {
70 logError(err)
71 return null
72 }
73}
74
75/**
76 * Get cached grant info. Returns null if no cache or cache is stale.

Callers 1

Calls 4

prepareApiRequestFunction · 0.85
buildNoumenaPlatformUrlFunction · 0.85
getOAuthHeadersFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected