MCPcopy Index your code
hub / github.com/simstudioai/sim / getUsageLimits

Method getUsageLimits

packages/ts-sdk/src/index.ts:485–516  ·  view source on GitHub ↗

* Get current usage limits and quota information

()

Source from the content-addressed store, hash-verified

483 * Get current usage limits and quota information
484 */
485 async getUsageLimits(): Promise<UsageLimits> {
486 const url = `${this.baseUrl}/api/users/me/usage-limits`
487
488 try {
489 const response = await fetch(url, {
490 method: 'GET',
491 headers: {
492 'X-API-Key': this.apiKey,
493 },
494 })
495
496 this.updateRateLimitInfo(response)
497
498 if (!response.ok) {
499 const errorData = (await response.json().catch(() => ({}))) as unknown as any
500 throw new SimStudioError(
501 errorData.error || `HTTP ${response.status}: ${response.statusText}`,
502 errorData.code,
503 response.status
504 )
505 }
506
507 const result = await response.json()
508 return result as UsageLimits
509 } catch (error: any) {
510 if (error instanceof SimStudioError) {
511 throw error
512 }
513
514 throw new SimStudioError(error?.message || 'Failed to get usage limits', 'USAGE_ERROR')
515 }
516 }
517}
518
519export { SimStudioClient as default }

Callers 1

index.test.tsFile · 0.80

Calls 1

updateRateLimitInfoMethod · 0.95

Tested by

no test coverage detected