Skip to content

Channels API

Nattapon Rattajak edited this page Jul 5, 2018 · 17 revisions

9. Channels

9.1 Get channels list

[x] 9.1.1 By shopId

GET /api/v1/channel/byShop/{id: string}?page=0&limit=10

Query parameters:

Field Description Optional Default
id ID of this shop No
isAuto - Yes true
availableChannel - Yes true
pageIndex Current page of channels Yes 0
pageLimit Maximum page of channels Yes 10

Return:

{
    "data": {
        "pageIndex": 0,
        "pageLimit": 10,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        },
        "shops": [
            {
                "id": "5b3afe400837131c5579cf70",
                "channelName": "create-channel-with-shop",
                "channelPassword": "bbbb",
                "isAuto": true,
                "shopId": "5b34bbe41a58da6a606c9c89",
                "maxCapacity": 25,
                "capacity": 1,
                "createAt": "2018-07-03T04:40:32.452Z",
                "lastModified": "0001-01-01T00:00:00Z"
            }
        ]
    },
    "isSuccess": true
}

[x] 9.1.2 By FloorId

POST /api/v1/channel/byFloor/{id: string}?page=0&limit=10

Query parameters:

Field Description Optional Default
id ID of this floor in mall No
isAuto - Yes true
availableChannel - Yes true
pageIndex Currnt floor in mall Yes 0
pageLimit Maximum floor in mall Yes 10

Return:

{
    "data": {
        "pageIndex": 0,
        "pageLimit": 10,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        },
        "shops": [
            {
                "id": "5b34bbe41a58da6a606c9c89",
                "shopName": "seven-eleven",
                "shopDetail": "",
                "shopFloor": 0,
                "mapLat": 0,
                "mapLong": 0,
                "mallFloorId": "5b34bc381a58da6a606c9c8e",
                "shopAssetId": "",
                "shopLogo": "",
                "createAt": "0001-01-01T00:00:00Z",
                "lastModified": "0001-01-01T00:00:00Z",
                "channel": {
                    "id": "5b3afe400837131c5579cf70",
                    "channelName": "create-channel-with-shop",
                    "channelPassword": "bbbb",
                    "isAuto": true,
                    "shopId": "5b34bbe41a58da6a606c9c89",
                    "maxCapacity": 25,
                    "capacity": 25,
                    "createAt": "2018-07-03T04:40:32.452Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                }
            },
            {
                "id": "5b34bbe41a58da6a606c9c89",
                "shopName": "seven-eleven",
                "shopDetail": "",
                "shopFloor": 0,
                "mapLat": 0,
                "mapLong": 0,
                "mallFloorId": "5b34bc381a58da6a606c9c8e",
                "shopAssetId": "",
                "shopLogo": "",
                "createAt": "0001-01-01T00:00:00Z",
                "lastModified": "0001-01-01T00:00:00Z",
                "channel": {
                    "id": "5b3b70baf2ef3847208b5977",
                    "channelName": "create-channel-with-shop 2",
                    "channelPassword": "bbbbbb",
                    "isAuto": true,
                    "shopId": "5b34bbe41a58da6a606c9c89",
                    "maxCapacity": 25,
                    "capacity": 1,
                    "createAt": "2018-07-03T04:40:32.452Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                }
            }
        ]
    },
    "isSuccess": true
}

[x] 9.1.3 By MallId

POST /api/v1/channel/byMall/{id: string}?page=0&limit=10

Query parameters:

Field Description Optional Default
mallId - No
isAuto - Yes true
availableChannel - Yes true
pageIndex - Yes 0
pageLimit - Yes 10

Return:

{
    "data": {
        "mallFloors": [
            {
                "id": "5b34bc381a58da6a606c9c8e",
                "mallFloorName": "G",
                "mallFloorDetail": "",
                "mapIndoorFloorKey": "",
                "mapIndoorFloorData": "",
                "mallId": "5b3b2d32b733055dca37bf7b",
                "createAt": "0001-01-01T00:00:00Z",
                "lastModified": "0001-01-01T00:00:00Z",
                "channel": {
                    "id": "5b3afe400837131c5579cf70",
                    "channelName": "create-channel-with-shop",
                    "channelPassword": "bbbb",
                    "isAuto": true,
                    "shopId": "5b34bbe41a58da6a606c9c89",
                    "maxCapacity": 25,
                    "capacity": 25,
                    "createAt": "2018-07-03T04:40:32.452Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                },
                "shop": {
                    "id": "5b34bbe41a58da6a606c9c89",
                    "shopName": "seven-eleven",
                    "shopDetail": "",
                    "shopFloor": 0,
                    "mapLat": 0,
                    "mapLong": 0,
                    "mallFloorId": "5b34bc381a58da6a606c9c8e",
                    "shopAssetId": "",
                    "shopLogo": "",
                    "createAt": "0001-01-01T00:00:00Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                }
            },
            {
                "id": "5b34bc381a58da6a606c9c8e",
                "mallFloorName": "G",
                "mallFloorDetail": "",
                "mapIndoorFloorKey": "",
                "mapIndoorFloorData": "",
                "mallId": "5b3b2d32b733055dca37bf7b",
                "createAt": "0001-01-01T00:00:00Z",
                "lastModified": "0001-01-01T00:00:00Z",
                "channel": {
                    "id": "5b3b70baf2ef3847208b5977",
                    "channelName": "create-channel-with-shop 2",
                    "channelPassword": "bbbbbb",
                    "isAuto": true,
                    "shopId": "5b34bbe41a58da6a606c9c89",
                    "maxCapacity": 25,
                    "capacity": 1,
                    "createAt": "2018-07-03T04:40:32.452Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                },
                "shop": {
                    "id": "5b34bbe41a58da6a606c9c89",
                    "shopName": "seven-eleven",
                    "shopDetail": "",
                    "shopFloor": 0,
                    "mapLat": 0,
                    "mapLong": 0,
                    "mallFloorId": "5b34bc381a58da6a606c9c8e",
                    "shopAssetId": "",
                    "shopLogo": "",
                    "createAt": "0001-01-01T00:00:00Z",
                    "lastModified": "0001-01-01T00:00:00Z"
                }
            }
        ],
        "pageIndex": 0,
        "pageLimit": 10,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        }
    },
    "isSuccess": true
}

[x] 9.1.4 By PlayerId

POST /api/v1/channel/byPlayer/{id: string}?page=0&limit=10

Query parameters:

Field Description Optional Default
id ID of this player No
page Current channel Yes 0
limit Maximum channel Yes 10

Returns:

{
    "data": {
        "joinChannels": [
            {
                "_id": "5b3b4f790837132c9507202d",
                "channel": {
                    "_id": "5b3afe400837131c5579cf70",
                    "capacity": 25,
                    "channelName": "create-channel-with-shop",
                    "channelPassword": "bbbb",
                    "createAt": "2018-07-03T04:40:32.452Z",
                    "isAuto": true,
                    "maxCapacity": 25,
                    "shopId": "5b34bbe41a58da6a606c9c89"
                },
                "channelId": "5b3afe400837131c5579cf70",
                "createAt": "2018-07-03T10:27:05.745Z",
                "joinDateTime": "2018-07-03T10:27:05.745Z",
                "mPlayerId": "5b35ee0508371345dc8e4dff",
                "playerId": "5b306dbdbdfdd84f1fae8b40"
            }
        ],
        "pageIndex": 0,
        "pageLimit": 10,
        "pages": 1,
        "paging": {
            "next": "",
            "previous": ""
        }
    },
    "isSuccess": true
}

[x] 9.2 Create channel

POST /api/v1/channel/create

JSON body:

Field Description Optional Default Auth
joinNow Can join or not No false Yes
mPlayerId ID of the monster No -1 Yes
channel Channel info No - Yes

Channel Info:

Field Description Default Optional
channelName Name of the channel - No
channelPassword Password of the channel - No
isAuto Auto generate or not true Yes
shopId ID of the shop - Yes
maxCapacity Max count of channel 25 Yes

Returns:

{
    "data": {
        "id": "5b39c2a10837135993b36657",
        "channelName": "test-channel",
        "channelPassword": "aaaa",
        "isAuto": false,
        "shopId": 0,
        "maxCapacity": 25,
        "createAt": "2018-07-02T06:13:53.233Z",
        "lastModified": "0001-01-01T00:00:00Z"
    },
    "isSuccess": true
}

[x] 9.3 Join channel

POST /api/v1/channel/join

Form data:

Field Description Optional Auth
channelId ID of the channel No Yes
mPlayerId monster's ID of the player No Yes

Returns:

{
    "data": {
        "isJoin": true,
        "joinChannel": {
            "id": "5b39ecdf08371382e64450c0",
            "channelId": "5b39c2a10837135993b36657",
            "playerId": "5b306dbdbdfdd84f1fae8b40",
            "mPlayerId": "5b35ee0508371345dc8e4dff",
            "joinDateTime": "2018-07-02T09:14:07.703Z",
            "createAt": "2018-07-02T09:14:07.703Z",
            "lastModified": "0001-01-01T00:00:00Z"
        }
    },
    "isSuccess": true
}

[x] 9.4 Monster leave channel

POST /api/v1/channel/monsterLeave  

Form data:

Field Description Optional Auth
channelId ID of the Channel No Yes
mPlayerId Monster's ID of the player No Yes

Returns:

{
    "data": {
        "isMonsterLeave": true,
        "isRemoveChannel": true
    },
    "isSuccess": true
}

Clone this wiki locally