asdf
Squash the current repository state back into one baseline commit while preserving the README reframing and repository contents. Constraint: User explicitly requested a single squashed commit with subject "asdf" Confidence: high Scope-risk: broad Reversibility: clean Directive: This commit intentionally rewrites published history; coordinate before future force-pushes Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr Not-tested: Fresh clone verification after push
This commit is contained in:
commit
d2542c9a62
38
src/services/api/ultrareviewQuota.ts
Normal file
38
src/services/api/ultrareviewQuota.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import axios from 'axios'
|
||||
import { getOauthConfig } from '../../constants/oauth.js'
|
||||
import { isClaudeAISubscriber } from '../../utils/auth.js'
|
||||
import { logForDebugging } from '../../utils/debug.js'
|
||||
import { getOAuthHeaders, prepareApiRequest } from '../../utils/teleport/api.js'
|
||||
|
||||
export type UltrareviewQuotaResponse = {
|
||||
reviews_used: number
|
||||
reviews_limit: number
|
||||
reviews_remaining: number
|
||||
is_overage: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek the ultrareview quota for display and nudge decisions. Consume
|
||||
* happens server-side at session creation. Null when not a subscriber or
|
||||
* the endpoint errors.
|
||||
*/
|
||||
export async function fetchUltrareviewQuota(): Promise<UltrareviewQuotaResponse | null> {
|
||||
if (!isClaudeAISubscriber()) return null
|
||||
try {
|
||||
const { accessToken, orgUUID } = await prepareApiRequest()
|
||||
const response = await axios.get<UltrareviewQuotaResponse>(
|
||||
`${getOauthConfig().BASE_API_URL}/v1/ultrareview/quota`,
|
||||
{
|
||||
headers: {
|
||||
...getOAuthHeaders(accessToken),
|
||||
'x-organization-uuid': orgUUID,
|
||||
},
|
||||
timeout: 5000,
|
||||
},
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
logForDebugging(`fetchUltrareviewQuota failed: ${error}`)
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user