Skip to content
Victor Libert edited this page Nov 7, 2024 · 3 revisions

Player api/player/{playerId}/

/

return a JsonObject
{
"id": 0,
"username": "Marvin",
"friends": [friendsId],
"role": "Member"
}

username/

lighter query when only username required.
return a JsonObject
{
"username": "Marvin"
}

friends/

lighter query when only friends list required.
return a JsonObject
{
"friends": [friendId, ...]
}

avatar/

return the [jpg, jpeg, png] file is selected by user as is profile picture

games/

return from the blockchain all the games in which user was involved
Warning all active games are exclude from this API call (an active game isn't in the blockchain)
return a JsonObject
[{"gameId: 0,
"playerIds": [0, 0],(2 or 4)
"gameType": false,(false=pong, true=connect4)
"score": [2,3],(indexes matches playerIds indexes)
"duration": 20,(value in secondes)
"startTime": 0,(POSIX time)
"endTime": 0(POSIX time)
},
...]

Games api/games

setup/

A one time API to call at init for pushing smart-contract to blockchain

/

return the number of game all time (without the currently played)
return a JsonObject
{
"gameNumber": 6
}

/{gameId}

{"gameId: 0,
"playerIds": [0, 0],(2 or 4)
"gameType": false,(false=pong, true=connect4)
"score": [2,3],(indexes matches playerIds indexes)
"duration": 20,(value in secondes)
"startTime": 0,(POSIX time)
"endTime": 0(POSIX time)
}

Clone this wiki locally