Skip to content

Friend API

atsanan edited this page Mar 25, 2019 · 11 revisions

[x] 11.1 Add Friend

POST /api/v1/friend/add

Forms body:

Field Description Optional
playerId playerId of a player Yes
friendId playerId of a player this friend Yes

Returns:

{
    "data": {
    "_id": "5b629832aaea3c3d0cd1b8a9",
        "createAt": "2018-08-02T05:35:46.265Z",
        "friend": {
            "_id": "5b51a8577c74daf430bf2cb5",
            "coin": 500,
            "costumeList": [],
            "costumeSelectId": -1,
            "diamond": 0,
            "gender": "",
            "playerName": "undefined",
            "teamPlayerId": -1,
            "userId": "5b51a8f5083713c64d4a6d3d"
        },
        "friendActiveStatus": 1,
        "friendId": "5b51a8577c74daf430bf2cb5",
        "player": {
            "_id": "5b5186817c74daf430bdcdef",
            "coin": 500,
            "costumeList": [],
            "costumeSelectId": -1,
            "diamond": 0,
            "gender": "",
            "playerName": "undefined",
            "teamPlayerId": -1,
            "userId": "5b5186817c74daf430bdcdea"
        },
        "playerId": "5b5186817c74daf430bdcdef"
        }
    },
    "isSuccess": true
}

[x] 11.2 Get Friend Request

GET /api/v1/friends/friend/{friendId: string}

Query parameters:

Field Descriptio Optional
page Current page of friend on this player Yes
limit Maximum page of friend on this player Yes

Returns:

{
    "data":{
            "friend":[{
                  "_id": "5b629832aaea3c3d0cd1b8a9",
                  "createAt": "2018-08-02T05:35:46.265Z",
                  "friend": {
                             "_id": "5b51a8577c74daf430bf2cb5",
                             "coin": 500,
                             "costumeList": [],
                             "costumeSelectId": -1,
                             "diamond": 0,
                             "gender": "",
                             "playerName": "undefined",
                             "teamPlayerId": -1,
                             "userId": "5b51a8f5083713c64d4a6d3d"
                           },
                    "friendActiveStatus": 1,
                    "friendId": "5b51a8577c74daf430bf2cb5",
                    "playerId": "5b5186817c74daf430bdcdef"
                 }
             }],            
            "pageIndex": -1,
            "pageLimit": -1,
            "pages": 1,
            "paging": {
                      "next": "",
                       "previous": ""
            },

             },
    "isSuccess": true
}

[x] 11.3 Get player Add

GET /api/v1/friends/player/{playerId: string}

Query parameters:

Field Description Optional
page Current page of friend on this player Yes
limit Maximum page of friend on this player Yes
Returns:
{
    "data":{
            "friend":[{
                  "_id": "5b629832aaea3c3d0cd1b8a9",
                  "createAt": "2018-08-02T05:35:46.265Z",
                  "friend": {
                             "_id": "5b51a8577c74daf430bf2cb5",
                             "coin": 500,
                             "costumeList": [],
                             "costumeSelectId": -1,
                             "diamond": 0,
                             "gender": "",
                             "playerName": "undefined",
                             "teamPlayerId": -1,
                             "userId": "5b51a8f5083713c64d4a6d3d"
                           },
                    "friendActiveStatus": 1,
                    "friendId": "5b51a8577c74daf430bf2cb5",
                    "playerId": "5b5186817c74daf430bdcdef",
                    "player": {
                             "_id": "5b51a8577c74daf430bf2cb5",
                             "coin": 500,
                             "costumeList": [],
                             "costumeSelectId": -1,
                             "diamond": 0,
                             "gender": "",
                             "playerName": "undefined",
                             "teamPlayerId": -1,
                             "userId": "5b51a8f5083713c64d4a6d3d"
                           },
                 }
             }],            
            "pageIndex": -1,
            "pageLimit": -1,
            "pages": 1,
            "paging": {
                      "next": "",
                       "previous": ""
            },

             },
    "isSuccess": true
}

[x] 11.4 Update Status

POST /api/v1/friends/updateStatus

Forms body:

Field Description Optional
Id Id of a friend Yes
friendStatus friendStatus of a Friend Yes
Returns:
{
    "data":{
            "friend":{
                  "_id": "5b629832aaea3c3d0cd1b8a9",
                  "createAt": "2018-08-02T05:35:46.265Z",
                  "friend": {
                             "_id": "5b51a8577c74daf430bf2cb5",
                             "coin": 500,
                             "costumeList": [],
                             "costumeSelectId": -1,
                             "diamond": 0,
                             "gender": "",
                             "playerName": "undefined",
                             "teamPlayerId": -1,
                             "userId": "5b51a8f5083713c64d4a6d3d"
                    },
                    "friendActiveStatus": false,
                    "friendId": "5b51a8577c74daf430bf2cb5",
                    "playerId": "5b5186817c74daf430bdcdef",
                    "player": {
                             "_id": "5b51a8577c74daf430bf2cb5",
                             "coin": 500,
                             "costumeList": [],
                             "costumeSelectId": -1,
                             "diamond": 0,
                             "gender": "",
                             "playerName": "undefined",
                             "teamPlayerId": -1,
                             "userId": "5b51a8f5083713c64d4a6d3d"
                           }
            }
        },
    "isSuccess": true
}

Clone this wiki locally