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

commonMain.app.bsky.graph.Token.kt Maven / Gradle / Ivy

The newest version!
package app.bsky.graph

import kotlin.String
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.AtpEnum
import sh.christian.ozone.api.runtime.stringEnumSerializer

public class TokenSerializer : KSerializer by stringEnumSerializer(Token::safeValueOf)

@Serializable(with = TokenSerializer::class)
public sealed class Token(
  override val `value`: String,
) : AtpEnum() {
  /**
   * A list of actors to apply an aggregate moderation action (mute/block) on.
   */
  public data object Modlist : Token("app.bsky.graph.defs#modlist")

  /**
   * A list of actors used for curation purposes such as list feeds or interaction gating.
   */
  public data object Curatelist : Token("app.bsky.graph.defs#curatelist")

  /**
   * A list of actors used for only for reference purposes such as within a starter pack.
   */
  public data object Referencelist : Token("app.bsky.graph.defs#referencelist")

  public data class Unknown(
    public val rawValue: String,
  ) : Token(rawValue)

  public companion object {
    public fun safeValueOf(`value`: String): Token = when (value) {
      "app.bsky.graph.defs#modlist" -> Modlist
      "app.bsky.graph.defs#curatelist" -> Curatelist
      "app.bsky.graph.defs#referencelist" -> Referencelist
      else -> Unknown(value)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy