Skip to content

Commit

Permalink
Fix page_cursor and page both being sent for 0.19+ (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
MV-GH authored Jul 15, 2024
1 parent ee5d11b commit ae597a0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import it.vercruysse.lemmyapi.dto.ListingType
import kotlinx.serialization.Serializable

import it.vercruysse.lemmyapi.CommonParcelize
import it.vercruysse.lemmyapi.dto.PAGE_CURSOR_GUARD

@CommonParcelize
@Serializable
Expand All @@ -20,5 +21,5 @@ data class GetPosts(
val liked_only: Boolean? = null,
val disliked_only: Boolean? = null,
val show_hidden: Boolean? = null,
val page_cursor: PaginationCursor? = null,
val page_cursor: PaginationCursor? = PAGE_CURSOR_GUARD,
) : DatatypeRoot
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package it.vercruysse.lemmyapi.v0.x19.x0
import io.ktor.client.HttpClient
import it.vercruysse.lemmyapi.dto.ExportUserSettingsResponse
import it.vercruysse.lemmyapi.dto.ImportUserSettings
import it.vercruysse.lemmyapi.dto.PAGE_CURSOR_GUARD
import it.vercruysse.lemmyapi.utils.getResult
import it.vercruysse.lemmyapi.utils.postResult
import it.vercruysse.lemmyapi.utils.putResult
Expand Down Expand Up @@ -196,7 +197,7 @@ internal class LemmyApiController(client: HttpClient, auth: String?) :
* @GET("post/list")
*/
override suspend fun getPosts(form: GetPosts): Result<GetPostsResponse> =
client.getResult("post/list", form)
client.getResult("post/list", form.copy(page = if (form.page_cursor != PAGE_CURSOR_GUARD) null else form.page))

/**
* Delete a post.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package it.vercruysse.lemmyapi.v0.x19.x3
import io.ktor.client.HttpClient
import it.vercruysse.lemmyapi.dto.ExportUserSettingsResponse
import it.vercruysse.lemmyapi.dto.ImportUserSettings
import it.vercruysse.lemmyapi.dto.PAGE_CURSOR_GUARD
import it.vercruysse.lemmyapi.utils.getResult
import it.vercruysse.lemmyapi.utils.postResult
import it.vercruysse.lemmyapi.utils.putResult
Expand Down Expand Up @@ -196,7 +197,7 @@ internal class LemmyApiController(client: HttpClient, auth: String?) :
* @GET("post/list")
*/
override suspend fun getPosts(form: GetPosts): Result<GetPostsResponse> =
client.getResult("post/list", form)
client.getResult("post/list", form.copy(page = if (form.page_cursor != PAGE_CURSOR_GUARD) null else form.page))

/**
* Delete a post.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package it.vercruysse.lemmyapi.v0.x19.x4
import io.ktor.client.HttpClient
import it.vercruysse.lemmyapi.dto.ExportUserSettingsResponse
import it.vercruysse.lemmyapi.dto.ImportUserSettings
import it.vercruysse.lemmyapi.dto.PAGE_CURSOR_GUARD
import it.vercruysse.lemmyapi.utils.getResult
import it.vercruysse.lemmyapi.utils.postResult
import it.vercruysse.lemmyapi.utils.putResult
Expand Down Expand Up @@ -196,7 +197,7 @@ internal class LemmyApiController(client: HttpClient, auth: String?) :
* @GET("post/list")
*/
override suspend fun getPosts(form: GetPosts): Result<GetPostsResponse> =
client.getResult("post/list", form)
client.getResult("post/list", form.copy(page = if (form.page_cursor != PAGE_CURSOR_GUARD) null else form.page))

/**
* Delete a post.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ POM_DEVELOPER_URL=https://github.com/MV-GH

POM_ARTIFACT_ID=lemmy-api
GROUP=it.vercruysse.lemmyapi
VERSION_NAME=0.3.2-SNAPSHOT
VERSION_NAME=0.3.3-SNAPSHOT

0 comments on commit ae597a0

Please sign in to comment.