From dd06c9393538f570332d926af4d33c3bb3cce252 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 16 Nov 2023 22:41:39 +0530 Subject: [PATCH] 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 --- .../main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/src/main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt b/api/src/main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt index f4aedc09..440c7bcf 100644 --- a/api/src/main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt +++ b/api/src/main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt @@ -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, Unit> + @GET("page/{page}.json") + suspend fun getHottestPosts(@Path("page") page: Int): ApiResult, Unit> - @GET("newest.json") - suspend fun getNewestPosts(@Query("page") page: Int): ApiResult, Unit> + @GET("newest/page/{page}.json") + suspend fun getNewestPosts(@Path("page") page: Int): ApiResult, Unit> @GET("s/{postId}.json") suspend fun getPostDetails(@Path("postId") postId: String): ApiResult