All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.cssxsh.pixiv.fanbox.PostDetail.kt Maven / Gradle / Ivy

package xyz.cssxsh.pixiv.fanbox

import kotlinx.serialization.*
import java.time.*

@Serializable
public sealed class PostDetail {
    public abstract val body: Body?
    public abstract val commentCount: Int
    public abstract val commentList: CommentList
    public abstract val coverImageUrl: String?
    public abstract val creatorId: String
    public abstract val excerpt: String
    public abstract val feeRequired: Int
    public abstract val hasAdultContent: Boolean
    public abstract val id: Long
    public abstract val imageForShare: String?
    public abstract val isLiked: Boolean
    public abstract val isRestricted: Boolean
    public abstract val likeCount: Int
    public abstract val nextPost: Link?
    public abstract val prevPost: Link?
    public abstract val publishedDatetime: OffsetDateTime
    public abstract val restrictedFor: Int?
    public abstract val tags: List
    public abstract val title: String
    public abstract val updatedDatetime: OffsetDateTime
    public abstract val user: CreatorInfo

    @Serializable
    @SerialName("article")
    public data class Article(
        @SerialName("body")
        override val body: ArticleBody?,
        @SerialName("commentCount")
        override val commentCount: Int,
        @SerialName("commentList")
        override val commentList: CommentList = CommentList.Empty,
        @SerialName("coverImageUrl")
        override val coverImageUrl: String?,
        @SerialName("creatorId")
        override val creatorId: String,
        @SerialName("excerpt")
        override val excerpt: String,
        @SerialName("feeRequired")
        override val feeRequired: Int,
        @SerialName("hasAdultContent")
        override val hasAdultContent: Boolean,
        @SerialName("id")
        override val id: Long,
        @SerialName("imageForShare")
        override val imageForShare: String? = null,
        @SerialName("isLiked")
        override val isLiked: Boolean,
        @SerialName("isRestricted")
        override val isRestricted: Boolean,
        @SerialName("likeCount")
        override val likeCount: Int,
        @SerialName("nextPost")
        override val nextPost: Link? = null,
        @SerialName("prevPost")
        override val prevPost: Link? = null,
        @Contextual
        @SerialName("publishedDatetime")
        override val publishedDatetime: OffsetDateTime,
        @SerialName("restrictedFor")
        override val restrictedFor: Int?,
        @SerialName("tags")
        override val tags: List,
        @SerialName("title")
        override val title: String,
        @Contextual
        @SerialName("updatedDatetime")
        override val updatedDatetime: OffsetDateTime,
        @SerialName("user")
        override val user: CreatorInfo
    ) : PostDetail()

    @Serializable
    @SerialName("file")
    public data class File(
        @SerialName("body")
        override val body: FileBody?,
        @SerialName("commentCount")
        override val commentCount: Int,
        @SerialName("commentList")
        override val commentList: CommentList = CommentList.Empty,
        @SerialName("coverImageUrl")
        override val coverImageUrl: String?,
        @SerialName("creatorId")
        override val creatorId: String,
        @SerialName("excerpt")
        override val excerpt: String,
        @SerialName("feeRequired")
        override val feeRequired: Int,
        @SerialName("hasAdultContent")
        override val hasAdultContent: Boolean,
        @SerialName("id")
        override val id: Long,
        @SerialName("imageForShare")
        override val imageForShare: String? = null,
        @SerialName("isLiked")
        override val isLiked: Boolean,
        @SerialName("isRestricted")
        override val isRestricted: Boolean,
        @SerialName("likeCount")
        override val likeCount: Int,
        @SerialName("nextPost")
        override val nextPost: Link? = null,
        @SerialName("prevPost")
        override val prevPost: Link? = null,
        @Contextual
        @SerialName("publishedDatetime")
        override val publishedDatetime: OffsetDateTime,
        @SerialName("restrictedFor")
        override val restrictedFor: Int?,
        @SerialName("tags")
        override val tags: List,
        @SerialName("title")
        override val title: String,
        @Contextual
        @SerialName("updatedDatetime")
        override val updatedDatetime: OffsetDateTime,
        @SerialName("user")
        override val user: CreatorInfo
    ) : PostDetail()

    @Serializable
    @SerialName("image")
    public data class Image(
        @SerialName("body")
        override val body: ImageBody?,
        @SerialName("commentCount")
        override val commentCount: Int,
        @SerialName("commentList")
        override val commentList: CommentList = CommentList.Empty,
        @SerialName("coverImageUrl")
        override val coverImageUrl: String?,
        @SerialName("creatorId")
        override val creatorId: String,
        @SerialName("excerpt")
        override val excerpt: String,
        @SerialName("feeRequired")
        override val feeRequired: Int,
        @SerialName("hasAdultContent")
        override val hasAdultContent: Boolean,
        @SerialName("id")
        override val id: Long,
        @SerialName("imageForShare")
        override val imageForShare: String? = null,
        @SerialName("isLiked")
        override val isLiked: Boolean,
        @SerialName("isRestricted")
        override val isRestricted: Boolean,
        @SerialName("likeCount")
        override val likeCount: Int,
        @SerialName("nextPost")
        override val nextPost: Link? = null,
        @SerialName("prevPost")
        override val prevPost: Link? = null,
        @Contextual
        @SerialName("publishedDatetime")
        override val publishedDatetime: OffsetDateTime,
        @SerialName("restrictedFor")
        override val restrictedFor: Int?,
        @SerialName("tags")
        override val tags: List,
        @SerialName("title")
        override val title: String,
        @Contextual
        @SerialName("updatedDatetime")
        override val updatedDatetime: OffsetDateTime,
        @SerialName("user")
        override val user: CreatorInfo
    ) : PostDetail()

    @Serializable
    @SerialName("text")
    public data class Text(
        @SerialName("body")
        override val body: TextBody?,
        @SerialName("commentCount")
        override val commentCount: Int,
        @SerialName("commentList")
        override val commentList: CommentList = CommentList.Empty,
        @SerialName("coverImageUrl")
        override val coverImageUrl: String?,
        @SerialName("creatorId")
        override val creatorId: String,
        @SerialName("excerpt")
        override val excerpt: String,
        @SerialName("feeRequired")
        override val feeRequired: Int,
        @SerialName("hasAdultContent")
        override val hasAdultContent: Boolean,
        @SerialName("id")
        override val id: Long,
        @SerialName("imageForShare")
        override val imageForShare: String? = null,
        @SerialName("isLiked")
        override val isLiked: Boolean,
        @SerialName("isRestricted")
        override val isRestricted: Boolean,
        @SerialName("likeCount")
        override val likeCount: Int,
        @SerialName("nextPost")
        override val nextPost: Link? = null,
        @SerialName("prevPost")
        override val prevPost: Link? = null,
        @Contextual
        @SerialName("publishedDatetime")
        override val publishedDatetime: OffsetDateTime,
        @SerialName("restrictedFor")
        override val restrictedFor: Int?,
        @SerialName("tags")
        override val tags: List,
        @SerialName("title")
        override val title: String,
        @Contextual
        @SerialName("updatedDatetime")
        override val updatedDatetime: OffsetDateTime,
        @SerialName("user")
        override val user: CreatorInfo
    ) : PostDetail()

    @Serializable
    @SerialName("video")
    public data class Video(
        @SerialName("body")
        override val body: VideoBody?,
        @SerialName("commentCount")
        override val commentCount: Int,
        @SerialName("commentList")
        override val commentList: CommentList = CommentList.Empty,
        @SerialName("coverImageUrl")
        override val coverImageUrl: String?,
        @SerialName("creatorId")
        override val creatorId: String,
        @SerialName("excerpt")
        override val excerpt: String,
        @SerialName("feeRequired")
        override val feeRequired: Int,
        @SerialName("hasAdultContent")
        override val hasAdultContent: Boolean,
        @SerialName("id")
        override val id: Long,
        @SerialName("imageForShare")
        override val imageForShare: String? = null,
        @SerialName("isLiked")
        override val isLiked: Boolean,
        @SerialName("isRestricted")
        override val isRestricted: Boolean,
        @SerialName("likeCount")
        override val likeCount: Int,
        @SerialName("nextPost")
        override val nextPost: Link? = null,
        @SerialName("prevPost")
        override val prevPost: Link? = null,
        @Contextual
        @SerialName("publishedDatetime")
        override val publishedDatetime: OffsetDateTime,
        @SerialName("restrictedFor")
        override val restrictedFor: Int?,
        @SerialName("tags")
        override val tags: List,
        @SerialName("title")
        override val title: String,
        @Contextual
        @SerialName("updatedDatetime")
        override val updatedDatetime: OffsetDateTime,
        @SerialName("user")
        override val user: CreatorInfo
    ) : PostDetail()

    public sealed interface Body

    @Serializable
    public data class ArticleBody(
        @SerialName("blocks")
        val blocks: List,
        @SerialName("embedMap")
        val embedMap: Map,
        @SerialName("fileMap")
        val fileMap: Map,
        @SerialName("imageMap")
        val imageMap: Map,
        @SerialName("urlEmbedMap")
        val urlEmbedMap: Map,
    ) : Body

    @Serializable
    public data class FileBody(
        @SerialName("files")
        val files: List,
        @SerialName("text")
        val text: String
    ) : Body

    @Serializable
    public data class ImageBody(
        @SerialName("images")
        val images: List,
        @SerialName("text")
        val text: String
    ) : Body

    @Serializable
    public data class TextBody(
        @SerialName("text")
        val text: String
    ) : Body

    @Serializable
    public data class VideoBody(
        @SerialName("videos")
        val videos: List,
        @SerialName("text")
        val text: String
    ) : Body

    @Serializable
    public sealed class ArticleBlock {

        public sealed interface RichText {
            public val offset: Int
            public val length: Int
        }

        @Serializable
        public sealed class Style : RichText {

            @Serializable
            @SerialName("bold")
            public data class Bold(
                @SerialName("offset")
                override val offset: Int,
                @SerialName("length")
                override val length: Int,
            ) : Style()
        }

        @Serializable
        public data class Link(
            @SerialName("offset")
            override val offset: Int,
            @SerialName("length")
            override val length: Int,
            @SerialName("url")
            val url: String
        ) : RichText

        @Serializable
        @SerialName("p")
        public data class Paragraph(
            @SerialName("text")
            val text: String,
            @SerialName("styles")
            val styles: List