diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt index bdf50d03..4ba24ce3 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/repository/MessagesRepository.kt @@ -88,7 +88,7 @@ internal class MessagesRepository( } suspend fun getMessageDetails(globalKey: String, markAsRead: Boolean): MessageDetails { - val details = api.getMessageDetails(globalKey) + val details = api.getMessageDetails(globalKey) ?: error("Message not exist") if (markAsRead) { runCatching { loginModule() diff --git a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt index d6a15e52..2393886c 100644 --- a/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt +++ b/sdk-scrapper/src/main/kotlin/io/github/wulkanowy/sdk/scrapper/service/MessagesService.kt @@ -75,7 +75,7 @@ internal interface MessagesService { ): List @GET("api/WiadomoscSzczegoly") - suspend fun getMessageDetails(@Query("apiGlobalKey") globalKey: String): MessageDetails + suspend fun getMessageDetails(@Query("apiGlobalKey") globalKey: String): MessageDetails? @PUT("api/WiadomoscSzczegoly") suspend fun markMessageAsRead(@Body body: Map)