diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-12-14 20:10:30 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-12-14 20:10:30 -0600 |
commit | 5a9752eff691098d727420264c025f7f272c8ef1 (patch) | |
tree | c8aaa20e7295feb2c52c8f7059850fb8391aa814 /shared/src/commonMain | |
parent | d533c9684fb6b3f004656a7862c43e6cd9b69ede (diff) | |
parent | 1606ed48c1b3f39cfa0e45aab22658645a9b4118 (diff) | |
download | etbsa-trackermap-mobile-5a9752eff691098d727420264c025f7f272c8ef1.tar.gz etbsa-trackermap-mobile-5a9752eff691098d727420264c025f7f272c8ef1.tar.bz2 etbsa-trackermap-mobile-5a9752eff691098d727420264c025f7f272c8ef1.zip |
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
Diffstat (limited to 'shared/src/commonMain')
15 files changed, 0 insertions, 1484 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt deleted file mode 100644 index 1da9831..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt +++ /dev/null @@ -1,127 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Attribute - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class AttributesApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Attributes - * Without params, it returns a list of Attributes the user has access to - * @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 deviceId Standard users can use this only with _deviceId_s, they have access to (optional) - * @param groupId Standard users can use this only with _groupId_s, they have access to (optional) - * @param refresh (optional) - * @return kotlin.Array<Attribute> - */ - @Suppress("UNCHECKED_CAST") - suspend fun attributesComputedGet(all: Boolean? = null, userId: Int? = null, deviceId: Int? = null, groupId: Int? = null, refresh: Boolean? = null): Array<Attribute> { - 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, - "/attributes/computed", query = localVariableQuery - ) - val response = request<Array<Attribute>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Attribute> - 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 an Attribute - * - * @param id - * @return void - */ - suspend fun attributesComputedIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/attributes/computed/{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 an Attribute - * - * @param body - * @param id - * @return Attribute - */ - @Suppress("UNCHECKED_CAST") - suspend fun attributesComputedIdPut(body: Attribute, id: Int): Attribute { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/attributes/computed/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Attribute>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Attribute - 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 an Attribute - * - * @param body - * @return Attribute - */ - @Suppress("UNCHECKED_CAST") - suspend fun attributesComputedPost(body: Attribute): Attribute { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/attributes/computed" - ) - val response = request<Attribute>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Attribute - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt deleted file mode 100644 index c666dc3..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt +++ /dev/null @@ -1,124 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Calendar - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class CalendarsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Calendars - * Without params, it returns a list of Calendars the user has access to - * @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) - * @return kotlin.Array<Calendar> - */ - @Suppress("UNCHECKED_CAST") - suspend fun calendarsGet(all: Boolean? = null, userId: Int? = null): Array<Calendar> { - val localVariableQuery: MultiValueMap = mapOf("all" to listOf("$all"), "userId" to listOf("$userId")) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/calendars", query = localVariableQuery - ) - val response = request<Array<Calendar>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Calendar> - 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 Calendar - * - * @param id - * @return void - */ - suspend fun calendarsIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/calendars/{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 Calendar - * - * @param body - * @param id - * @return Calendar - */ - @Suppress("UNCHECKED_CAST") - suspend fun calendarsIdPut(body: Calendar, id: Int): Calendar { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/calendars/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Calendar>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Calendar - 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 Calendar - * - * @param body - * @return Calendar - */ - @Suppress("UNCHECKED_CAST") - suspend fun calendarsPost(body: Calendar): Calendar { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/calendars" - ) - val response = request<Calendar>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Calendar - 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") - } - } -} 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 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 index 8b839aa..619853c 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DevicesApi.kt @@ -53,107 +53,4 @@ class DevicesApi(sessionManager: SessionManager) : ApiClient(sessionManager), In ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") } } - /** - * Update total distance and hours of the Device - * - * @param body - * @param id - * @return void - */ - suspend fun devicesIdAccumulatorsPut(body: DeviceAccumulators, id: Int) { - val localVariableBody: 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 - */ - suspend fun devicesIdDelete(id: Int) { - - 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") - suspend fun devicesIdPut(body: Device, id: Int): Device { - val localVariableBody: 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") - suspend fun devicesPost(body: Device): Device { - val localVariableBody: 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") - } - } } diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt deleted file mode 100644 index bff61c2..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt +++ /dev/null @@ -1,127 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Driver - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class DriversApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Drivers - * Without params, it returns a list of Drivers the user has access to - * @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 deviceId Standard users can use this only with _deviceId_s, they have access to (optional) - * @param groupId Standard users can use this only with _groupId_s, they have access to (optional) - * @param refresh (optional) - * @return kotlin.Array<Driver> - */ - @Suppress("UNCHECKED_CAST") - suspend fun driversGet(all: Boolean? = null, userId: Int? = null, deviceId: Int? = null, groupId: Int? = null, refresh: Boolean? = null): Array<Driver> { - 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, - "/drivers", query = localVariableQuery - ) - val response = request<Array<Driver>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Driver> - 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 Driver - * - * @param id - * @return void - */ - suspend fun driversIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/drivers/{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 Driver - * - * @param body - * @param id - * @return Driver - */ - @Suppress("UNCHECKED_CAST") - suspend fun driversIdPut(body: Driver, id: Int): Driver { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/drivers/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Driver>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Driver - 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 Driver - * - * @param body - * @return Driver - */ - @Suppress("UNCHECKED_CAST") - suspend fun driversPost(body: Driver): Driver { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/drivers" - ) - val response = request<Driver>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Driver - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt deleted file mode 100644 index 87f8dce..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Event - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class EventsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * - * - * @param id - * @return Event - */ - @Suppress("UNCHECKED_CAST") - suspend fun eventsIdGet(id: Int): Event { - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/events/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Event>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Event - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt index 049aee9..f4a6bff 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt @@ -54,81 +54,5 @@ class GeofencesApi(sessionManager: SessionManager) : ApiClient(sessionManager), ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") } } - /** - * Delete a Geofence - * - * @param id - * @return void - */ - suspend fun geofencesIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/geofences/{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 Geofence - * - * @param body - * @param id - * @return Geofence - */ - @Suppress("UNCHECKED_CAST") - suspend fun geofencesIdPut(body: Geofence, id: Int): Geofence { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/geofences/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Geofence>( - localVariableConfig, localVariableBody - ) - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Geofence - 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 Geofence - * - * @param body - * @return Geofence - */ - @Suppress("UNCHECKED_CAST") - suspend fun geofencesPost(body: Geofence): Geofence { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/geofences" - ) - val response = request<Geofence>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Geofence - 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") - } - } } diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt deleted file mode 100644 index 07b3b05..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt +++ /dev/null @@ -1,124 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Group - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class GroupsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Groups - * Without any params, returns a list of the Groups the user belongs to - * @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) - * @return kotlin.Array<Group> - */ - @Suppress("UNCHECKED_CAST") - suspend fun groupsGet(all: Boolean? = null, userId: Int? = null): Array<Group> { - val localVariableQuery: MultiValueMap = mapOf("all" to listOf("$all"), "userId" to listOf("$userId")) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/groups", query = localVariableQuery - ) - val response = request<Array<Group>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Group> - 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 Group - * - * @param id - * @return void - */ - suspend fun groupsIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/groups/{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 Group - * - * @param body - * @param id - * @return Group - */ - @Suppress("UNCHECKED_CAST") - suspend fun groupsIdPut(body: Group, id: Int): Group { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/groups/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Group>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Group - 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 Group - * - * @param body - * @return Group - */ - @Suppress("UNCHECKED_CAST") - suspend fun groupsPost(body: Group): Group { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/groups" - ) - val response = request<Group>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Group - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt deleted file mode 100644 index e28a728..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt +++ /dev/null @@ -1,127 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Maintenance - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class MaintenanceApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Maintenance - * Without params, it returns a list of Maintenance the user has access to - * @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 deviceId Standard users can use this only with _deviceId_s, they have access to (optional) - * @param groupId Standard users can use this only with _groupId_s, they have access to (optional) - * @param refresh (optional) - * @return kotlin.Array<Maintenance> - */ - @Suppress("UNCHECKED_CAST") - suspend fun maintenanceGet(all: Boolean? = null, userId: Int? = null, deviceId: Int? = null, groupId: Int? = null, refresh: Boolean? = null): Array<Maintenance> { - 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, - "/maintenance", query = localVariableQuery - ) - val response = request<Array<Maintenance>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Maintenance> - 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 Maintenance - * - * @param id - * @return void - */ - suspend fun maintenanceIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/maintenance/{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 Maintenance - * - * @param body - * @param id - * @return Maintenance - */ - @Suppress("UNCHECKED_CAST") - suspend fun maintenanceIdPut(body: Maintenance, id: Int): Maintenance { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/maintenance/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Maintenance>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Maintenance - 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 Maintenance - * - * @param body - * @return Maintenance - */ - @Suppress("UNCHECKED_CAST") - suspend fun maintenancePost(body: Maintenance): Maintenance { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/maintenance" - ) - val response = request<Maintenance>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Maintenance - 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") - } - } -} 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 deleted file mode 100644 index f311fdb..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt +++ /dev/null @@ -1,175 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Notification -import mx.trackermap.TrackerMap.client.models.NotificationType - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class NotificationsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Notifications - * Without params, it returns a list of Notifications the user has access to - * @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 deviceId Standard users can use this only with _deviceId_s, they have access to (optional) - * @param groupId Standard users can use this only with _groupId_s, they have access to (optional) - * @param refresh (optional) - * @return kotlin.Array<Notification> - */ - @Suppress("UNCHECKED_CAST") - 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<Array<Notification>>( - localVariableConfig - ) - - return when (response.responseType) { - 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") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } - /** - * Delete a Notification - * - * @param id - * @return void - */ - suspend fun notificationsIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/notifications/{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 Notification - * - * @param body - * @param id - * @return Notification - */ - @Suppress("UNCHECKED_CAST") - suspend fun notificationsIdPut(body: Notification, id: Int): Notification { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/notifications/{id}".replace("{" + "id" + "}", "$id") - ) - val response = request<Notification>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Notification - 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 Notification - * - * @param body - * @return Notification - */ - @Suppress("UNCHECKED_CAST") - suspend fun notificationsPost(body: Notification): Notification { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/notifications" - ) - val response = request<Notification>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Notification - 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") - } - } - /** - * Send test notification to current user via Email and SMS - * - * @return void - */ - suspend fun notificationsTestPost(){ - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/notifications/test" - ) - 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") - } - } - /** - * Fetch a list of available Notification types - * - * @return kotlin.Array<NotificationType> - */ - @Suppress("UNCHECKED_CAST") - suspend fun notificationsTypesGet(): Array<NotificationType> { - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/notifications/types" - ) - val response = request<Array<NotificationType>>( - localVariableConfig - ) - - return when (response.responseType) { - 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") - ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt deleted file mode 100644 index 76fd4a8..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Permission - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class PermissionsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Unlink an Object from another Object - * - * @param body - * @return void - */ - suspend fun permissionsDelete(body: Permission) { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/permissions" - ) - 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") - } - } - /** - * Link an Object to another Object - * - * @param body - * @return Permission - */ - @Suppress("UNCHECKED_CAST") - suspend fun permissionsPost(body: Permission): Permission { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/permissions" - ) - val response = request<Permission>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Permission - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt index 64ef8ea..ec92526 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt @@ -238,90 +238,4 @@ class ReportsApi(sessionManager: SessionManager) : ApiClient(sessionManager), In ): ByteArray { return reportsStopsGetBase(from, to, deviceId, true) as ByteArray } - - /** - * Fetch a list of ReportSummary within the time period for the Devices or Groups - * At least one _deviceId_ or one _groupId_ must be passed - * @param from in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @param to in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @param deviceId (optional) - * @param groupId (optional) - * @return kotlin.Array<ReportSummary> - */ - @Suppress("UNCHECKED_CAST") - suspend fun reportsSummaryGet( - from: LocalDateTime, - to: LocalDateTime, - deviceId: Array<Int>? = null, - groupId: Array<Int>? = null - ): Array<ReportSummary> { - val localVariableQuery: MultiValueMap = mapOf( - "deviceId" to toMultiValue(deviceId!!.toList(), "multi"), - "groupId" to toMultiValue(groupId!!.toList(), "multi"), - "from" to listOf("$from"), - "to" to listOf("$to") - ) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/reports/summary", query = localVariableQuery - ) - val response = request<Array<ReportSummary>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<ReportSummary> - 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 ReportTrips within the time period for the Devices or Groups - * At least one _deviceId_ or one _groupId_ must be passed - * @param from in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @param to in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @param deviceId (optional) - * @param groupId (optional) - * @return kotlin.Array<ReportTrips> - */ - @Suppress("UNCHECKED_CAST") - suspend fun reportsTripsGet( - from: LocalDateTime, - to: LocalDateTime, - deviceId: Array<Int>? = null, - groupId: Array<Int>? = null - ): Array<ReportTrips> { - val localVariableQuery: MultiValueMap = mapOf( - "deviceId" to toMultiValue(deviceId!!.toList(), "multi"), - "groupId" to toMultiValue(groupId!!.toList(), "multi"), - "from" to listOf("$from"), - "to" to listOf("$to") - ) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/reports/trips", query = localVariableQuery - ) - val response = request<Array<ReportTrips>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<ReportTrips> - 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" - ) - } - } } diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt deleted file mode 100644 index 5672543..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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.Injectable -import mx.trackermap.TrackerMap.client.models.Server - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class ServerApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch Server information - * - * @return Server - */ - @Suppress("UNCHECKED_CAST") - suspend fun serverGet(): Server { - - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/server" - ) - val response = request<Server>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Server - 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 Server information - * - * @param body - * @return Server - */ - @Suppress("UNCHECKED_CAST") - suspend fun serverPut(body: Server): Server { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.PUT, - "/server" - ) - val response = request<Server>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Server - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt deleted file mode 100644 index 0b9c766..0000000 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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 kotlinx.datetime.LocalDateTime -import mx.trackermap.TrackerMap.Injectable -import mx.trackermap.TrackerMap.client.models.Statistics - -import mx.trackermap.TrackerMap.client.infrastructure.* - -class StatisticsApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch server Statistics - * - * @param from in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @param to in IS0 8601 format. eg. `1963-11-22T18:30:00Z` - * @return kotlin.Array<Statistics> - */ - @Suppress("UNCHECKED_CAST") - suspend fun statisticsGet(from: LocalDateTime, to: LocalDateTime): Array<Statistics> { - val localVariableQuery: MultiValueMap = mapOf("from" to listOf("$from"), "to" to listOf("$to")) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/statistics", query = localVariableQuery - ) - val response = request<Array<Statistics>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<Statistics> - 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") - } - } -} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt index 90dd9f6..cccc247 100644 --- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt @@ -17,56 +17,6 @@ import mx.trackermap.TrackerMap.client.models.User import mx.trackermap.TrackerMap.client.infrastructure.* class UsersApi(sessionManager: SessionManager) : ApiClient(sessionManager), Injectable { - - /** - * Fetch a list of Users - * - * @param userId Can only be used by admin or manager users (optional) - * @return kotlin.Array<User> - */ - @Suppress("UNCHECKED_CAST") - suspend fun usersGet(userId: String? = null): Array<User> { - val localVariableQuery: MultiValueMap = mapOf("userId" to listOf("$userId")) - val localVariableConfig = RequestConfig( - RequestMethod.GET, - "/users", query = localVariableQuery - ) - val response = request<Array<User>>( - localVariableConfig - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as Array<User> - 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 User - * - * @param id - * @return void - */ - suspend fun usersIdDelete(id: Int) { - - val localVariableConfig = RequestConfig( - RequestMethod.DELETE, - "/users/{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 User * @@ -93,30 +43,4 @@ class UsersApi(sessionManager: SessionManager) : ApiClient(sessionManager), Inje ResponseType.ServerError -> throw ServerException((response as ServerError<*>).message ?: "Server error") } } - /** - * Create a User - * - * @param body - * @return User - */ - @Suppress("UNCHECKED_CAST") - suspend fun usersPost(body: User): User { - val localVariableBody: Any = body - - val localVariableConfig = RequestConfig( - RequestMethod.POST, - "/users" - ) - val response = request<User>( - localVariableConfig, localVariableBody - ) - - return when (response.responseType) { - ResponseType.Success -> (response as Success<*>).data as User - 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") - } - } } |