Skip to content

Commit

Permalink
fix(#76-support-search): fuckery optional again
Browse files Browse the repository at this point in the history
  • Loading branch information
y9Kap committed Oct 31, 2023
1 parent 491d3a5 commit b86817f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import io.ktor.client.call.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.plugins.websocket.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.utils.io.errors.*
import io.rsocket.kotlin.ktor.client.RSocketSupport
import kotlinx.coroutines.CancellationException
Expand All @@ -49,6 +51,9 @@ public class KtorMeetacyEngine(
ignoreUnknownKeys = true
}
}
defaultRequest {
header(HttpHeaders.ContentType, ContentType.Application.Json.toString())
}
}

private val auth = AuthEngine(baseUrl, this.httpClient)
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 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?
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>
) : MeetacyRequest<EditMeetingRequest.Response> {
public data class Response(val meeting: Meeting)
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ public class AuthorizedMeetingsApi(
visibility: Meeting.Visibility
): AuthorizedMeetingRepository = edit(
meetingId = meetingId,
title = title,
date = date,
location = location,
description = description,
title = Optional.Present(title),
date = Optional.Present(date),
location = Optional.Present(location),
description = Optional.Present(description),
avatarId = Optional.Present(avatarId),
visibility = visibility
visibility = Optional.Present(visibility),
)

public suspend fun edit(
meetingId: MeetingId,
title: String?,
date: Date?,
location: Location?,
description: String?,
title: Optional<String> = Optional.Undefined,
date: Optional<Date> = Optional.Undefined,
location: Optional<Location> = Optional.Undefined,
description: Optional<String?> = Optional.Undefined,
avatarId: Optional<FileId?> = Optional.Undefined,
visibility: Meeting.Visibility?
visibility: Optional<Meeting.Visibility> = Optional.Undefined
): AuthorizedMeetingRepository {
val meeting = api.base.meetings.edit(
token = api.token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MeetingRepository(
public val creator: User get() = data.creator
public val date: Date get() = data.date
public val location: Location get() = data.location
public val title: String? get() = data.title
public val title: String get() = data.title
public val description: String? get() = data.description
public val participantsCount: Int get() = data.participantsCount
public val previewParticipants: List<User> get() = data.previewParticipants
Expand All @@ -36,30 +36,30 @@ public class MeetingRepository(

public suspend fun edited(
token: Token,
title: String?,
date: Date?,
location: Location?,
title: String,
date: Date,
location: Location,
description: String?,
avatarId: FileId?,
visibility: Meeting.Visibility?
visibility: Meeting.Visibility
): MeetingRepository = edited(
token = token,
title = title,
date = date,
location = location,
description = description,
title = Optional.Present(title),
date = Optional.Present(date),
location = Optional.Present(location),
description = Optional.Present(description),
avatarId = Optional.Present(avatarId),
visibility = visibility,
visibility = Optional.Present(visibility),
)

public suspend fun edited(
token: Token,
title: String?,
date: Date?,
location: Location?,
description: String?,
title: Optional<String> = Optional.Undefined,
date: Optional<Date> = Optional.Undefined,
location: Optional<Location> = Optional.Undefined,
description: Optional<String?> = Optional.Undefined,
avatarId: Optional<FileId?> = Optional.Undefined,
visibility: Meeting.Visibility?
visibility: Optional<Meeting.Visibility> = Optional.Undefined
): MeetingRepository {
return api.meetings.edit(
token = token,
Expand Down
20 changes: 10 additions & 10 deletions api/src/commonMain/kotlin/app/meetacy/sdk/meetings/MeetingsApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ public class MeetingsApi(private val api: MeetacyApi) {
): MeetingRepository = edit(
token = token,
meetingId = meetingId,
title = title,
date = date,
location = location,
description = description,
title = Optional.Present(title),
date = Optional.Present(date),
location = Optional.Present(location),
description = Optional.Present(description),
avatarId = Optional.Present(avatarId),
visibility = visibility,
visibility = Optional.Present(visibility),
)

public suspend fun edit(
token: Token,
meetingId: MeetingId,
title: String?,
date: Date?,
location: Location?,
description: String?,
title: Optional<String> = Optional.Undefined,
date: Optional<Date> = Optional.Undefined,
location: Optional<Location> = Optional.Undefined,
description: Optional<String?> = Optional.Undefined,
avatarId: Optional<FileId?> = Optional.Undefined,
visibility: Meeting.Visibility?
visibility: Optional<Meeting.Visibility> = Optional.Undefined
): MeetingRepository {
val meeting = api.engine.execute(
EditMeetingRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public data class MeetingSerializable(
val creator: UserSerializable,
val date: DateSerializable,
val location: LocationSerializable,
val title: String?,
val title: String,
val description: String? = null,
val participantsCount: Int,
val previewParticipants: List<UserSerializable>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public data class Meeting(
val creator: User,
val date: Date,
val location: Location,
val title: String?,
val title: String,
val description: String?,
val participantsCount: Int,
val previewParticipants: List<User>,
Expand Down

0 comments on commit b86817f

Please sign in to comment.