Skip to content

Commit 2830148

Browse files
committed
docs: add API example requests and responses to README #30
1 parent 60c8f15 commit 2830148

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,59 @@ pnpm run dev
171171

172172
---
173173

174+
## 📡 API Examples
175+
176+
### Compare two developers
177+
178+
**Request:**
179+
```bash
180+
GET /api/compare?username=torvalds&username=gvanrossum
181+
```
182+
183+
**Response:**
184+
```json
185+
{
186+
"success": true,
187+
"users": [
188+
{
189+
"username": "torvalds",
190+
"repoScore": 9850,
191+
"prScore": 120,
192+
"contributionScore": 45,
193+
"finalScore": 4552,
194+
"topRepos": [
195+
{ "name": "linux", "stars": 180000, "forks": 52000 }
196+
],
197+
"topPullRequests": []
198+
},
199+
{
200+
"username": "gvanrossum",
201+
"repoScore": 4200,
202+
"prScore": 980,
203+
"contributionScore": 310,
204+
"finalScore": 2370,
205+
"topRepos": [
206+
{ "name": "cpython", "stars": 61000, "forks": 29000 }
207+
],
208+
"topPullRequests": [
209+
{ "title": "bpo-12345: fix typing module", "repo": "python/cpython" }
210+
]
211+
}
212+
]
213+
}
214+
```
215+
216+
### Error response (user not found)
217+
218+
```json
219+
{
220+
"success": false,
221+
"error": "GitHub user not found"
222+
}
223+
```
224+
225+
---
226+
174227
## 🌍 Localization
175228

176229
* Supported languages: English 🇺🇸, Arabic 🇸🇦

0 commit comments

Comments
 (0)