docs: add Credits API endpoint and documentation#152
docs: add Credits API endpoint and documentation#152ahmednahima0-beep wants to merge 2 commits intorecoupable:mainfrom
Conversation
- Introduced a new API endpoint to retrieve the current credit balance for an account at `/api/credits`. - Updated the OpenAPI specification to include detailed descriptions, parameters, and response schemas for the new endpoint. - Added corresponding documentation in MDX format for the Credits API, enhancing the overall API reference.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces a new "Get Credits" API endpoint to retrieve account credit balances. Changes include the OpenAPI endpoint definition with query parameters and response schemas, accompanying API reference documentation, and navigation structure updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
2 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="api-reference/openapi/accounts.json">
<violation number="1" location="api-reference/openapi/accounts.json:441">
P2: `CreditsResponse.timestamp` uses `nullable: true` in an OpenAPI 3.1 spec; use JSON Schema null type union to ensure nullability is honored by 3.1 tooling.</violation>
<violation number="2" location="api-reference/openapi/accounts.json:458">
P2: `/api/credits` documents `accountId` as optional but its 400 description says missing `accountId` is an error, creating a contradictory API contract.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- Modified the error description for the 400 response to clarify that it refers to an invalid `accountId`. - Changed the `timestamp` field type to allow for both string and null values, enhancing flexibility in the API response.
/api/credits.Summary by cubic
Adds the Credits API to fetch an account’s current credit balance at
/api/credits. Updates OpenAPI and docs with auth, parameters, responses, and clarified errors./api/creditswith optionalaccountId,apiKeyAuth/bearerAuth, and 200/400/401/403/404; 400 now explicitly covers invalidaccountId; includes monthly reset rules and free/pro allowances.CreditsResponseschema (id,account_id,remaining_credits,timestamp), withtimestampallowed asstringornull.api-reference/credits/get.mdxand navigation entry indocs.json.Written for commit 9d18760. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation