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

commonMain.chat.bsky.convo.MessageInput.kt Maven / Gradle / Ivy

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

package chat.bsky.convo

import app.bsky.embed.Record
import app.bsky.richtext.Facet
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmInline
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.JsonContent
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface MessageInputEmbedUnion {
  public class AppBskyEmbedRecordSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.embed.record",
    constructor = ::AppBskyEmbedRecord,
    valueProvider = AppBskyEmbedRecord::value,
    valueSerializerProvider = { Record.serializer() },
  )

  @JvmInline
  @Serializable(with = AppBskyEmbedRecordSerializer::class)
  @SerialName("app.bsky.embed.record")
  public value class AppBskyEmbedRecord(
    public val `value`: Record,
  ) : MessageInputEmbedUnion

  @JvmInline
  @Serializable
  public value class Unknown(
    public val `value`: JsonContent,
  ) : MessageInputEmbedUnion
}

/**
 * @param facets Annotations of text (mentions, URLs, hashtags, etc)
 */
@Serializable
public data class MessageInput(
  public val text: String,
  /**
   * Annotations of text (mentions, URLs, hashtags, etc)
   */
  public val facets: List = emptyList(),
  public val embed: MessageInputEmbedUnion? = null,
) {
  init {
    require(text.count() <= 10_000) {
      "text.count() must be <= 10_000, but was ${text.count()}"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy