Skip to content

Commit 4fa31bf

Browse files
authored
docs(api): add JSDoc to GET handler in app/api/streak/route.ts JhaSourav07#359 (JhaSourav07#552)
Fixes JhaSourav07#359 ## Description Added JSDoc documentation to the GET handler in app/api/streak/route.ts. ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview No visual changes - documentation only. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run `npm run format` and `npm run lint` locally. - [x] My commits follow the Conventional Commits format. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard.
2 parents ceb5ef0 + 663ed85 commit 4fa31bf

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

app/api/streak/route.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ import { streakParamsSchema } from '../../../lib/validations';
1515
const SVG_CSP_HEADER =
1616
"default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; connect-src https://fonts.gstatic.com;";
1717

18+
/**
19+
* GET /api/streak - Returns GitHub contribution streak as SVG image
20+
*
21+
* Query Parameters:
22+
* - username (string, required): GitHub username
23+
* - theme (string, optional): 'default', 'dark', 'light' (default: 'default')
24+
* - hide_border (boolean, optional): Hide card border (default: false)
25+
* - hide_title (boolean, optional): Hide card title (default: false)
26+
* - hide_total (boolean, optional): Hide total contributions (default: false)
27+
* - count_private (boolean, optional): Include private contributions (default: false)
28+
* - show_icons (boolean, optional): Show contribution icons (default: true)
29+
* - ring_color (string, optional): Ring color hex (default: '#2c3e50')
30+
* - curr_streak_color (string, optional): Current streak text color (default: '#2c3e50')
31+
* - side_streak_color (string, optional): Longest streak text color (default: '#7f8c8d')
32+
* - curr_streak_label (string, optional): Current streak label (default: 'Current streak')
33+
* - side_streak_label (string, optional): Longest streak label (default: 'Longest streak')
34+
* - date_format (string, optional): Date format (default: 'YYYY-MM-DD')
35+
*
36+
* Response:
37+
* - 200: SVG image with Content-Type: image/svg+xml
38+
* - Cache-Control: public, max-age=3600, s-maxage=3600, stale-while-revalidate=60
39+
* - CSP: default-src 'none'; style-src 'unsafe-inline'
40+
* - 400: { "error": "Missing required parameter: username" }
41+
* - 404: { "error": "User not found or has no contributions" }
42+
* - 500: { "error": "Failed to fetch streak data" }
43+
*
44+
* Caching:
45+
* - Success: Cached 1 hour, stale-while-revalidate 60 seconds
46+
* - Errors: Not cached
47+
* - Cache key includes username and theme
48+
*/
49+
1850
export async function GET(request: Request) {
1951
const { searchParams } = new URL(request.url);
2052

0 commit comments

Comments
 (0)