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 | 33bab0553bceaa174b11b3fb7a9ba9d4de63526a (patch) | |
tree | c308bb5b7ccb310cd57de815c93a7c200537d759 | |
parent | c7039b6b0f6ab0f99fefecac07196ada6da2221a (diff) | |
download | etbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.tar.gz etbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.tar.bz2 etbsa-trackermap-mobile-33bab0553bceaa174b11b3fb7a9ba9d4de63526a.zip |
Added Swagger auto-generated API client (no Ktor yet)
50 files changed, 3154 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") + } + } +} diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiAbstractions.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 0000000..f63f301 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,20 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +typealias MultiValueMap = Map<String, List<String>> + +fun collectionDelimiter(collectionFormat: String) = when (collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipes" -> "|" + "ssv" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun <T : Any?> toMultiValue(items: List<T>, collectionFormat: String, map: (item: Any?) -> String = defaultMultiValueConverter): List<String> { + return when (collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.map(map).joinToString(separator = collectionDelimiter(collectionFormat))) + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt new file mode 100644 index 0000000..aa4e45f --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiClient.kt @@ -0,0 +1,133 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import io.swagger.client.infrastructure.* +import okhttp3.* +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import java.io.File + +open class ApiClient(val baseUrl: String) { + companion object { + protected const val ContentType = "Content-Type" + protected const val Accept = "Accept" + protected const val JsonMediaType = "application/json" + protected const val FormDataMediaType = "multipart/form-data" + protected const val XmlMediaType = "application/xml" + + @JvmStatic + val client: OkHttpClient = OkHttpClient() + + @JvmStatic + var defaultHeaders: Map<String, String> by ApplicationDelegates.setOnce( + mapOf( + ContentType to JsonMediaType, + Accept to JsonMediaType + ) + ) + + @JvmStatic + val jsonHeaders: Map<String, String> = mapOf(ContentType to JsonMediaType, Accept to JsonMediaType) + } + + protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + when { + content is File -> RequestBody.create(mediaType.toMediaTypeOrNull(), content) + + mediaType == FormDataMediaType -> { + var builder = FormBody.Builder() + // content's type *must* be Map<String, Any> + @Suppress("UNCHECKED_CAST") + (content as Map<String, String>).forEach { key, value -> + builder = builder.add(key, value) + } + builder.build() + } + mediaType == JsonMediaType -> RequestBody.create( + mediaType.toMediaTypeOrNull(), Serializer.moshi.adapter(T::class.java).toJson(content) + ) + mediaType == XmlMediaType -> TODO("xml not currently supported.") + + // TODO: this should be extended with other serializers + else -> TODO("requestBody currently only supports JSON body and File body.") + } + + protected inline fun <reified T : Any?> responseBody(body: ResponseBody?, mediaType: String = JsonMediaType): T? { + if (body == null) return null + return when (mediaType) { + JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(body.source()) + else -> TODO() + } + } + + protected inline fun <reified T : Any?> request(requestConfig: RequestConfig, body: Any? = null): ApiInfrastructureResponse<T?> { + val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") + + var urlBuilder = httpUrl.newBuilder() + .addPathSegments(requestConfig.path.trimStart('/')) + + requestConfig.query.forEach { query -> + query.value.forEach { queryValue -> + urlBuilder = urlBuilder.addQueryParameter(query.key, queryValue) + } + } + + val url = urlBuilder.build() + val headers = requestConfig.headers + defaultHeaders + + if (headers[ContentType] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") + } + + if (headers[Accept] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Accept header. This is required.") + } + + // TODO: support multiple contentType,accept options here. + val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() + val accept = (headers[Accept] as String).substringBefore(";").toLowerCase() + + var request: Request.Builder = when (requestConfig.method) { + RequestMethod.DELETE -> Request.Builder().url(url).delete() + RequestMethod.GET -> Request.Builder().url(url) + RequestMethod.HEAD -> Request.Builder().url(url).head() + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) + RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) + } + + headers.forEach { header -> request = request.addHeader(header.key, header.value.toString()) } + + val realRequest = request.build() + val response = client.newCall(realRequest).execute() + + // TODO: handle specific mapping types. e.g. Map<int, Class<?>> + when { + response.isRedirect -> return Redirection( + response.code, + response.headers.toMultimap() + ) + response.isInformational -> return Informational( + response.message, + response.code, + response.headers.toMultimap() + ) + response.isSuccessful -> return Success( + responseBody(response.body, accept), + response.code, + response.headers.toMultimap() + ) + response.isClientError -> return ClientError( + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + else -> return ServerError( + null, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + } + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt new file mode 100644 index 0000000..bc0b4fb --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApiInfrastructureResponse.kt @@ -0,0 +1,40 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType) { + abstract val statusCode: Int + abstract val headers: Map<String, List<String>> +} + +class Success<T>( + val data: T, + override val statusCode: Int = -1, + override val headers: Map<String, List<String>> = mapOf() +) : ApiInfrastructureResponse<T>(ResponseType.Success) + +class Informational<T>( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map<String, List<String>> = mapOf() +) : ApiInfrastructureResponse<T>(ResponseType.Informational) + +class Redirection<T>( + override val statusCode: Int = -1, + override val headers: Map<String, List<String>> = mapOf() +) : ApiInfrastructureResponse<T>(ResponseType.Redirection) + +class ClientError<T>( + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map<String, List<String>> = mapOf() +) : ApiInfrastructureResponse<T>(ResponseType.ClientError) + +class ServerError<T>( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map<String, List<String>> +) : ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApplicationDelegates.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApplicationDelegates.kt new file mode 100644 index 0000000..7b91344 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ApplicationDelegates.kt @@ -0,0 +1,29 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty + +object ApplicationDelegates { + /** + * Provides a property delegate, allowing the property to be set once and only once. + * + * If unset (no default value), a get on the property will throw [IllegalStateException]. + */ + fun <T> setOnce(defaultValue: T? = null): ReadWriteProperty<Any?, T> = SetOnce(defaultValue) + + private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> { + private var isSet = false + private var value: T? = defaultValue + + override fun getValue(thisRef: Any?, property: KProperty<*>): T { + return value ?: throw IllegalStateException("${property.name} not initialized") + } + + override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { + if (!isSet) { + this.value = value + isSet = true + } + } + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Errors.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Errors.kt new file mode 100644 index 0000000..8932856 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Errors.kt @@ -0,0 +1,42 @@ +@file:Suppress("unused") +package mx.trackermap.TrackerMap.client.infrastructure + +import java.lang.RuntimeException + +open class ClientException : RuntimeException { + + /** + * Constructs an [ClientException] with no detail message. + */ + constructor() : super() + + /** + * Constructs an [ClientException] with the specified detail message. + + * @param message the detail message. + */ + constructor(message: kotlin.String) : super(message) + + companion object { + private const val serialVersionUID: Long = 123L + } +} + +open class ServerException : RuntimeException { + + /** + * Constructs an [ServerException] with no detail message. + */ + constructor() : super() + + /** + * Constructs an [ServerException] with the specified detail message. + + * @param message the detail message. + */ + constructor(message: kotlin.String) : super(message) + + companion object { + private const val serialVersionUID: Long = 456L + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateAdapter.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateAdapter.kt new file mode 100644 index 0000000..3aa236a --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,18 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class LocalDateAdapter { + @ToJson + fun toJson(value: LocalDate): String { + return DateTimeFormatter.ISO_LOCAL_DATE.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDate { + return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateTimeAdapter.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 0000000..3fbb237 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +class LocalDateTimeAdapter { + @ToJson + fun toJson(value: LocalDateTime): String { + return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDateTime { + return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } + +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestConfig.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestConfig.kt new file mode 100644 index 0000000..73205ff --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestConfig.kt @@ -0,0 +1,16 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map<String,String> because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: Map<String, String> = mapOf(), + val query: Map<String, List<String>> = mapOf() +)
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestMethod.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestMethod.kt new file mode 100644 index 0000000..f118678 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ResponseExtensions.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ResponseExtensions.kt new file mode 100644 index 0000000..61debbd --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/ResponseExtensions.kt @@ -0,0 +1,23 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import okhttp3.Response + +/** + * Provides an extension to evaluation whether the response is a 1xx code + */ +val Response.isInformational: Boolean get() = this.code in 100..199 + +/** + * Provides an extension to evaluation whether the response is a 3xx code + */ +val Response.isRedirect: Boolean get() = this.code in 300..399 + +/** + * Provides an extension to evaluation whether the response is a 4xx code + */ +val Response.isClientError: Boolean get() = this.code in 400..499 + +/** + * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code + */ +val Response.isServerError: Boolean get() = this.code in 500..999
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt new file mode 100644 index 0000000..9caf24f --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt @@ -0,0 +1,18 @@ +package mx.trackermap.TrackerMap.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory +import mx.trackermap.TrackerMap.client.infrastructure.LocalDateAdapter +import mx.trackermap.TrackerMap.client.infrastructure.LocalDateTimeAdapter +import java.util.Date + +object Serializer { + @JvmStatic + val moshi: Moshi = Moshi.Builder() + .add(KotlinJsonAdapterFactory()) + .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) + .add(LocalDateTimeAdapter()) + .add(LocalDateAdapter()) + .build() +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Attribute.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Attribute.kt new file mode 100644 index 0000000..0404967 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Attribute.kt @@ -0,0 +1,32 @@ +/** + * 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.models + + +/** + * + * @param id + * @param description + * @param attribute + * @param expression + * @param type String|Number|Boolean + */ +data class Attribute ( + + val id: kotlin.Int? = null, + val description: kotlin.String? = null, + val attribute: kotlin.String? = null, + val expression: kotlin.String? = null, + /* String|Number|Boolean */ + val type: kotlin.String? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Calendar.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Calendar.kt new file mode 100644 index 0000000..1718f0c --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Calendar.kt @@ -0,0 +1,30 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param `data` base64 encoded in iCalendar format + * @param attributes + */ +data class Calendar ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + /* base64 encoded in iCalendar format */ + val `data`: kotlin.String? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Command.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Command.kt new file mode 100644 index 0000000..e7e2716 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Command.kt @@ -0,0 +1,31 @@ +/** + * 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.models + + +/** + * + * @param id + * @param deviceId + * @param description + * @param type + * @param attributes + */ +data class Command ( + + val id: kotlin.Int? = null, + val deviceId: kotlin.Int? = null, + val description: kotlin.String? = null, + val type: kotlin.String? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/CommandType.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/CommandType.kt new file mode 100644 index 0000000..7b1a742 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/CommandType.kt @@ -0,0 +1,23 @@ +/** + * 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.models + + +/** + * + * @param type + */ +data class CommandType ( + + val type: kotlin.String? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Device.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Device.kt new file mode 100644 index 0000000..3729345 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Device.kt @@ -0,0 +1,50 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param uniqueId + * @param status + * @param disabled + * @param lastUpdate in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param positionId + * @param groupId + * @param phone + * @param model + * @param contact + * @param category + * @param geofenceIds + * @param attributes + */ +data class Device ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val uniqueId: kotlin.String? = null, + val status: kotlin.String? = null, + val disabled: kotlin.Boolean? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val lastUpdate: java.time.LocalDateTime? = null, + val positionId: kotlin.Int? = null, + val groupId: kotlin.Int? = null, + val phone: kotlin.String? = null, + val model: kotlin.String? = null, + val contact: kotlin.String? = null, + val category: kotlin.String? = null, + val geofenceIds: kotlin.Array<kotlin.Int>? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/DeviceAccumulators.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/DeviceAccumulators.kt new file mode 100644 index 0000000..43c8fb9 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/DeviceAccumulators.kt @@ -0,0 +1,28 @@ +/** + * 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.models + + +/** + * + * @param deviceId + * @param totalDistance in meters + * @param hours + */ +data class DeviceAccumulators ( + + val deviceId: kotlin.Int? = null, + /* in meters */ + val totalDistance: java.math.BigDecimal? = null, + val hours: java.math.BigDecimal? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Driver.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Driver.kt new file mode 100644 index 0000000..09d369b --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Driver.kt @@ -0,0 +1,29 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param uniqueId + * @param attributes + */ +data class Driver ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val uniqueId: kotlin.String? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Event.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Event.kt new file mode 100644 index 0000000..701252f --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Event.kt @@ -0,0 +1,38 @@ +/** + * 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.models + + +/** + * + * @param id + * @param type + * @param eventTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param deviceId + * @param positionId + * @param geofenceId + * @param maintenanceId + * @param attributes + */ +data class Event ( + + val id: kotlin.Int? = null, + val type: kotlin.String? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val eventTime: java.time.LocalDateTime? = null, + val deviceId: kotlin.Int? = null, + val positionId: kotlin.Int? = null, + val geofenceId: kotlin.Int? = null, + val maintenanceId: kotlin.Int? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Geofence.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Geofence.kt new file mode 100644 index 0000000..783786a --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Geofence.kt @@ -0,0 +1,33 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param description + * @param area + * @param calendarId + * @param attributes + */ +data class Geofence ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val description: kotlin.String? = null, + val area: kotlin.String? = null, + val calendarId: kotlin.Int? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Group.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Group.kt new file mode 100644 index 0000000..6c9d3b8 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Group.kt @@ -0,0 +1,29 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param groupId + * @param attributes + */ +data class Group ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val groupId: kotlin.Int? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Maintenance.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Maintenance.kt new file mode 100644 index 0000000..670d1e2 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Maintenance.kt @@ -0,0 +1,33 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param type + * @param start + * @param period + * @param attributes + */ +data class Maintenance ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val type: kotlin.String? = null, + val start: java.math.BigDecimal? = null, + val period: java.math.BigDecimal? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Notification.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Notification.kt new file mode 100644 index 0000000..50be5dd --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Notification.kt @@ -0,0 +1,37 @@ +/** + * 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.models + + +/** + * + * @param id + * @param type + * @param always + * @param web + * @param mail + * @param sms + * @param calendarId + * @param attributes + */ +data class Notification ( + + val id: kotlin.Int? = null, + val type: kotlin.String? = null, + val always: kotlin.Boolean? = null, + val web: kotlin.Boolean? = null, + val mail: kotlin.Boolean? = null, + val sms: kotlin.Boolean? = null, + val calendarId: kotlin.Int? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/NotificationType.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/NotificationType.kt new file mode 100644 index 0000000..55763ca --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/NotificationType.kt @@ -0,0 +1,23 @@ +/** + * 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.models + + +/** + * + * @param type + */ +data class NotificationType ( + + val type: kotlin.String? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Permission.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Permission.kt new file mode 100644 index 0000000..c4c236b --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Permission.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.models + + +/** + * This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 } + * @param userId User Id, can be only first parameter + * @param deviceId Device Id, can be first parameter or second only in combination with userId + * @param groupId Group Id, can be first parameter or second only in combination with userId + * @param geofenceId Geofence Id, can be second parameter only + * @param calendarId Calendar Id, can be second parameter only and only in combination with userId + * @param attributeId Computed Attribute Id, can be second parameter only + * @param driverId Driver Id, can be second parameter only + * @param managedUserId User Id, can be second parameter only and only in combination with userId + */ +data class Permission ( + + /* User Id, can be only first parameter */ + val userId: kotlin.Int? = null, + /* Device Id, can be first parameter or second only in combination with userId */ + val deviceId: kotlin.Int? = null, + /* Group Id, can be first parameter or second only in combination with userId */ + val groupId: kotlin.Int? = null, + /* Geofence Id, can be second parameter only */ + val geofenceId: kotlin.Int? = null, + /* Calendar Id, can be second parameter only and only in combination with userId */ + val calendarId: kotlin.Int? = null, + /* Computed Attribute Id, can be second parameter only */ + val attributeId: kotlin.Int? = null, + /* Driver Id, can be second parameter only */ + val driverId: kotlin.Int? = null, + /* User Id, can be second parameter only and only in combination with userId */ + val managedUserId: kotlin.Int? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt new file mode 100644 index 0000000..0ce4ed2 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt @@ -0,0 +1,59 @@ +/** + * 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.models + + +/** + * + * @param id + * @param deviceId + * @param protocol + * @param deviceTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param fixTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param serverTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param outdated + * @param valid + * @param latitude + * @param longitude + * @param altitude + * @param speed in knots + * @param course + * @param address + * @param accuracy + * @param network + * @param attributes + */ +data class Position ( + + val id: kotlin.Int? = null, + val deviceId: kotlin.Int? = null, + val protocol: kotlin.String? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val deviceTime: java.time.LocalDateTime? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val fixTime: java.time.LocalDateTime? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val serverTime: java.time.LocalDateTime? = null, + val outdated: kotlin.Boolean? = null, + val valid: kotlin.Boolean? = null, + val latitude: java.math.BigDecimal? = null, + val longitude: java.math.BigDecimal? = null, + val altitude: java.math.BigDecimal? = null, + /* in knots */ + val speed: java.math.BigDecimal? = null, + val course: java.math.BigDecimal? = null, + val address: kotlin.String? = null, + val accuracy: java.math.BigDecimal? = null, + val network: kotlin.Any? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportStops.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportStops.kt new file mode 100644 index 0000000..bdd4cbe --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportStops.kt @@ -0,0 +1,44 @@ +/** + * 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.models + + +/** + * + * @param deviceId + * @param deviceName + * @param duration + * @param startTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param address + * @param lat + * @param lon + * @param endTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param spentFuel in liters + * @param engineHours + */ +data class ReportStops ( + + val deviceId: kotlin.Int? = null, + val deviceName: kotlin.String? = null, + val duration: kotlin.Int? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val startTime: java.time.LocalDateTime? = null, + val address: kotlin.String? = null, + val lat: java.math.BigDecimal? = null, + val lon: java.math.BigDecimal? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val endTime: java.time.LocalDateTime? = null, + /* in liters */ + val spentFuel: java.math.BigDecimal? = null, + val engineHours: kotlin.Int? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportSummary.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportSummary.kt new file mode 100644 index 0000000..c6f59a6 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportSummary.kt @@ -0,0 +1,39 @@ +/** + * 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.models + + +/** + * + * @param deviceId + * @param deviceName + * @param maxSpeed in knots + * @param averageSpeed in knots + * @param distance in meters + * @param spentFuel in liters + * @param engineHours + */ +data class ReportSummary ( + + val deviceId: kotlin.Int? = null, + val deviceName: kotlin.String? = null, + /* in knots */ + val maxSpeed: java.math.BigDecimal? = null, + /* in knots */ + val averageSpeed: java.math.BigDecimal? = null, + /* in meters */ + val distance: java.math.BigDecimal? = null, + /* in liters */ + val spentFuel: java.math.BigDecimal? = null, + val engineHours: kotlin.Int? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportTrips.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportTrips.kt new file mode 100644 index 0000000..d7e9598 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/ReportTrips.kt @@ -0,0 +1,61 @@ +/** + * 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.models + + +/** + * + * @param deviceId + * @param deviceName + * @param maxSpeed in knots + * @param averageSpeed in knots + * @param distance in meters + * @param spentFuel in liters + * @param duration + * @param startTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param startAddress + * @param startLat + * @param startLon + * @param endTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param endAddress + * @param endLat + * @param endLon + * @param driverUniqueId + * @param driverName + */ +data class ReportTrips ( + + val deviceId: kotlin.Int? = null, + val deviceName: kotlin.String? = null, + /* in knots */ + val maxSpeed: java.math.BigDecimal? = null, + /* in knots */ + val averageSpeed: java.math.BigDecimal? = null, + /* in meters */ + val distance: java.math.BigDecimal? = null, + /* in liters */ + val spentFuel: java.math.BigDecimal? = null, + val duration: kotlin.Int? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val startTime: java.time.LocalDateTime? = null, + val startAddress: kotlin.String? = null, + val startLat: java.math.BigDecimal? = null, + val startLon: java.math.BigDecimal? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val endTime: java.time.LocalDateTime? = null, + val endAddress: kotlin.String? = null, + val endLat: java.math.BigDecimal? = null, + val endLon: java.math.BigDecimal? = null, + val driverUniqueId: kotlin.Int? = null, + val driverName: kotlin.String? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Server.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Server.kt new file mode 100644 index 0000000..24c7a20 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Server.kt @@ -0,0 +1,55 @@ +/** + * 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.models + + +/** + * + * @param id + * @param registration + * @param readonly + * @param deviceReadonly + * @param limitCommands + * @param map + * @param bingKey + * @param mapUrl + * @param poiLayer + * @param latitude + * @param longitude + * @param zoom + * @param twelveHourFormat + * @param version + * @param forceSettings + * @param coordinateFormat + * @param attributes + */ +data class Server ( + + val id: kotlin.Int? = null, + val registration: kotlin.Boolean? = null, + val readonly: kotlin.Boolean? = null, + val deviceReadonly: kotlin.Boolean? = null, + val limitCommands: kotlin.Boolean? = null, + val map: kotlin.String? = null, + val bingKey: kotlin.String? = null, + val mapUrl: kotlin.String? = null, + val poiLayer: kotlin.String? = null, + val latitude: java.math.BigDecimal? = null, + val longitude: java.math.BigDecimal? = null, + val zoom: kotlin.Int? = null, + val twelveHourFormat: kotlin.Boolean? = null, + val version: kotlin.String? = null, + val forceSettings: kotlin.Boolean? = null, + val coordinateFormat: kotlin.String? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Session_body.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Session_body.kt new file mode 100644 index 0000000..7958097 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Session_body.kt @@ -0,0 +1,25 @@ +/** + * 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.models + + +/** + * + * @param email + * @param password + */ +data class SessionBody ( + + val email: kotlin.String, + val password: kotlin.String +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Statistics.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Statistics.kt new file mode 100644 index 0000000..32027b9 --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Statistics.kt @@ -0,0 +1,34 @@ +/** + * 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.models + + +/** + * + * @param captureTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param activeUsers + * @param activeDevices + * @param requests + * @param messagesReceived + * @param messagesStored + */ +data class Statistics ( + + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val captureTime: java.time.LocalDateTime? = null, + val activeUsers: kotlin.Int? = null, + val activeDevices: kotlin.Int? = null, + val requests: kotlin.Int? = null, + val messagesReceived: kotlin.Int? = null, + val messagesStored: kotlin.Int? = null +) { +}
\ No newline at end of file diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/User.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/User.kt new file mode 100644 index 0000000..926ec9d --- /dev/null +++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/User.kt @@ -0,0 +1,66 @@ +/** + * 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.models + + +/** + * + * @param id + * @param name + * @param email + * @param phone + * @param readonly + * @param administrator + * @param map + * @param latitude + * @param longitude + * @param zoom + * @param password + * @param twelveHourFormat + * @param coordinateFormat + * @param disabled + * @param expirationTime in IS0 8601 format. eg. `1963-11-22T18:30:00Z` + * @param deviceLimit + * @param userLimit + * @param deviceReadonly + * @param limitCommands + * @param poiLayer + * @param token + * @param attributes + */ +data class User ( + + val id: kotlin.Int? = null, + val name: kotlin.String? = null, + val email: kotlin.String? = null, + val phone: kotlin.String? = null, + val readonly: kotlin.Boolean? = null, + val administrator: kotlin.Boolean? = null, + val map: kotlin.String? = null, + val latitude: java.math.BigDecimal? = null, + val longitude: java.math.BigDecimal? = null, + val zoom: kotlin.Int? = null, + val password: kotlin.String? = null, + val twelveHourFormat: kotlin.Boolean? = null, + val coordinateFormat: kotlin.String? = null, + val disabled: kotlin.Boolean? = null, + /* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */ + val expirationTime: java.time.LocalDateTime? = null, + val deviceLimit: kotlin.Int? = null, + val userLimit: kotlin.Int? = null, + val deviceReadonly: kotlin.Boolean? = null, + val limitCommands: kotlin.Boolean? = null, + val poiLayer: kotlin.String? = null, + val token: kotlin.String? = null, + val attributes: kotlin.Any? = null +) { +}
\ No newline at end of file |