Updated on 2026-08-14
This commit is contained in:
parent
c2e67ba6bc
commit
a02b13ae6a
19 changed files with 544 additions and 273 deletions
|
|
@ -0,0 +1,19 @@
|
|||
package com.tangem.domain.models.news
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
sealed class NewsError {
|
||||
abstract val message: String?
|
||||
abstract val code: Int?
|
||||
|
||||
data class ArticleNotFound(
|
||||
override val message: String?,
|
||||
override val code: Int?,
|
||||
) : NewsError()
|
||||
|
||||
data class Unknown(
|
||||
override val message: String?,
|
||||
override val code: Int?,
|
||||
) : NewsError()
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.tangem.domain.models.news
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Represents the result of fetching news.
|
||||
* Can contain either data or an error.
|
||||
*/
|
||||
@Serializable
|
||||
sealed interface TrendingNews {
|
||||
@Serializable
|
||||
data class Data(val articles: List<ShortArticle>) : TrendingNews
|
||||
|
||||
@Serializable
|
||||
data class Error(val throwable: NewsError) : TrendingNews
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue