From 25a7bbbfa8ea7c0da0b6c758cecbe5ae6a134adb Mon Sep 17 00:00:00 2001 From: y9Kap Date: Tue, 31 Oct 2023 00:35:39 +0300 Subject: [PATCH] fix(#79-support-search): fuckery is all --- .../ktor/requests/friends/FriendsEngine.kt | 5 +-- .../requests/invitations/InvitationsEngine.kt | 7 +++-- .../ktor/requests/meetings/MeetingsEngine.kt | 31 ++++++++++--------- .../notifications/NotificationsEngine.kt | 3 +- .../engine/ktor/requests/users/UsersEngine.kt | 6 ++-- .../sdk/engine/requests/EditMeetingRequest.kt | 12 +++---- 6 files changed, 34 insertions(+), 30 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 86ba9269..5c3b0220 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 @@ -31,6 +31,7 @@ import app.meetacy.sdk.types.url.Url import app.meetacy.sdk.types.user.RegularUser import app.meetacy.sdk.types.user.UserLocationSnapshot import io.ktor.client.* +import io.ktor.client.call.* import io.ktor.client.request.* import io.rsocket.kotlin.ktor.client.rSocket import io.rsocket.kotlin.payload.Payload @@ -62,7 +63,7 @@ internal class FriendsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() return response } @@ -77,7 +78,7 @@ internal class FriendsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() return response } diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/invitations/InvitationsEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/invitations/InvitationsEngine.kt index a91c172b..8a35656b 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/invitations/InvitationsEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/invitations/InvitationsEngine.kt @@ -18,6 +18,7 @@ import app.meetacy.sdk.types.serializable.user.UserIdSerializable import app.meetacy.sdk.types.serializable.user.serializable import app.meetacy.sdk.types.url.Url import io.ktor.client.* +import io.ktor.client.call.* import io.ktor.client.request.* import kotlinx.serialization.Serializable @@ -63,7 +64,7 @@ internal class InvitationsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() } @Serializable @@ -79,7 +80,7 @@ internal class InvitationsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() } @Serializable @@ -95,6 +96,6 @@ internal class InvitationsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() } } 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 f4caa5c0..c81c2e78 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 @@ -29,6 +29,7 @@ import app.meetacy.sdk.types.serializable.paging.serializable import app.meetacy.sdk.types.serializable.user.type import app.meetacy.sdk.types.url.Url import io.ktor.client.* +import io.ktor.client.call.* import io.ktor.client.request.* import kotlinx.serialization.Serializable @@ -140,17 +141,17 @@ internal class MeetingsEngine( @Serializable private data class CreateMeetingBody( val title: String?, + val description: String?, val date: DateSerializable, val location: LocationSerializable, - val description: String?, val visibility: MeetingSerializable.Visibility, - val fileId: FileIdSerializable? + val avatarId: FileIdSerializable? ) private fun CreateMeetingRequest.toBody() = CreateMeetingBody( title, + description, date.serializable(), location.serializable(), - description, visibility.serializable(), fileId?.serializable() ) @@ -171,22 +172,22 @@ internal class MeetingsEngine( @Serializable private data class EditMeetingBody( val meetingId: MeetingIdSerializable, - val title: OptionalSerializable, - val description: OptionalSerializable, - val location: OptionalSerializable, - val date: OptionalSerializable, - val avatarId: OptionalSerializable, - val visibility: OptionalSerializable + val title: String?, + val description: String?, + val location: LocationSerializable?, + val date: DateSerializable?, + val avatarId: OptionalSerializable = OptionalSerializable.Undefined, + val visibility: MeetingSerializable.Visibility? ) private fun EditMeetingRequest.toBody() = EditMeetingBody( meetingId.serializable(), - title.serializable(), - description.serializable(), - location.map { it.serializable() }.serializable(), - date.map { it.serializable() }.serializable(), + title, + description, + location?.serializable(), + date?.serializable(), avatarId.map { it?.serializable() }.serializable(), - visibility.map { it.serializable() }.serializable() + visibility?.serializable() ) suspend fun editMeeting(request: EditMeetingRequest): EditMeetingRequest.Response = with(request) { @@ -243,7 +244,7 @@ internal class MeetingsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() } @Serializable diff --git a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/notifications/NotificationsEngine.kt b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/notifications/NotificationsEngine.kt index 19d726a9..b0a533e1 100644 --- a/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/notifications/NotificationsEngine.kt +++ b/api/api-ktor/src/commonMain/kotlin/app/meetacy/sdk/engine/ktor/requests/notifications/NotificationsEngine.kt @@ -18,6 +18,7 @@ import app.meetacy.sdk.types.serializable.paging.PagingIdSerializable import app.meetacy.sdk.types.serializable.paging.serializable import app.meetacy.sdk.types.url.Url import io.ktor.client.* +import io.ktor.client.call.* import io.ktor.client.request.* import kotlinx.serialization.Serializable @@ -64,6 +65,6 @@ internal class NotificationsEngine( apiVersion(request.apiVersion) token(request.token) setBody(body) - }.bodyAsSuccess() + }.body() } } 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 08b00a3e..b6daca70 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 @@ -56,9 +56,9 @@ internal class UsersEngine( @Serializable private data class EditUserBody( - val nickname: OptionalSerializable, - val avatarId: OptionalSerializable, - val username: OptionalSerializable + val nickname: OptionalSerializable = OptionalSerializable.Undefined, + val avatarId: OptionalSerializable = OptionalSerializable.Undefined, + val username: OptionalSerializable = OptionalSerializable.Undefined ) private fun EditUserRequest.toBody() = EditUserBody( diff --git a/api/src/commonMain/kotlin/app/meetacy/sdk/engine/requests/EditMeetingRequest.kt b/api/src/commonMain/kotlin/app/meetacy/sdk/engine/requests/EditMeetingRequest.kt index 7bf66f50..986c4bb4 100644 --- a/api/src/commonMain/kotlin/app/meetacy/sdk/engine/requests/EditMeetingRequest.kt +++ b/api/src/commonMain/kotlin/app/meetacy/sdk/engine/requests/EditMeetingRequest.kt @@ -11,12 +11,12 @@ import app.meetacy.sdk.types.optional.Optional public data class EditMeetingRequest( public val token: Token, public val meetingId: MeetingId, - public val title: Optional, - public val description: Optional, - public val location: Optional, - public val date: Optional, - public val avatarId: Optional, - public val visibility: Optional + public val avatarId: Optional = Optional.Undefined, + public val title: String?, + public val description: String?, + public val location: Location?, + public val date: Date?, + public val visibility: Meeting.Visibility? ) : MeetacyRequest { public data class Response(val meeting: Meeting) }