* 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.
()
| 27 | * so the CLI just reads the response without replicating that logic. |
| 28 | */ |
| 29 | async 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. |
no test coverage detected