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/NotificationsApi.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/NotificationsApi.kt')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt index 86c34d0..1f0d744 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt @@ -16,7 +16,7 @@ import mx.trackermap.TrackerMap.client.models.NotificationType import mx.trackermap.TrackerMap.client.infrastructure.* -class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { +class NotificationsApi : ApiClient() { /** * Fetch a list of Notifications @@ -29,18 +29,18 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") * @return kotlin.Array<Notification> */ @Suppress("UNCHECKED_CAST") - suspend fun notificationsGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.Array<Notification> { + suspend fun notificationsGet(all: Boolean? = null, userId: Int? = null, deviceId: Int? = null, groupId: Int? = null, refresh: Boolean? = null): Array<Notification> { val localVariableQuery: MultiValueMap = mapOf("all" to listOf("$all"), "userId" to listOf("$userId"), "deviceId" to listOf("$deviceId"), "groupId" to listOf("$groupId"), "refresh" to listOf("$refresh")) val localVariableConfig = RequestConfig( RequestMethod.GET, "/notifications", query = localVariableQuery ) - val response = request<kotlin.Array<Notification>>( + val response = request<Array<Notification>>( localVariableConfig ) return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Notification> + ResponseType.Success -> (response as Success<*>).data as Array<Notification> ResponseType.Informational -> TODO() ResponseType.Redirection -> TODO() ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") @@ -53,7 +53,7 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") * @param id * @return void */ - suspend fun notificationsIdDelete(id: kotlin.Int): Unit { + suspend fun notificationsIdDelete(id: Int) { val localVariableConfig = RequestConfig( RequestMethod.DELETE, @@ -79,8 +79,8 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") * @return Notification */ @Suppress("UNCHECKED_CAST") - suspend fun notificationsIdPut(body: Notification, id: kotlin.Int): Notification { - val localVariableBody: kotlin.Any? = body + suspend fun notificationsIdPut(body: Notification, id: Int): Notification { + val localVariableBody: Any = body val localVariableConfig = RequestConfig( RequestMethod.PUT, @@ -106,7 +106,7 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") */ @Suppress("UNCHECKED_CAST") suspend fun notificationsPost(body: Notification): Notification { - val localVariableBody: kotlin.Any? = body + val localVariableBody: Any = body val localVariableConfig = RequestConfig( RequestMethod.POST, @@ -129,7 +129,7 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") * * @return void */ - suspend fun notificationsTestPost(): Unit { + suspend fun notificationsTestPost(){ val localVariableConfig = RequestConfig( RequestMethod.POST, @@ -153,18 +153,18 @@ class NotificationsApi(basePath: kotlin.String = "https://demo.traccar.org/api") * @return kotlin.Array<NotificationType> */ @Suppress("UNCHECKED_CAST") - suspend fun notificationsTypesGet(): kotlin.Array<NotificationType> { + suspend fun notificationsTypesGet(): Array<NotificationType> { val localVariableConfig = RequestConfig( RequestMethod.GET, "/notifications/types" ) - val response = request<kotlin.Array<NotificationType>>( + val response = request<Array<NotificationType>>( localVariableConfig ) return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as kotlin.Array<NotificationType> + ResponseType.Success -> (response as Success<*>).data as Array<NotificationType> ResponseType.Informational -> TODO() ResponseType.Redirection -> TODO() ResponseType.ClientError -> throw ClientException((response as ClientError<*>).body as? String ?: "Client error") |