From ccd66aff57f1e5ed245ef3f4c2f1dace98247dd0 Mon Sep 17 00:00:00 2001 From: y9Kap Date: Sun, 8 Oct 2023 21:40:52 +0300 Subject: [PATCH] WIP(#76-support-auth-header): fix sdk for passed test --- .../ktor/requests/friends/FriendsEngine.kt | 1 + .../ktor/requests/meetings/MeetingsEngine.kt | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 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 1e38a80b..c18994c7 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 @@ -106,6 +106,7 @@ internal class FriendsEngine( private fun EmitFriendsLocationRequest.encodeToPayload(json: Json): Payload = buildPayload { val initObject = buildJsonObject { put("apiVersion", apiVersion.int) + put("token", this@encodeToPayload.token.string) } data(json.encodeToString(initObject)) diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/meetings/MeetingsEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/meetings/MeetingsEngine.kt index 2e64ac2d..ce32bd88 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/meetings/MeetingsEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/meetings/MeetingsEngine.kt @@ -113,24 +113,24 @@ internal class MeetingsEngine( suspend fun createMeeting( request: CreateMeetingRequest - ): CreateMeetingRequest.Response { + ): CreateMeetingRequest.Response = with(request){ val response = base.meetingsCreatePost( createMeetingRequest = GeneratedCreateMeetingRequest( - title = request.title, - date = request.date.iso8601, + title = title, + date = date.iso8601, location = Location( - latitude = request.location.latitude, - longitude = request.location.longitude + latitude = location.latitude, + longitude = location.longitude ), - description = request.description, - visibility = when (request.visibility) { + description = description, + visibility = when (visibility) { Meeting.Visibility.Public -> GeneratedCreateMeetingRequest.Visibility.PUBLIC Meeting.Visibility.Private -> GeneratedCreateMeetingRequest.Visibility.PRIVATE }, - avatarId = request.fileId?.string + avatarId = fileId?.string ), - apiVersion = request.apiVersion.int.toString(), - authorization = request.token.string + apiVersion = apiVersion.int.toString(), + authorization = token.string ).result val meeting = response.mapToMeeting()