diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-03 21:49:03 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-03 21:49:03 -0600 |
commit | 0a7f77b8cb2ed308c8f5e8cbf79d769bc3324c06 (patch) | |
tree | c308bb5b7ccb310cd57de815c93a7c200537d759 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis | |
parent | c7039b6b0f6ab0f99fefecac07196ada6da2221a (diff) | |
download | etbsa-trackermap-mobile-0a7f77b8cb2ed308c8f5e8cbf79d769bc3324c06.tar.gz etbsa-trackermap-mobile-0a7f77b8cb2ed308c8f5e8cbf79d769bc3324c06.tar.bz2 etbsa-trackermap-mobile-0a7f77b8cb2ed308c8f5e8cbf79d769bc3324c06.zip |
Added Swagger auto-generated API client (no Ktor yet)
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis')
17 files changed, 1944 insertions, 0 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 new file mode 100644 index 0000000..a1d31b0 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/AttributesApi.kt @@ -0,0 +1,126 @@ +/** + * 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.Attribute + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class AttributesApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun attributesComputedGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.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<kotlin.Array<Attribute>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun attributesComputedIdDelete(id: kotlin.Int): Unit { + + 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") + fun attributesComputedIdPut(body: Attribute, id: kotlin.Int): Attribute { + val localVariableBody: kotlin.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") + fun attributesComputedPost(body: Attribute): Attribute { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..06538b3 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CalendarsApi.kt @@ -0,0 +1,123 @@ +/** + * 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.Calendar + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class CalendarsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun calendarsGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null): kotlin.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<kotlin.Array<Calendar>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun calendarsIdDelete(id: kotlin.Int): Unit { + + 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") + fun calendarsIdPut(body: Calendar, id: kotlin.Int): Calendar { + val localVariableBody: kotlin.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") + fun calendarsPost(body: Calendar): Calendar { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..a1ef21f --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/CommandsApi.kt @@ -0,0 +1,205 @@ +/** + * 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.Command +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) { + + /** + * Fetch a list of Saved Commands + * Without params, it returns a list of Saved Commands 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<Command> + */ + @Suppress("UNCHECKED_CAST") + 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> { + 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, + "/commands", query = localVariableQuery + ) + val response = request<kotlin.Array<Command>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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") + } + } + /** + * Delete a Saved Command + * + * @param id + * @return void + */ + fun commandsIdDelete(id: kotlin.Int): Unit { + + 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") + fun commandsIdPut(body: Command, id: kotlin.Int): Command { + val localVariableBody: kotlin.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") + fun commandsPost(body: Command): Command { + val localVariableBody: kotlin.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") + fun commandsSendGet(deviceId: kotlin.Int? = null): kotlin.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>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + * @return Command + */ + @Suppress("UNCHECKED_CAST") + fun commandsSendPost(body: Command): Command { + val localVariableBody: kotlin.Any? = body + + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/commands/send" + ) + 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 available Commands for the Device or all possible Commands if Device ommited + * + * @param deviceId Internal device identifier. Only works if device has already reported some locations (optional) + * @param protocol Protocol name. Can be used instead of device id (optional) + * @param textChannel When `true` return SMS commands. If not specified or `false` return data commands (optional) + * @return kotlin.Array<CommandType> + */ + @Suppress("UNCHECKED_CAST") + fun commandsTypesGet(deviceId: kotlin.Int? = null, protocol: kotlin.String? = null, textChannel: kotlin.Boolean? = null): kotlin.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>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<CommandType> + 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/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'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 `id=31&id=42` (optional) + * @param uniqueId To fetch one or more devices. Multiple params can be passed like `uniqueId=333331&uniqieId=44442` (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") + } + } +} 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 new file mode 100644 index 0000000..52ae586 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/DriversApi.kt @@ -0,0 +1,126 @@ +/** + * 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.Driver + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class DriversApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun driversGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.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<kotlin.Array<Driver>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun driversIdDelete(id: kotlin.Int): Unit { + + 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") + fun driversIdPut(body: Driver, id: kotlin.Int): Driver { + val localVariableBody: kotlin.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") + fun driversPost(body: Driver): Driver { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..14d7c89 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/EventsApi.kt @@ -0,0 +1,45 @@ +/** + * 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.Event + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class EventsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * + * + * @param id + * @return Event + */ + @Suppress("UNCHECKED_CAST") + fun eventsIdGet(id: kotlin.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 new file mode 100644 index 0000000..946ec90 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GeofencesApi.kt @@ -0,0 +1,126 @@ +/** + * 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.Geofence + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class GeofencesApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Fetch a list of Geofences + * Without params, it returns a list of Geofences 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<Geofence> + */ + @Suppress("UNCHECKED_CAST") + fun geofencesGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.Array<Geofence> { + 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, + "/geofences", query = localVariableQuery + ) + val response = request<kotlin.Array<Geofence>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<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") + } + } + /** + * Delete a Geofence + * + * @param id + * @return void + */ + fun geofencesIdDelete(id: kotlin.Int): Unit { + + 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") + fun geofencesIdPut(body: Geofence, id: kotlin.Int): Geofence { + val localVariableBody: kotlin.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") + fun geofencesPost(body: Geofence): Geofence { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..b670fa2 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/GroupsApi.kt @@ -0,0 +1,123 @@ +/** + * 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.Group + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class GroupsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun groupsGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null): kotlin.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<kotlin.Array<Group>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun groupsIdDelete(id: kotlin.Int): Unit { + + 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") + fun groupsIdPut(body: Group, id: kotlin.Int): Group { + val localVariableBody: kotlin.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") + fun groupsPost(body: Group): Group { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..fe7f635 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/MaintenanceApi.kt @@ -0,0 +1,126 @@ +/** + * 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.Maintenance + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class MaintenanceApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun maintenanceGet(all: kotlin.Boolean? = null, userId: kotlin.Int? = null, deviceId: kotlin.Int? = null, groupId: kotlin.Int? = null, refresh: kotlin.Boolean? = null): kotlin.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<kotlin.Array<Maintenance>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun maintenanceIdDelete(id: kotlin.Int): Unit { + + 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") + fun maintenanceIdPut(body: Maintenance, id: kotlin.Int): Maintenance { + val localVariableBody: kotlin.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") + fun maintenancePost(body: Maintenance): Maintenance { + val localVariableBody: kotlin.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 new file mode 100644 index 0000000..f86d191 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/NotificationsApi.kt @@ -0,0 +1,174 @@ +/** + * 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.Notification +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) { + + /** + * 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") + 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> { + 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>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun notificationsIdDelete(id: kotlin.Int): Unit { + + 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") + fun notificationsIdPut(body: Notification, id: kotlin.Int): Notification { + val localVariableBody: kotlin.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") + fun notificationsPost(body: Notification): Notification { + val localVariableBody: kotlin.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 + */ + fun notificationsTestPost(): Unit { + + 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") + fun notificationsTypesGet(): kotlin.Array<NotificationType> { + + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/notifications/types" + ) + val response = request<kotlin.Array<NotificationType>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 new file mode 100644 index 0000000..29c18b4 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PermissionsApi.kt @@ -0,0 +1,71 @@ +/** + * 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.Permission + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class PermissionsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Unlink an Object from another Object + * + * @param body + * @return void + */ + fun permissionsDelete(body: Permission): Unit { + val localVariableBody: kotlin.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") + fun permissionsPost(body: Permission): Permission { + val localVariableBody: kotlin.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/PositionsApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt new file mode 100644 index 0000000..ed2c558 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/PositionsApi.kt @@ -0,0 +1,48 @@ +/** + * 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.Position + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class PositionsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Fetches a list of Positions + * We strongly recommend using [Traccar WebSocket API](https://www.traccar.org/traccar-api/) instead of periodically polling positions endpoint. Without any params, it returns a list of last known positions for all the user's Devices. _from_ and _to_ fields are not required with _id_. + * @param deviceId _deviceId_ is optional, but requires the _from_ and _to_ parameters when used (optional) + * @param from in IS0 8601 format. eg. `1963-11-22T18:30:00Z` (optional) + * @param to in IS0 8601 format. eg. `1963-11-22T18:30:00Z` (optional) + * @param id To fetch one or more positions. Multiple params can be passed like `id=31&id=42` (optional) + * @return kotlin.Array<Position> + */ + @Suppress("UNCHECKED_CAST") + fun positionsGet(deviceId: kotlin.Int? = null, from: java.time.LocalDateTime? = null, to: java.time.LocalDateTime? = null, id: kotlin.Int? = null): kotlin.Array<Position> { + val localVariableQuery: MultiValueMap = mapOf("deviceId" to listOf("$deviceId"), "from" to listOf("$from"), "to" to listOf("$to"), "id" to listOf("$id")) + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/positions", query = localVariableQuery + ) + val response = request<kotlin.Array<Position>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Position> + 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 new file mode 100644 index 0000000..e0a04d8 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt @@ -0,0 +1,165 @@ +/** + * 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.Event +import mx.trackermap.TrackerMap.client.models.Position +import mx.trackermap.TrackerMap.client.models.ReportStops +import mx.trackermap.TrackerMap.client.models.ReportSummary +import mx.trackermap.TrackerMap.client.models.ReportTrips + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class ReportsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Fetch a list of Events 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) + * @param type % can be used to return events of all types (optional) + * @return kotlin.Array<Event> + */ + @Suppress("UNCHECKED_CAST") + fun reportsEventsGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime, deviceId: kotlin.Array<kotlin.Int>? = null, groupId: kotlin.Array<kotlin.Int>? = null, type: kotlin.Array<kotlin.String>? = null): kotlin.Array<Event> { + val localVariableQuery: MultiValueMap = mapOf("deviceId" to toMultiValue(deviceId!!.toList(), "multi"), "groupId" to toMultiValue(groupId!!.toList(), "multi"), "type" to toMultiValue(type!!.toList(), "csv"), "from" to listOf("$from"), "to" to listOf("$to")) + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/reports/events", query = localVariableQuery + ) + val response = request<kotlin.Array<Event>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<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") + } + } + /** + * Fetch a list of Positions 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<Position> + */ + @Suppress("UNCHECKED_CAST") + fun reportsRouteGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime, deviceId: kotlin.Array<kotlin.Int>? = null, groupId: kotlin.Array<kotlin.Int>? = null): kotlin.Array<Position> { + 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/route", query = localVariableQuery + ) + val response = request<kotlin.Array<Position>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<Position> + 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 ReportStops 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<ReportStops> + */ + @Suppress("UNCHECKED_CAST") + fun reportsStopsGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime, deviceId: kotlin.Array<kotlin.Int>? = null, groupId: kotlin.Array<kotlin.Int>? = null): kotlin.Array<ReportStops> { + 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/stops", query = localVariableQuery + ) + val response = request<kotlin.Array<ReportStops>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.Array<ReportStops> + 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 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") + fun reportsSummaryGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime, deviceId: kotlin.Array<kotlin.Int>? = null, groupId: kotlin.Array<kotlin.Int>? = null): kotlin.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<kotlin.Array<ReportSummary>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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") + fun reportsTripsGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime, deviceId: kotlin.Array<kotlin.Int>? = null, groupId: kotlin.Array<kotlin.Int>? = null): kotlin.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<kotlin.Array<ReportTrips>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 new file mode 100644 index 0000000..3bd83f1 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ServerApi.kt @@ -0,0 +1,70 @@ +/** + * 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.Server + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class ServerApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Fetch Server information + * + * @return Server + */ + @Suppress("UNCHECKED_CAST") + 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") + fun serverPut(body: Server): Server { + val localVariableBody: kotlin.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/SessionApi.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt new file mode 100644 index 0000000..0cdc5e8 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/SessionApi.kt @@ -0,0 +1,96 @@ +/** + * 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.User + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class SessionApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Close the Session + * + * @return void + */ + fun sessionDelete(): Unit { + + val localVariableConfig = RequestConfig( + RequestMethod.DELETE, + "/session" + ) + 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 Session information + * + * @param token (optional) + * @return User + */ + @Suppress("UNCHECKED_CAST") + fun sessionGet(token: kotlin.String? = null): User { + val localVariableQuery: MultiValueMap = mapOf("token" to listOf("$token")) + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/session", query = localVariableQuery + ) + val response = request<User>( + localVariableConfig + ) + + 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") + } + } + /** + * Create a new Session + * + * @param email + * @param password + * @return User + */ + @Suppress("UNCHECKED_CAST") + fun sessionPost(email: kotlin.String, password: kotlin.String): User { + val localVariableBody: kotlin.Any? = mapOf("email" to "$email", "password" to "$password") + + val localVariableHeaders: kotlin.collections.Map<kotlin.String, kotlin.String> = mapOf("Content-Type" to "multipart/form-data") + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/session", headers = localVariableHeaders + ) + 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") + } + } +} 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 new file mode 100644 index 0000000..eb9dec4 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/StatisticsApi.kt @@ -0,0 +1,46 @@ +/** + * 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.Statistics + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class StatisticsApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * 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") + fun statisticsGet(from: java.time.LocalDateTime, to: java.time.LocalDateTime): kotlin.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<kotlin.Array<Statistics>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 new file mode 100644 index 0000000..8a426a8 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/UsersApi.kt @@ -0,0 +1,122 @@ +/** + * 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.User + +import mx.trackermap.TrackerMap.client.infrastructure.* + +class UsersApi(basePath: kotlin.String = "https://demo.traccar.org/api") : ApiClient(basePath) { + + /** + * Fetch a list of Users + * + * @param userId Can only be used by admin or manager users (optional) + * @return kotlin.Array<User> + */ + @Suppress("UNCHECKED_CAST") + fun usersGet(userId: kotlin.String? = null): kotlin.Array<User> { + val localVariableQuery: MultiValueMap = mapOf("userId" to listOf("$userId")) + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/users", query = localVariableQuery + ) + val response = request<kotlin.Array<User>>( + localVariableConfig + ) + + return when (response.responseType) { + ResponseType.Success -> (response as Success<*>).data as kotlin.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 + */ + fun usersIdDelete(id: kotlin.Int): Unit { + + 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 + * + * @param body + * @param id + * @return User + */ + @Suppress("UNCHECKED_CAST") + fun usersIdPut(body: User, id: kotlin.Int): User { + val localVariableBody: kotlin.Any? = body + + val localVariableConfig = RequestConfig( + RequestMethod.PUT, + "/users/{id}".replace("{" + "id" + "}", "$id") + ) + 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") + } + } + /** + * Create a User + * + * @param body + * @return User + */ + @Suppress("UNCHECKED_CAST") + fun usersPost(body: User): User { + val localVariableBody: kotlin.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") + } + } +} |