Skip to content

Commit

Permalink
fix(api): migrate to new pagination API
Browse files Browse the repository at this point in the history
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: lobsters/lobsters#1219
  • Loading branch information
msfjarvis committed Nov 16, 2023
1 parent d9e664c commit dd06c93
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions api/src/main/kotlin/dev/msfjarvis/claw/api/LobstersApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit dd06c93

Please sign in to comment.