Skip to content

[GSoC] Updated Docs for leaderboard API and Added Docs for update avatar API #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions API/leaderboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Note: If username is not already added to leaderboard then it would be added in

## Optional Paramaters

- **avatar** - This should be only used if a new user needs to be added to the leaderboard and wants a custom avatar, should be just the file name from `https://commons.wikimedia.org/wiki/File:` For example: **User-avatar_Dark.png** If no **avatar** is supplied then default one would be used i.e. **Gnome-stock_person.svg**
- **avatar** - This should be only used if a new user needs to be added to the leaderboard and wants a custom avatar, should be complete Image URL for example `https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png` If no **avatar** is supplied then default one would be used i.e. **https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png**

- **limit** - This is the limit for the number of results and should be passed along with offset, for example **5**

Expand All @@ -46,56 +46,56 @@ curl --location --request GET 'https://tools.wmflabs.org/commons-android-app/too
"username": "Syced",
"category_count": 462,
"limit": null,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"offset": null,
"duration": "all_time",
"leaderboard_list": [
{
"username": "Fæ",
"category_count": 107147,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 1
},
{
"username": "JAn Dudík",
"category_count": 912,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 2
},
{
"username": "Vojtěch Dostál",
"category_count": 749,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 3
},
{
"username": "Syced",
"category_count": 462,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 4
},
{
"username": "Misaochan",
"category_count": 101,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 5
},
{
"username": "Kookaburra 81",
"category_count": 41,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 6
},
{
"username": "Madhurgupta10",
"category_count": 1,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 7
},
{
"username": "Macgills2",
"category_count": 1,
"avatar": "Gnome-stock_person.svg",
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
"rank": 8
}
],
Expand Down
47 changes: 47 additions & 0 deletions API/update_avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Update Leaderboard Avatar API

This API is used to check if a username is valid or not.

## Base URL
`https://tools.wmflabs.org/commons-android-app/tool-commons-android-app`

## Endpoint
`/update_avatar.py`

## Request Type
`GET`

## Response Type
`JSON`

## Required Parameters

- **user** - This is username of the user, for example **Syced** (if username has **whitespaces** then replace them with `_` )

- **avatar** - This is url of the avatar to set, for example **https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png**


## Example Request

```
curl --location --request GET 'https://commons-android-app.toolforge.org/tool-commons-android-app/update_avatar.py?user=Syced&avatar=https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png'
```

## Example Responses

```
{
"status": "200",
"message": "Avatar Updated",
"user": "Syced"
}
```

**Note: Returns error if params are invalid**
```
{
"status": "400",
"message": "Invalid Parameters",
"user": null
}
```