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() {
  public data object Modlist : Token("app.bsky.graph.defs#modlist")

  public data object Curatelist : Token("app.bsky.graph.defs#curatelist")

  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