From 866eda9163659ff787245dfe999d22e862fa0735 Mon Sep 17 00:00:00 2001 From: y9Kap Date: Thu, 14 Mar 2024 19:51:45 +0300 Subject: [PATCH] fix(#96-add-support-quit-meeting-request): added support remove /relationship route --- .../ktor/requests/friends/FriendsEngine.kt | 4 +-- .../sdk/friends/AuthorizedFriendsApi.kt | 24 ++++++++++++++++- .../app/meetacy/sdk/friends/FriendsApi.kt | 26 ++++++++++++++++++- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/friends/FriendsEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/friends/FriendsEngine.kt index 660af3d..7fc497e 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/friends/FriendsEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/friends/FriendsEngine.kt @@ -97,7 +97,7 @@ internal class FriendsEngine( } suspend fun subscriptions(request: GetSubscriptionsRequest): GetSubscriptionsRequest.Response { - val url = baseUrl / "relationship" / "subscriptions" + val url = baseUrl / "subscriptions" val response = httpClient.get(url.string) { apiVersion(request.apiVersion) @@ -113,7 +113,7 @@ internal class FriendsEngine( } suspend fun subscribers(request: GetSubscribersRequest): GetSubscribersRequest.Response { - val url = baseUrl / "relationship" / "subscribers" + val url = baseUrl / "subscribers" val response = httpClient.get(url.string) { apiVersion(request.apiVersion) diff --git a/api/src/commonMain/kotlin/app/meetacy/sdk/friends/AuthorizedFriendsApi.kt b/api/src/commonMain/kotlin/app/meetacy/sdk/friends/AuthorizedFriendsApi.kt index e639a41..af8cc98 100644 --- a/api/src/commonMain/kotlin/app/meetacy/sdk/friends/AuthorizedFriendsApi.kt +++ b/api/src/commonMain/kotlin/app/meetacy/sdk/friends/AuthorizedFriendsApi.kt @@ -58,7 +58,7 @@ public class AuthorizedFriendsApi(private val api: AuthorizedMeetacyApi) { AuthorizedUserDetailsRepository.of(user.data, api) } - public fun paging( + public fun listPaging( chunkSize: Amount, startPagingId: PagingId? = null, limit: Amount? = null @@ -69,4 +69,26 @@ public class AuthorizedFriendsApi(private val api: AuthorizedMeetacyApi) { list(currentAmount, currentPagingId).response } } + public fun subscribersPaging( + chunkSize: Amount, + startPagingId: PagingId? = null, + limit: Amount? = null + ): PagingSource { + return PagingSource( + chunkSize, startPagingId, limit + ) { currentAmount, currentPagingId -> + subscribers(currentAmount, currentPagingId).response + } + } + public fun subscriptionsPaging( + chunkSize: Amount, + startPagingId: PagingId? = null, + limit: Amount? = null + ): PagingSource { + return PagingSource( + chunkSize, startPagingId, limit + ) { currentAmount, currentPagingId -> + subscriptions(currentAmount, currentPagingId).response + } + } } diff --git a/api/src/commonMain/kotlin/app/meetacy/sdk/friends/FriendsApi.kt b/api/src/commonMain/kotlin/app/meetacy/sdk/friends/FriendsApi.kt index 3798712..e77eb68 100644 --- a/api/src/commonMain/kotlin/app/meetacy/sdk/friends/FriendsApi.kt +++ b/api/src/commonMain/kotlin/app/meetacy/sdk/friends/FriendsApi.kt @@ -87,7 +87,7 @@ public class FriendsApi(private val api: MeetacyApi) { } } - public fun paging( + public fun listPaging( token: Token, chunkSize: Amount, startPagingId: PagingId? = null, @@ -99,4 +99,28 @@ public class FriendsApi(private val api: MeetacyApi) { list(token, currentAmount, currentPagingId).response } } + public fun subscribersPaging( + token: Token, + chunkSize: Amount, + startPagingId: PagingId? = null, + limit: Amount? = null + ): PagingSource { + return PagingSource( + chunkSize, startPagingId, limit + ) { currentAmount, currentPagingId -> + subscribers(token, currentAmount, currentPagingId).response + } + } + public fun subscriptionsPaging( + token: Token, + chunkSize: Amount, + startPagingId: PagingId? = null, + limit: Amount? = null + ): PagingSource { + return PagingSource( + chunkSize, startPagingId, limit + ) { currentAmount, currentPagingId -> + subscriptions(token, currentAmount, currentPagingId).response + } + } }