Skip to content

Commit

Permalink
fix: DynamicInfo, close #117
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Apr 3, 2024
1 parent 4d3ea10 commit 42186e2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 71 deletions.
28 changes: 1 addition & 27 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/Article.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ data class ArticleAuthor(
@SerialName("mid")
val mid: Long,
@SerialName("name")
val name: String,
@SerialName("nameplate")
val nameplate: UserNameplate,
@SerialName("official_verify")
val official: UserOfficial
val name: String
) : Owner {
override val uid: Long get() = mid
override val uname: String get() = name
Expand Down Expand Up @@ -148,28 +144,6 @@ data class ArticleSimple(
val words: Int
) : Article

@Serializable
data class ArticleMedia(
@SerialName("area")
val area: String,
@SerialName("cover")
val cover: String,
@SerialName("media_id")
val mediaId: Long,
@SerialName("score")
val score: Int,
@SerialName("season_id")
val seasonId: Long,
@SerialName("spoiler")
val spoiler: Int,
@SerialName("title")
val title: String,
@SerialName("type_id")
val typeId: Int,
@SerialName("type_name")
val type: String
)

@Serializable
data class ArticleList(
@SerialName("apply_time")
Expand Down
41 changes: 3 additions & 38 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/Dynamic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ data class DynamicInfo(
@SerialName("card")
override val card: String,
@SerialName("desc")
override val detail: DynamicDescribe,
override val detail: DynamicDescribe = DynamicDescribe.Empty,
@SerialName("display")
override val display: DynamicDisplay? = null
) : DynamicCard, Entry {
Expand All @@ -230,20 +230,10 @@ data class DynamicInfo(

@Serializable
data class DynamicArticle(
@SerialName("act_id")
val actId: Int,
@SerialName("apply_time")
val apply: String,
@SerialName("author")
val author: ArticleAuthor,
@SerialName("banner_url")
val banner: String,
@SerialName("categories")
val categories: List<ArticleCategory>? = null,
@SerialName("category")
val category: ArticleCategory,
@SerialName("check_time")
val check: String,
@SerialName("cover_avid")
val avid: Long = 0,
@SerialName("ctime")
Expand All @@ -252,32 +242,16 @@ data class DynamicArticle(
override val id: Long,
@SerialName("image_urls")
override val images: List<String>,
@SerialName("is_like")
val isLike: Boolean,
@SerialName("list")
val list: ArticleList?,
@SerialName("media")
val media: ArticleMedia,
@SerialName("origin_image_urls")
val originImageUrls: List<String>,
@SerialName("original")
val original: Int,
@SerialName("publish_time")
override val published: Long,
@SerialName("reprint")
val reprint: Int,
@SerialName("state")
val state: Int,
@SerialName("stats")
override val status: ArticleStatus,
@SerialName("summary")
override val summary: String,
@SerialName("template_id")
val templateId: Int,
@SerialName("title")
override val title: String,
@SerialName("words")
val words: Int
override val title: String
) : Article

@Serializable
Expand Down Expand Up @@ -473,21 +447,14 @@ data class DynamicPicture(

@Serializable
data class DynamicPictureDetail(
@SerialName("category")
val category: String,
@SerialName("description")
val description: String,
@SerialName("id")
val id: Long,
@SerialName("is_fav")
@Serializable(NumberToBooleanSerializer::class)
val isFavourite: Boolean,
@SerialName("pictures")
val pictures: List<DynamicPictureInfo>,
@SerialName("reply")
val reply: Long,
@SerialName("title")
val title: String,
@SerialName("upload_time")
val uploaded: Long
)
Expand Down Expand Up @@ -627,8 +594,6 @@ data class DynamicVideo(
override val id: String = "",
@SerialName("cid")
val cid: Int,
@SerialName("copyright")
val copyright: Int,
@SerialName("ctime")
override val created: Long,
@SerialName("desc")
Expand Down Expand Up @@ -660,7 +625,7 @@ data class DynamicVideo(
@SerialName("season_id")
override val seasonId: Long? = null,
@SerialName("rights")
val rights: VideoRights
val rights: VideoRights = VideoRights.Empty
) : Video {
override val uid: Long get() = owner.mid
override val uname: String get() = owner.name
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/Emote.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ data class EmoteItem(
data class EmojiDetail(
@SerialName("id")
val id: Int,
@SerialName("mtime")
val mtime: Long,
@SerialName("package_id")
val packageId: Int,
@SerialName("text")
Expand Down
12 changes: 8 additions & 4 deletions src/main/kotlin/xyz/cssxsh/bilibili/data/Video.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ data class BiliVideoInfo(
@SerialName("videos")
val videos: Int,
@SerialName("rights")
val rights: VideoRights
val rights: VideoRights = VideoRights.Empty
) : Video {
override val uid: Long get() = owner.mid
override val uname: String get() = owner.name
Expand Down Expand Up @@ -196,11 +196,11 @@ data class VideoStatus(
val favorite: Long,
@SerialName("his_rank")
@Serializable(NumberToBooleanSerializer::class)
val hisRank: Boolean,
val hisRank: Boolean = false,
@SerialName("like")
val like: Long,
@SerialName("now_rank")
val nowRank: Int,
val nowRank: Int = -1,
@SerialName("reply")
val reply: Long,
@SerialName("share")
Expand Down Expand Up @@ -380,4 +380,8 @@ data class VideoRights(
@SerialName("ugc_pay_preview")
@Serializable(NumberToBooleanSerializer::class)
val ugcPayPreview: Boolean = false
)
) {
companion object {
val Empty = VideoRights()
}
}

0 comments on commit 42186e2

Please sign in to comment.