This module allows player to invite each other to play a game.
Variables available for service configuration.
REDIS_INVITATIONS_PORT_6379_TCP_ADDR
- IP of the InvitationsDB redis
REDIS_INVITATIONS_PORT_6379_TCP_PORT
- Port of the InvitationsDB redis
REDIS_AUTH_PORT_6379_TCP_ADDR
- IP of the AuthDB redis
REDIS_AUTH_PORT_6379_TCP_PORT
- Port of the AuthDB redis
REDIS_USERMETA_PORT_6379_TCP_ADDR
- IP of the UsermetaDB redis
REDIS_USERMETA_PORT_6379_TCP_PORT
- Port of the UsermetaDB redis
API_SECRET
- For sending notifications
NOTIFICATIONS_PORT_8080_TCP_ADDR
- IP of the Notifications service
NOTIFICATIONS_PORT_8080_TCP_PORT
- Port of the Notifications service
See #4 for details.
It contains the list of users that "userA" has blocked. Invitations from users in this list won't be sent to "userA".
Note, this database contains metadata for all users.
+ Parameters
+ authToken (string, required) ... Authentication token
{
"gameId": "0123456789abcdef012345",
"type": "triominos/v1"
"to": "some_username",
}
{
"id": "0123456789abcdef012345"
}
If authToken is invalid.
If the user is not allowed to send this invitation (for example she/he has been blocked).
Note: Error code would better be 403
, but the game using this module will show a login screen when 403
is returned. That's why we chose code 423
.
[
{
"id": "0123456789abcdef012345",
"from": "some_username",
"to": "my_username",
"gameId": "0123456789abcdef012345",
"type": "triominos/v1"
},
{
"id": "0123456789abcdef012345",
"from": "my_username",
"to": "some_username",
"gameId": "0123456789abcdef012345",
"type": "triominos/v1"
},
{
"id": "0123456789abcdef012345",
"from": "my_username",
"to": "some_username",
"gameId": "0123456789abcdef012345",
"type": "wordsearch/v1"
}
]
+ Parameters
+ authToken (string, required) ... Authentication token
+ id (string, required) ... ID of the invitation
An invitation can only be deleted by one of the two players concerned bt the invitation.
"from" player can DELETE it only with reason: "cancel"
"to" player can DELETE it only with reasons: "accept" or "refuse"
After deletion is successful, the invitation is removed from database (for the two players).
{
"reason": "accept"
}
{
"ok": true
}
Deleting an invitation can also be done using POST
at the following endpoint:
/invitations/v1/auth/:authToken/invitations/:id/delete
This endpoint has the exact same behaviour as the above documented DELETE.. It's useful for platforms that do not support the DELETE method.