summaryrefslogtreecommitdiff
path: root/src/api/routes/rooms.js
blob: e08cc6e71d47b62251e19a55dcb5532858f1e86b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import {sendRequest} from "../index";

export function getRoom(roomId) {
    return getById("/rooms/{roomId}", {roomId});
}

export function updateRoom(room) {
    return sendRequest({
        path: "/rooms/{roomId}",
        method: "PUT",
        parameters: {
            body: {
                room
            },
            path: {
                roomId: room.id
            },
            query: {}
        }
    });
}

export function deleteRoom(roomId) {
    return deleteById("/rooms/{roomId}", {roomId});
}

export function getTilesOfRoom(roomId) {
    return getById("/rooms/{roomId}/tiles", {roomId});
}

export function addTileToRoom(tile) {
    return sendRequest({
        path: "/rooms/{roomId}/tiles",
        method: "POST",
        parameters: {
            body: {
                tile
            },
            path: {
                roomId: tile.roomId
            },
            query: {}
        }
    });
}