Friendship
Friendship
This module handles relationship between gamers of same application. Friendship is represented as a two way directed graph between the gamers.
info
Base Endpoint: /api/v1/friendship
Available Endpoints
1. Search for User
- Method & Path:
GET /search - Description: Allows searching for users based on their display name.
- Headers:
Authorization— Bearer token for user authentication.
- Query Parameters:
displayName— The display name of the user to search for.
- Response Body: An array of user search results, each containing:
id: Unique identifier of the user.displayName: Display name of the user.avatar: URL to the user's avatar image.
cURL Command
curl --request GET \
--url 'https://api.yarsaplay.com/api/v1/friendship/search?displayName=' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
},
{
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
]
2. Send Friend Request
- Method & Path:
POST / - Description: Sends a friend request to another user.
- Headers:
Authorization— Bearer token for user authentication.
- Request Body:
target— Unique identifier of the target user to send a friend request to.
- Response Body
ok— Boolean indicating the success of the operation.
cURL Command
curl --request POST \
--url https://api.yarsaplay.com/api/v1/friendship \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json'
Response Body
{
"ok": <boolean>
}
3. Accept Friend Request
- Method & Path:
POST :friendshipId/accept - Description: Accepts a friend request from another user.
- Headers:
Authorization— Bearer token for user authentication.
- URL Parameters:
friendshipId— Unique identifier of the friendship relation.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request POST \
--url https://api.yarsaplay.com/api/v1/friendship/__FRIENDSHIPID__/accept \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"ok": <boolean>
}
4. Get Friend List
- Method & Path:
GET / - Description: Retrieves the list of friends for the authenticated user.
- Headers:
Authorization— Bearer token for user authentication.
- Response Body: An array of friend details, each containing:
id: Unique identifier of the friend.displayName: Display name of the friend.status: The status of the friendship (e.g., accepted).
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/friendship \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
},
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
}
]
5. Get Incoming Requests
- Method & Path:
GET /requests/incoming - Description: Retrieves incoming friend requests for the authenticated user.
- Headers:
Authorization— Bearer token for user authentication.
- Response Body: An array of incoming friend requests, each containing:
id: Unique identifier of the friend request.from: Details of the user who sent the request.
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/friendship/requests/incoming \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
},
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
}
]
6. Get Outgoing Request
- Method & Path:
GET /requests/outgoing - Description: Retrieves incoming friend requests for the authenticated user.
- Headers:
Authorization— Bearer token for user authentication.
- Response Body: An array of incoming friend requests, each containing:
id: Unique identifier of the friend request.to: Details of the user who sent the request.
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/friendship/requests/outgoing \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
},
{
"id": "<uuid>",
"status": "<string>",
"user": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
}
]
7. Reject Incoming Request
- Method & Path:
DELETE /requests/incoming/:friendshipId - Description: Rejects an incoming friend request.
- Headers:
Authorization— Bearer token for user authentication.
- URL Parameters:
friendshipId— Unique identifier of the friendship relation.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request DELETE \
--url https://api.yarsaplay.com/api/v1/friendship/requests/incoming/__FRIENDSHIPID__ \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"ok": <boolean>
}
8. Cancel Outgoing Request
- Method & Path:
DELETE /requests/outgoing/:friendshipId - Description: Cancels an outgoing friend request.
- Headers:
Authorization— Bearer token for user authentication.
- URL Parameters:
friendshipId— Unique identifier of the friendship relation.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request DELETE \
--url https://api.yarsaplay.com/api/v1/friendship/requests/outgoing/__FRIENDSHIPID__ \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"ok": <boolean>
}
9. Unblock Gamer
- Method & Path:
DELETE /blocked/:friendshipId - Description: Unblocks a previously blocked user.
- Headers:
Authorization— Bearer token for user authentication.
- URL Parameters:
friendshipId— Unique identifier of the blocked relation.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request DELETE \
--url https://api.yarsaplay.com/api/v1/friendship/blocked/__FRIENDSHIPID__ \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"ok": <boolean>
}
10. Block Gamer
- Method & Path:
POST /block - Description: Blocks a user, preventing them from sending friend requests or messages.
- Headers:
Authorization— Bearer token for user authentication.
- Request Body:
target— Unique identifier of the user to block.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request POST \
--url https://api.yarsaplay.com/api/v1/friendship/block \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json'
Response Body
{
"ok": <boolean>
}
11. Unfriend a Gamer
- Method & Path:
DELETE /:friendshipId - Description: Removes a user from the friend list, effectively "unfriending" them.
- Headers:
Authorization— Bearer token for user authentication.
- URL Parameters:
friendshipId— Unique identifier of the friendship relation.
- Response Body:
ok— Boolean indicating the success of the operation.
cURL Command
curl --request DELETE \
--url https://api.yarsaplay.com/api/v1/friendship/__FRIENDSHIPID__ \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
{
"ok": <boolean>
}
12. Get Blocked Gamer List
- Method & Path:
GET /blocked - Description: Retrieves a list of users that the authenticated user has blocked.
- Headers:
Authorization— Bearer token for user authentication. - Response Body: An array of blocked user details, each containing:
id: Unique identifier of the blocked user.displayName: Display name of the blocked user.
cURL Command
curl --request GET \
--url https://api.yarsaplay.com/api/v1/friendship/blocked \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'
Response Body
[
{
"id": "<uuid>",
"toGamer": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
},
{
"id": "<uuid>",
"toGamer": {
"avatar": "<string>",
"displayName": "<string>",
"id": "<uuid>"
}
}
]