fix(api): migrate to new pagination API

The older one is supposedly performing very poorly on the lobsters
side and has been modified to serve only cached content for unauthenticated
users. Unfortunately the configuration for this caching behaviour has
a bug that ignores query parameters and thus every page returns
the same set of 20 posts. Cut us over to this new API path that
hopefully does not generate too much load for the service.

See: https://github.com/lobsters/lobsters/issues/1219
This commit is contained in:
Harsh Shandilya 2023-11-16 22:41:39 +05:30
parent d9e664c440
commit dd06c93935

View File

@ -12,16 +12,15 @@ import dev.msfjarvis.claw.model.LobstersPostDetails
import dev.msfjarvis.claw.model.User
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
/** Simple interface defining an API for lobste.rs */
interface LobstersApi {
@GET("hottest.json")
suspend fun getHottestPosts(@Query("page") page: Int): ApiResult<List<LobstersPost>, Unit>
@GET("page/{page}.json")
suspend fun getHottestPosts(@Path("page") page: Int): ApiResult<List<LobstersPost>, Unit>
@GET("newest.json")
suspend fun getNewestPosts(@Query("page") page: Int): ApiResult<List<LobstersPost>, Unit>
@GET("newest/page/{page}.json")
suspend fun getNewestPosts(@Path("page") page: Int): ApiResult<List<LobstersPost>, Unit>
@GET("s/{postId}.json")
suspend fun getPostDetails(@Path("postId") postId: String): ApiResult<LobstersPostDetails, Unit>