11package org.nitri.ors.repository
22
3- import okhttp3.ResponseBody
43import org.nitri.ors.api.OpenRouteServiceApi
54import org.nitri.ors.model.route.GeoJsonRouteResponse
65import org.nitri.ors.model.route.RouteRequest
76import org.nitri.ors.model.route.RouteResponse
8- import retrofit2.Response
97
108class RouteRepository (private val api : OpenRouteServiceApi ) {
119 suspend fun getRoute (start : Pair <Double , Double >, end : Pair <Double , Double >, profile : String ): RouteResponse {
@@ -16,17 +14,17 @@ class RouteRepository(private val api: OpenRouteServiceApi) {
1614 return api.getRoute(profile, request)
1715 }
1816
19- suspend fun getRouteGpx (start : Pair <Double , Double >, end : Pair <Double , Double >, profile : String ): Response < ResponseBody > {
17+ suspend fun getRouteGpx (start : Pair <Double , Double >, end : Pair <Double , Double >, profile : String ): String {
2018 val request = RouteRequest (coordinates = listOf (
2119 listOf (start.first, start.second),
2220 listOf (end.first, end.second)
2321 ))
24- return api.getRouteGpx(profile, request)
22+ return api.getRouteGpx(profile, request).body()?.string() ? : " "
2523 }
2624
27- suspend fun getRouteGpx (coordinates : List <List <Double >>, language : String , profile : String ): Response < ResponseBody > {
25+ suspend fun getRouteGpx (coordinates : List <List <Double >>, language : String , profile : String ): String {
2826 val request = RouteRequest (coordinates = coordinates, language = language)
29- return api.getRouteGpx(profile, request)
27+ return api.getRouteGpx(profile, request).body()?.string() ? : " "
3028 }
3129
3230 suspend fun getRouteGeoJson (start : Pair <Double , Double >, end : Pair <Double , Double >, profile : String ): GeoJsonRouteResponse {
0 commit comments