diff options
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt index eb1718c..fc9e865 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt @@ -56,108 +56,6 @@ class CommandsApi(sessionManager: SessionManager) : ApiClient(sessionManager), I } } /** - * Delete a Saved Command - * - * @param id - * @return void - */ - suspend fun commandsIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/commands/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Any?>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } - /** - * Update a Saved Command - * - * @param body - * @param id - * @return Command - */ - @Suppress("UNCHECKED_CAST") - suspend fun commandsIdPut(body: Command, id: Int): Command { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/commands/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Command>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Command - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } - /** - * Create a Saved Command - * - * @param body - * @return Command - */ - @Suppress("UNCHECKED_CAST") - suspend fun commandsPost(body: Command): Command { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/commands" - ) - val response = request<Command>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Command - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } - /** - * Fetch a list of Saved Commands supported by Device at the moment - * Return a list of saved commands linked to Device and its groups, filtered by current Device protocol support - * @param deviceId Standard users can use this only with _deviceId_s, they have access to (optional) - * @return kotlin.Array<Command> - */ - @Suppress("UNCHECKED_CAST") - suspend fun commandsSendGet(deviceId: Int? = null): Array<Command> { - val localVariableQuery: MultiValueMap = mapOf("deviceId" to listOf("$deviceId")) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/commands/send", query = localVariableQuery - ) - val response = request<Array<Command>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Command> - ResponseType.Informational -> TODO() - ResponseType.Redirection -> TODO() - ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } - /** * Dispatch commands to device * Dispatch a new command or Saved Command if _body.id_ set * @param body |