docs(api): document client surface and fetching conventions#359
Closed
yunus-dev-codecrafter wants to merge 1 commit into
Closed
docs(api): document client surface and fetching conventions#359yunus-dev-codecrafter wants to merge 1 commit into
yunus-dev-codecrafter wants to merge 1 commit into
Conversation
Contributor
|
hey @yunus-dev-codecrafter, thanks for jumping in! closing this pr because the author needs to be assigned to the linked issue (#306) before opening a pr. please comment on the issue requesting assignment, wait to be assigned, then re-raise your pr. this keeps work fairly distributed across contributors. hope to see a revised pr from you soon! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #306
Description
src/shared/api/client.tsexposes 50+ functions butAPI_INTEGRATION.mddid not enumerate them or document the conventions around auth, error handling,AbortSignal, anduseOptimisticDatapairing. Contributors were hand-rollingfetchcalls or duplicating endpoints, bypassing the centralized auth/error handling inapiRequest.This PR adds a comprehensive reference section to stop that pattern.
Changes
docs/API_INTEGRATION.md(new)ApiRequestOptionscontract — documentsrequiresAuthand the spreadRequestInitfields (signal,method,body,headers)getUserFriendlyErrormappings, plus the<DataState>display pattern{ signal }foruseOptimisticDatacancellation; generic fallback for other endpointsuseOptimisticDatapattern — full runnabletsxexample based on the realPullRequestsTab/IssuesTabcodeVITE_env vars are public; JWT lives inlocalStorageunderpatchwork_jwt(XSS caveat fromconfig/api.ts)getProjectIssues/getProjectPRs→getMaintainerIssues/getMaintainerPRsCONTRIBUTING.md(modified)docs/API_INTEGRATION.mdand 5 quick rulesAcceptance Criteria
Security Notes
VITE_environment variables are compiled into the client bundle and must never hold secretslocalStorage(patchwork_jwt), which is XSS-vulnerable; httpOnly cookies recommended for productionclient.test.ts) asserts that raw tokens never leak into stdout, console logs, or error stringsHow to Review
docs/API_INTEGRATION.md— verify all endpoint signatures matchsrc/shared/api/client.tsCONTRIBUTING.md:171points to the new filepnpm run format:check(if network permits)