aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/controllers/CommandsController.kt
blob: 03ba5abfdd150beec91929ef536d9025123e2b21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package mx.trackermap.TrackerMap.controllers

import mx.trackermap.TrackerMap.Injectable
import mx.trackermap.TrackerMap.client.apis.CommandsApi
import mx.trackermap.TrackerMap.client.models.Command

class CommandsController(
    private val commandsApi: CommandsApi
): Injectable {
    suspend fun fetchCommands(deviceId: Int): List<Command> {
        return commandsApi.commandsGet(deviceId = deviceId).toList()
    }

    suspend fun sendCommand(command: Command) {
        commandsApi.commandsSendPost(command)
    }
}