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

commonMain.app.bsky.feed.PostView.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION")

package app.bsky.feed

import app.bsky.actor.ProfileViewBasic
import com.atproto.label.Label
import kotlin.Long
import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.collections.immutable.persistentListOf
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.AtUri
import sh.christian.ozone.api.Cid
import sh.christian.ozone.api.model.JsonContent
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.model.Timestamp
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface PostViewEmbedUnion {
  public class ImagesViewSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.images#view",
    constructor = ::ImagesView,
    valueProvider = ImagesView::value,
    valueSerializerProvider = { app.bsky.embed.ImagesView.serializer() },
  )

  @Serializable(with = ImagesViewSerializer::class)
  @JvmInline
  @SerialName("app.bsky.embed.images#view")
  public value class ImagesView(
    public val `value`: app.bsky.embed.ImagesView,
  ) : PostViewEmbedUnion

  public class VideoViewSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.video#view",
    constructor = ::VideoView,
    valueProvider = VideoView::value,
    valueSerializerProvider = { app.bsky.embed.VideoView.serializer() },
  )

  @Serializable(with = VideoViewSerializer::class)
  @JvmInline
  @SerialName("app.bsky.embed.video#view")
  public value class VideoView(
    public val `value`: app.bsky.embed.VideoView,
  ) : PostViewEmbedUnion

  public class ExternalViewSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.external#view",
    constructor = ::ExternalView,
    valueProvider = ExternalView::value,
    valueSerializerProvider = { app.bsky.embed.ExternalView.serializer() },
  )

  @Serializable(with = ExternalViewSerializer::class)
  @JvmInline
  @SerialName("app.bsky.embed.external#view")
  public value class ExternalView(
    public val `value`: app.bsky.embed.ExternalView,
  ) : PostViewEmbedUnion

  public class RecordViewSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.record#view",
    constructor = ::RecordView,
    valueProvider = RecordView::value,
    valueSerializerProvider = { app.bsky.embed.RecordView.serializer() },
  )

  @Serializable(with = RecordViewSerializer::class)
  @JvmInline
  @SerialName("app.bsky.embed.record#view")
  public value class RecordView(
    public val `value`: app.bsky.embed.RecordView,
  ) : PostViewEmbedUnion

  public class RecordWithMediaViewSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.recordWithMedia#view",
    constructor = ::RecordWithMediaView,
    valueProvider = RecordWithMediaView::value,
    valueSerializerProvider = { app.bsky.embed.RecordWithMediaView.serializer() },
  )

  @Serializable(with = RecordWithMediaViewSerializer::class)
  @JvmInline
  @SerialName("app.bsky.embed.recordWithMedia#view")
  public value class RecordWithMediaView(
    public val `value`: app.bsky.embed.RecordWithMediaView,
  ) : PostViewEmbedUnion
}

@Serializable
public data class PostView(
  public val uri: AtUri,
  public val cid: Cid,
  public val author: ProfileViewBasic,
  public val record: JsonContent,
  public val embed: PostViewEmbedUnion? = null,
  public val replyCount: Long? = null,
  public val repostCount: Long? = null,
  public val likeCount: Long? = null,
  public val quoteCount: Long? = null,
  public val indexedAt: Timestamp,
  public val viewer: ViewerState? = null,
  public val labels: ReadOnlyList




© 2015 - 2024 Weber Informatics LLC | Privacy Policy