aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-03 21:49:03 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-03 21:49:03 -0600
commit33bab0553bceaa174b11b3fb7a9ba9d4de63526a (patch)
treec308bb5b7ccb310cd57de815c93a7c200537d759 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
parentc7039b6b0f6ab0f99fefecac07196ada6da2221a (diff)
downloadetbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.tar.gz
etbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.tar.bz2
etbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.zip
Added Swagger auto-generated API client (no Ktor yet)
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt152
1 files changed, 152 insertions, 0 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
new file mode 100644
index 0000000..1582575
--- /dev/null
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt
@@ -0,0 +1,152 @@
+/**
+ * Traccar
+ * Traccar GPS tracking server API documentation. To use the API you need to have a server instance. For testing purposes you can use one of free [demo servers](https://www.traccar.org/demo-server/). For production use you can install your own server or get a [subscription service](https://www.traccar.org/product/tracking-server/).
+ *
+ * OpenAPI spec version: 4.14
+ * Contact: support@traccar.org
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+package mx.trackermap.TrackerMap.client.apis
+
+import mx.trackermap.TrackerMap.client.models.Device
+import mx.trackermap.TrackerMap.client.models.DeviceAccumulators
+
+import mx.trackermap.TrackerMap.client.infrastructure.*
+
+class DevicesApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) {
+
+ /**
+ * Fetch a list of Devices
+ * Without any params, returns a list of the user&#x27;s devices
+ * @param all Can only be used by admins or managers to fetch all entities (optional)
+ * @param userId Standard users can use this only with their own _userId_ (optional)
+ * @param id To fetch one or more devices. Multiple params can be passed like &#x60;id&#x3D;31&amp;id&#x3D;42&#x60; (optional)
+ * @param uniqueId To fetch one or more devices. Multiple params can be passed like &#x60;uniqueId&#x3D;333331&amp;uniqieId&#x3D;44442&#x60; (optional)
+ * @return kotlin.Array<Device>
+ */
+ @Suppress("UNCHECKED_CAST")
+ fun devicesGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, id: kotlin.Int? = null, uniqueId: kotlin.String? = null): kotlin.Array<Device> {
+ val localVariableQuery: MultiValueMap = mapOf("all" to listOf("$all"), "userId" to listOf("$userId"), "id" to listOf("$id"), "uniqueId" to listOf("$uniqueId"))
+ val localVariableConfig = RequestConfig(
+ RequestMethod.GET,
+ "/devices", query = localVariableQuery
+ )
+ val response = request<kotlin.Array<Device>>(
+ localVariableConfig
+ )
+
+ return when (response.responseType) {
+ ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Device>
+ 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 total distance and hours of the Device
+ *
+ * @param body
+ * @param id
+ * @return void
+ */
+ fun devicesIdAccumulatorsPut(body: DeviceAccumulators, id: kotlin.Int): Unit {
+ val localVariableBody: kotlin.Any? = body
+
+ val localVariableConfig = RequestConfig(
+ RequestMethod.PUT,
+ "/devices/{id}/accumulators".replace("{" + "id" + "}", "$id")
+ )
+ val response = request<Any?>(
+ localVariableConfig, localVariableBody
+ )
+
+ 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")
+ }
+ }
+ /**
+ * Delete a Device
+ *
+ * @param id
+ * @return void
+ */
+ fun devicesIdDelete(id: kotlin.Int): Unit {
+
+ val localVariableConfig = RequestConfig(
+ RequestMethod.DELETE,
+ "/devices/{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 Device
+ *
+ * @param body
+ * @param id
+ * @return Device
+ */
+ @Suppress("UNCHECKED_CAST")
+ fun devicesIdPut(body: Device, id: kotlin.Int): Device {
+ val localVariableBody: kotlin.Any? = body
+
+ val localVariableConfig = RequestConfig(
+ RequestMethod.PUT,
+ "/devices/{id}".replace("{" + "id" + "}", "$id")
+ )
+ val response = request<Device>(
+ localVariableConfig, localVariableBody
+ )
+
+ return when (response.responseType) {
+ ResponseType.Success -> (response as Success<*>).data as Device
+ 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 Device
+ *
+ * @param body
+ * @return Device
+ */
+ @Suppress("UNCHECKED_CAST")
+ fun devicesPost(body: Device): Device {
+ val localVariableBody: kotlin.Any? = body
+
+ val localVariableConfig = RequestConfig(
+ RequestMethod.POST,
+ "/devices"
+ )
+ val response = request<Device>(
+ localVariableConfig, localVariableBody
+ )
+
+ return when (response.responseType) {
+ ResponseType.Success -> (response as Success<*>).data as Device
+ 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")
+ }
+ }
+}