11package api
22
3- import area_element.AreaElementJson
4- import area_element.toAreaElementsJson
53import element.Element
64import element.toElements
75import element_comment.ElementCommentJson
@@ -16,8 +14,6 @@ import okhttp3.OkHttpClient
1614import okhttp3.Request
1715import okhttp3.brotli.BrotliInterceptor
1816import okhttp3.coroutines.executeAsync
19- import reports.ReportJson
20- import reports.toReportsJson
2117import user.UserJson
2218import user.toUsersJson
2319import java.time.ZonedDateTime
@@ -35,11 +31,7 @@ interface Api {
3531
3632 suspend fun getEvents (): List <Event >
3733
38- suspend fun getReports (updatedSince : ZonedDateTime ? , limit : Long ): List <ReportJson >
39-
4034 suspend fun getUsers (updatedSince : ZonedDateTime ? , limit : Long ): List <UserJson >
41-
42- suspend fun getAreaElements (updatedSince : ZonedDateTime ? , limit : Long ): List <AreaElementJson >
4335}
4436
4537class ApiImpl (
@@ -124,25 +116,6 @@ class ApiImpl(
124116 }
125117 }
126118
127- override suspend fun getReports (updatedSince : ZonedDateTime ? , limit : Long ): List <ReportJson > {
128- val url = baseUrl.newBuilder().apply {
129- addPathSegment(" v3" )
130- addPathSegment(" reports" )
131- addQueryParameter(" updated_since" , updatedSince.apiFormat())
132- addQueryParameter(" limit" , " $limit " )
133- }.build()
134-
135- val res = httpClient.newCall(Request .Builder ().url(url).build()).executeAsync()
136-
137- if (! res.isSuccessful) {
138- throw Exception (" Unexpected HTTP response code: ${res.code} " )
139- }
140-
141- return withContext(Dispatchers .IO ) {
142- res.body.byteStream().use { it.toReportsJson() }
143- }
144- }
145-
146119 override suspend fun getUsers (updatedSince : ZonedDateTime ? , limit : Long ): List <UserJson > {
147120 val url = baseUrl.newBuilder().apply {
148121 addPathSegment(" v3" )
@@ -161,28 +134,6 @@ class ApiImpl(
161134 res.body.byteStream().use { it.toUsersJson() }
162135 }
163136 }
164-
165- override suspend fun getAreaElements (
166- updatedSince : ZonedDateTime ? ,
167- limit : Long
168- ): List <AreaElementJson > {
169- val url = baseUrl.newBuilder().apply {
170- addPathSegment(" v3" )
171- addPathSegment(" area-elements" )
172- addQueryParameter(" updated_since" , updatedSince.apiFormat())
173- addQueryParameter(" limit" , " $limit " )
174- }.build()
175-
176- val res = httpClient.newCall(Request .Builder ().url(url).build()).executeAsync()
177-
178- if (! res.isSuccessful) {
179- throw Exception (" Unexpected HTTP response code: ${res.code} " )
180- }
181-
182- return withContext(Dispatchers .IO ) {
183- res.body.byteStream().use { it.toAreaElementsJson() }
184- }
185- }
186137}
187138
188139private fun apiHttpClient (): OkHttpClient {
0 commit comments