summaryrefslogtreecommitdiff
path: root/src/api/routes/rooms.js
blob: 1a7a7453f2b7017c96b64c5d090e7934e6031e4b (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
46
import {sendRequest} from "../index";
import {deleteById, getById} from "./util";

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: {}
        }
    });
}