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

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

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

package app.bsky.feed

import app.bsky.richtext.Facet
import kotlin.Boolean
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.Did
import sh.christian.ozone.api.model.Blob
import sh.christian.ozone.api.model.JsonContent
import sh.christian.ozone.api.model.Timestamp
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface GeneratorLabelsUnion {
  public class SelfLabelsSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.label.defs#selfLabels",
    constructor = ::SelfLabels,
    valueProvider = SelfLabels::value,
    valueSerializerProvider = { com.atproto.label.SelfLabels.serializer() },
  )

  @JvmInline
  @Serializable(with = SelfLabelsSerializer::class)
  @SerialName("com.atproto.label.defs#selfLabels")
  public value class SelfLabels(
    public val `value`: com.atproto.label.SelfLabels,
  ) : GeneratorLabelsUnion

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

/**
 * @param acceptsInteractions Declaration that a feed accepts feedback interactions from a client
 * through app.bsky.feed.sendInteractions
 * @param labels Self-label values
 */
@Serializable
public data class Generator(
  public val did: Did,
  public val displayName: String,
  public val description: String? = null,
  public val descriptionFacets: List = emptyList(),
  public val avatar: Blob? = null,
  /**
   * Declaration that a feed accepts feedback interactions from a client through
   * app.bsky.feed.sendInteractions
   */
  public val acceptsInteractions: Boolean? = null,
  /**
   * Self-label values
   */
  public val labels: GeneratorLabelsUnion? = null,
  public val createdAt: Timestamp,
) {
  init {
    require(displayName.count() <= 240) {
      "displayName.count() must be <= 240, but was ${displayName.count()}"
    }
    require(description == null || description.count() <= 3_000) {
      "description.count() must be <= 3_000, but was ${description?.count()}"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy