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

commonMain.app.bsky.richtext.facet.kt Maven / Gradle / Ivy

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

package app.bsky.richtext

import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface FacetFeatureUnion {
  public class MentionSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.richtext.facet#mention",
    constructor = ::Mention,
    valueProvider = Mention::value,
    valueSerializerProvider = { FacetMention.serializer() },
  )

  @Serializable(with = MentionSerializer::class)
  @JvmInline
  @SerialName("app.bsky.richtext.facet#mention")
  public value class Mention(
    public val `value`: FacetMention,
  ) : FacetFeatureUnion

  public class LinkSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.richtext.facet#link",
    constructor = ::Link,
    valueProvider = Link::value,
    valueSerializerProvider = { FacetLink.serializer() },
  )

  @Serializable(with = LinkSerializer::class)
  @JvmInline
  @SerialName("app.bsky.richtext.facet#link")
  public value class Link(
    public val `value`: FacetLink,
  ) : FacetFeatureUnion

  public class TagSerializer : KSerializer by valueClassSerializer(
    serialName = "app.bsky.richtext.facet#tag",
    constructor = ::Tag,
    valueProvider = Tag::value,
    valueSerializerProvider = { FacetTag.serializer() },
  )

  @Serializable(with = TagSerializer::class)
  @JvmInline
  @SerialName("app.bsky.richtext.facet#tag")
  public value class Tag(
    public val `value`: FacetTag,
  ) : FacetFeatureUnion
}

/**
 * Annotation of a sub-string within rich text.
 */
@Serializable
public data class Facet(
  public val index: FacetByteSlice,
  public val features: ReadOnlyList,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy