diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-20 20:43:14 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-20 20:43:14 -0600 |
commit | 7da841d2de9ac0526c3863e85d7d603facabb95c (patch) | |
tree | 57f9ad1386fe89d622f4c219d1dc25d0637f5860 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt | |
parent | d3fbda46d35ef58deb8c8965a2c6f937f204d980 (diff) | |
download | etbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.tar.gz etbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.tar.bz2 etbsa-trackermap-mobile-7da841d2de9ac0526c3863e85d7d603facabb95c.zip |
Implemented feature to switch to different Traccar servers by URL and removed annoying auto-generated redundant qualifiers
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 | 30 |
1 files changed, 15 insertions, 15 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 e840888..f00bc93 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 @@ -16,7 +16,7 @@ import mx.trackermap.TrackerMap.client.models.CommandType import mx.trackermap.TrackerMap.client.infrastructure.* -class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { +class CommandsApi : ApiClient() { /** * Fetch a list of Saved Commands @@ -29,7 +29,7 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap * @return kotlin.Array<Command> */ @Suppress("UNCHECKED_CAST") - suspend fun commandsGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.Array<Command> { + suspend fun commandsGet(all: Boolean? = null, userId: Int? = null, deviceId: Int? = null, groupId: Int? = null, refresh: Boolean? = null): Array<Command> { val query: MutableMap<String, List<String>> = mutableMapOf() all?.let { query["all"] = listOf("$it") } userId?.let { query["userId"] = listOf("$it") } @@ -42,12 +42,12 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap RequestMethod.GET, "/commands", query = localVariableQuery ) - val response = request<kotlin.Array<Command>>( + val response = request<Array<Command>>( localVariableConfig ) return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Command> + 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") @@ -60,7 +60,7 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap * @param id * @return void */ - suspend fun commandsIdDelete(id: kotlin.Int): Unit { + suspend fun commandsIdDelete(id: Int) { val localVariableConfig = RequestConfig( RequestMethod.DELETE, @@ -86,8 +86,8 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap * @return Command */ @Suppress("UNCHECKED_CAST") - suspend fun commandsIdPut(body: Command, id: kotlin.Int): Command { - val localVariableBody: kotlin.Any? = body + suspend fun commandsIdPut(body: Command, id: Int): Command { + val localVariableBody: Any = body val localVariableConfig = RequestConfig( RequestMethod.PUT, @@ -113,7 +113,7 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap */ @Suppress("UNCHECKED_CAST") suspend fun commandsPost(body: Command): Command { - val localVariableBody: kotlin.Any? = body + val localVariableBody: Any = body val localVariableConfig = RequestConfig( RequestMethod.POST, @@ -138,18 +138,18 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap * @return kotlin.Array<Command> */ @Suppress("UNCHECKED_CAST") - suspend fun commandsSendGet(deviceId: kotlin.Int? = null): kotlin.Array<Command> { + 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<kotlin.Array<Command>>( + val response = request<Array<Command>>( localVariableConfig ) return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Command> + 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") @@ -164,7 +164,7 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap */ @Suppress("UNCHECKED_CAST") suspend fun commandsSendPost(body: Command): Command { - val localVariableBody: kotlin.Any? = body + val localVariableBody: Any = body val localVariableConfig = RequestConfig( RequestMethod.POST, @@ -191,18 +191,18 @@ class CommandsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : Ap * @return kotlin.Array<CommandType> */ @Suppress("UNCHECKED_CAST") - suspend fun commandsTypesGet(deviceId: kotlin.Int? = null, protocol: kotlin.String? = null, textChannel: kotlin.Boolean? = null): kotlin.Array<CommandType> { + suspend fun commandsTypesGet(deviceId: Int? = null, protocol: String? = null, textChannel: Boolean? = null): Array<CommandType> { val localVariableQuery: MultiValueMap = mapOf("deviceId" to listOf("$deviceId"), "protocol" to listOf("$protocol"), "textChannel" to listOf("$textChannel")) val localVariableConfig = RequestConfig( RequestMethod.GET, "/commands/types", query = localVariableQuery ) - val response = request<kotlin.Array<CommandType>>( + val response = request<Array<CommandType>>( localVariableConfig ) return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array<CommandType> + ResponseType.Success -> (response as Success<*>).data as Array<CommandType> ResponseType.Informational -> TODO() ResponseType.Redirection -> TODO() ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") |