diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationGetUnreadCountResponse.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationGetUnreadCountResponse.kt index d0244f3..eca8f8a 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationGetUnreadCountResponse.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationGetUnreadCountResponse.kt @@ -4,5 +4,5 @@ import kotlinx.serialization.Serializable @Serializable class NotificationGetUnreadCountResponse { - var count: Int? = null + var count: Int = -1 } diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationListNotificationsResponse.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationListNotificationsResponse.kt index 765fc5b..a3d7ad8 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationListNotificationsResponse.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationListNotificationsResponse.kt @@ -6,5 +6,5 @@ import work.socialhub.kbsky.model.bsky.notification.NotificationListNotification @Serializable class NotificationListNotificationsResponse { var cursor: String? = null - var notifications: List? = null + lateinit var notifications: List } diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationUpdateSeenRequest.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationUpdateSeenRequest.kt index 6889263..6b388fd 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationUpdateSeenRequest.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/bsky/notification/NotificationUpdateSeenRequest.kt @@ -1,7 +1,9 @@ package work.socialhub.kbsky.api.entity.bsky.notification +import kotlinx.datetime.Clock import work.socialhub.kbsky.api.entity.share.AuthRequest import work.socialhub.kbsky.api.entity.share.MapRequest +import work.socialhub.kbsky.internal.share._InternalUtility class NotificationUpdateSeenRequest internal constructor( accessJwt: String @@ -11,11 +13,11 @@ class NotificationUpdateSeenRequest internal constructor( override fun toMap(): Map { return mutableMapOf().also { - it.addParam("seenAt", seenAt) + it.addParam("seenAt", seenAt()) } } fun seenAt(): String { - return seenAt ?: TODO("seenAt is not set") + return seenAt ?: _InternalUtility.dateFormat.format(Clock.System.now()) } } diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/AuthRequest.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/AuthRequest.kt index 5212ba7..fb78e2c 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/AuthRequest.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/api/entity/share/AuthRequest.kt @@ -4,7 +4,6 @@ import kotlinx.serialization.Serializable import work.socialhub.kbsky.internal.share._InternalUtility.fromJson import kotlin.io.encoding.Base64 import kotlin.io.encoding.ExperimentalEncodingApi -import kotlin.properties.Delegates open class AuthRequest( val accessJwt: String @@ -29,8 +28,8 @@ open class AuthRequest( lateinit var scope: String lateinit var sub: String lateinit var aud: String - var iat by Delegates.notNull() - var exp by Delegates.notNull() + var iat: Int = -1 + var exp: Int = -1 } } diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/actor/ActorDefsAdultContentPref.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/actor/ActorDefsAdultContentPref.kt index 3a20f5e..53c8257 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/actor/ActorDefsAdultContentPref.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/actor/ActorDefsAdultContentPref.kt @@ -2,7 +2,6 @@ package work.socialhub.kbsky.model.bsky.actor import kotlinx.serialization.Serializable import work.socialhub.kbsky.BlueskyTypes -import kotlin.properties.Delegates.notNull @Serializable class ActorDefsAdultContentPref : ActorDefsPreferencesUnion() { @@ -13,5 +12,5 @@ class ActorDefsAdultContentPref : ActorDefsPreferencesUnion() { override var type = TYPE - var enabled by notNull() + var enabled: Boolean = false } diff --git a/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/notification/NotificationListNotificationsNotification.kt b/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/notification/NotificationListNotificationsNotification.kt index 65edace..212f0ac 100644 --- a/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/notification/NotificationListNotificationsNotification.kt +++ b/core/src/commonMain/kotlin/work/socialhub/kbsky/model/bsky/notification/NotificationListNotificationsNotification.kt @@ -6,17 +6,20 @@ import work.socialhub.kbsky.model.share.RecordUnion @Serializable class NotificationListNotificationsNotification { - var uri: String? = null - var cid: String? = null - var author: ActorDefsProfileView? = null + lateinit var uri: String + lateinit var cid: String + lateinit var author: ActorDefsProfileView /** * Expected values are 'like', 'repost', 'follow * (like, repost, follow, mention, reply, quote) */ - var reason: String? = null + lateinit var reason: String var reasonSubject: String? = null - var record: RecordUnion? = null - var isRead: Boolean? = null - var indexedAt: String? = null + + lateinit var record: RecordUnion + var isRead: Boolean = false + lateinit var indexedAt: String + + // TODO: labels } diff --git a/core/src/jvmTest/kotlin/work/socialhub/kbsky/bsky/notification/ListNotificationsTest.kt b/core/src/jvmTest/kotlin/work/socialhub/kbsky/bsky/notification/ListNotificationsTest.kt index e94eecd..3b71c14 100644 --- a/core/src/jvmTest/kotlin/work/socialhub/kbsky/bsky/notification/ListNotificationsTest.kt +++ b/core/src/jvmTest/kotlin/work/socialhub/kbsky/bsky/notification/ListNotificationsTest.kt @@ -17,11 +17,10 @@ class ListNotificationsTest : AbstractTest() { NotificationListNotificationsRequest(accessJwt) ) - checkNotNull(response.data.notifications) - .forEach { it -> - println("|NOTIFICATION|-----------------------------------------") - println("REASON> " + it.reason) - print(it.record) - } + response.data.notifications.forEach { + println("|NOTIFICATION|-----------------------------------------") + println("REASON> " + it.reason) + print(it.record) + } } }