Skip to content

Commit

Permalink
fix(#79-support-search): fuckery is all
Browse files Browse the repository at this point in the history
  • Loading branch information
y9Kap committed Oct 30, 2023
1 parent a58088c commit 25a7bbb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -62,7 +63,7 @@ internal class FriendsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
return response
}

Expand All @@ -77,7 +78,7 @@ internal class FriendsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
return response
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -63,7 +64,7 @@ internal class InvitationsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
}

@Serializable
Expand All @@ -79,7 +80,7 @@ internal class InvitationsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
}

@Serializable
Expand All @@ -95,6 +96,6 @@ internal class InvitationsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
)
Expand All @@ -171,22 +172,22 @@ internal class MeetingsEngine(
@Serializable
private data class EditMeetingBody(
val meetingId: MeetingIdSerializable,
val title: OptionalSerializable<String>,
val description: OptionalSerializable<String?>,
val location: OptionalSerializable<LocationSerializable>,
val date: OptionalSerializable<DateSerializable>,
val avatarId: OptionalSerializable<FileIdSerializable?>,
val visibility: OptionalSerializable<MeetingSerializable.Visibility>
val title: String?,
val description: String?,
val location: LocationSerializable?,
val date: DateSerializable?,
val avatarId: OptionalSerializable<FileIdSerializable?> = 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) {
Expand Down Expand Up @@ -243,7 +244,7 @@ internal class MeetingsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -64,6 +65,6 @@ internal class NotificationsEngine(
apiVersion(request.apiVersion)
token(request.token)
setBody(body)
}.bodyAsSuccess<StatusTrueResponse>()
}.body<StatusTrueResponse>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ internal class UsersEngine(

@Serializable
private data class EditUserBody(
val nickname: OptionalSerializable<String>,
val avatarId: OptionalSerializable<FileIdSerializable?>,
val username: OptionalSerializable<UsernameSerializable?>
val nickname: OptionalSerializable<String> = OptionalSerializable.Undefined,
val avatarId: OptionalSerializable<FileIdSerializable?> = OptionalSerializable.Undefined,
val username: OptionalSerializable<UsernameSerializable?> = OptionalSerializable.Undefined
)

private fun EditUserRequest.toBody() = EditUserBody(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
public val description: Optional<String?>,
public val location: Optional<Location>,
public val date: Optional<Date>,
public val avatarId: Optional<FileId?>,
public val visibility: Optional<Meeting.Visibility>
public val avatarId: Optional<FileId?> = Optional.Undefined,
public val title: String?,
public val description: String?,
public val location: Location?,
public val date: Date?,
public val visibility: Meeting.Visibility?
) : MeetacyRequest<EditMeetingRequest.Response> {
public data class Response(val meeting: Meeting)
}

0 comments on commit 25a7bbb

Please sign in to comment.