-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
617 additions
and
268 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
## Automated Data Fetch REST-API | ||
|
||
The following endpoints can be used to fetch leaderboard data. | ||
|
||
`/stats` | ||
|
||
Gets important statistics about the leaderboard. | ||
|
||
**Example Call** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/stats' | ||
``` | ||
|
||
**Example Response** | ||
|
||
``` | ||
{ | ||
totalContributors: 128, | ||
totalOpenPRs: 58, | ||
totalMergedPRs: 87, | ||
totalIssues: 70, | ||
} | ||
``` | ||
|
||
--- | ||
|
||
`/rank` | ||
|
||
Used to rank contributors by a parameter. Can be used to fetch the rank of a contributor based on a parameter (defaults to number of merged PRs). | ||
|
||
Provides ranked list of contributor usernames sorted by `mergedprs` if no parameters provided. | ||
|
||
**Query Parameters** | ||
|
||
| Argument | Example | Required | Description | ||
| ------------- | ------------- | ------------- | ------------- | ||
| parameter | openprs | Optional | Can take values `openprs`, `issues`, `mergedprs` to rank contributors by. Defaults to `mergedprs`. | ||
| username | RonLek | Optional | Username of any contributor within the leaderboard. Returns error response if username not found. Case-insensitive. | ||
|
||
**Example Call 1** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/rank?username=RonLek' | ||
``` | ||
|
||
**Example Response 1** | ||
``` | ||
{"username":"RonLek","rank":3} | ||
``` | ||
|
||
**Example Call 2** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/rank?username=RonLek¶meter=openprs' | ||
``` | ||
|
||
**Example Response 2** | ||
``` | ||
{"username":"RonLek","rank":4} | ||
``` | ||
|
||
**Example Call 3** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/rank?parameter=issues' | ||
``` | ||
|
||
**Example Response 3** | ||
|
||
``` | ||
{"ranks":["Darshilp326","yash-rajpal","RonLek","aditya-mitra","rodriq","djcruz93","lolimay"]} | ||
``` | ||
|
||
--- | ||
|
||
`/contributor` | ||
|
||
Used to fetch contributor details. Can be used to fetch contributor details by contributor rank sorted by parameter (defaults to number of merged PRs). | ||
|
||
Provides all contributor data if no parameters provided. | ||
|
||
**Query Parameters** | ||
|
||
| Argument | Example | Required | Description | ||
| ------------- | ------------- | ------------- | ------------- | ||
| parameter | openprs | Optional | Can take values `openprs`, `issues`, `mergedprs` to rank contributors by. Defaults to `mergedprs`. | ||
| username | RonLek | Optional | Username of any contributor within the leaderboard. Returns error response if username not found. Case-sensitive. | ||
| rank | 3 | Optional | Rank starting with 1. | ||
|
||
**Example Call 1** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/contributor?username=RonLek' | ||
``` | ||
|
||
**Example Response 1** | ||
|
||
``` | ||
{ | ||
"home":"https://github.com/RonLek", | ||
"avatarUrl":"https://avatars.githubusercontent.com/u/28918901?v=4", | ||
"openPRsNumber": ..., | ||
"openPRsLink": ..., | ||
"mergedPRsNumber": ..., | ||
"mergedPRsLink": .., | ||
"issuesNumber": ..., | ||
"issuesLink": ... | ||
} | ||
``` | ||
|
||
**Example Call 2** | ||
``` | ||
curl --request GET 'http://localhost:8080/api/contributor?rank=3' | ||
``` | ||
|
||
**Example Response 2** | ||
``` | ||
{ | ||
"home":"https://github.com/RonLek", | ||
"avatarUrl":"https://avatars.githubusercontent.com/u/28918901?v=4", | ||
"openPRsNumber": ..., | ||
"openPRsLink": ..., | ||
"mergedPRsNumber": ..., | ||
"mergedPRsLink": .., | ||
"issuesNumber": ..., | ||
"issuesLink": ... | ||
} | ||
``` | ||
|
||
**Example Call 3** | ||
|
||
``` | ||
curl --request GET 'http://localhost:8080/api/contributor?rank=3¶meter=issues' | ||
``` | ||
|
||
**Example Response 3** | ||
``` | ||
{ | ||
"home":"https://github.com/RonLek", | ||
"avatarUrl":"https://avatars.githubusercontent.com/u/28918901?v=4", | ||
"openPRsNumber": ..., | ||
"openPRsLink": ..., | ||
"mergedPRsNumber": ..., | ||
"mergedPRsLink": .., | ||
"issuesNumber": ..., | ||
"issuesLink": ... | ||
} | ||
``` |
This file contains 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
Oops, something went wrong.