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 /shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt | |
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)
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt')
-rw-r--r-- | shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/apis/ReportsApi.kt | 165 |
1 files changed, 165 insertions, 0 deletions
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") + } + } +} |