From 7bc763ee1da38ff5ce93aa562d36563f6303b10f Mon Sep 17 00:00:00 2001 From: y9Kap Date: Mon, 4 Mar 2024 22:41:34 +0300 Subject: [PATCH] feat(#91-change-getUser-request-type): change getUser request type --- .../sdk/engine/ktor/requests/users/UsersEngine.kt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/users/UsersEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/users/UsersEngine.kt index 9f893a1..8c22cc2 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/users/UsersEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/users/UsersEngine.kt @@ -26,30 +26,21 @@ internal class UsersEngine( ) { private val baseUrl = baseUrl / "users" - private fun toBody() = GetUserBody(null) - suspend fun getMe(request: GetMeRequest): GetMeRequest.Response { val url = baseUrl / "get" - val body = toBody() - val response = httpClient.post(url.string) { + val response = httpClient.get(url.string) { apiVersion(request.apiVersion) token(request.token) - setBody(body) }.bodyAsSuccess() return GetMeRequest.Response(response.type() as SelfUserDetails) } - @Serializable - private data class GetUserBody(val id: UserIdSerializable?) - private fun GetUserRequest.toBody() = GetUserBody(userId?.serializable()) - suspend fun getUser(request: GetUserRequest): GetUserRequest.Response { val url = baseUrl / "get" - val body = request.toBody() - val response = httpClient.post(url.string) { + val response = httpClient.get(url.string) { apiVersion(request.apiVersion) token(request.token) - setBody(body) + parameter("id", request.userId) }.bodyAsSuccess() return GetUserRequest.Response(response.type()) }