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

commonMain.com.atproto.moderation.Token.kt Maven / Gradle / Ivy

The newest version!
package com.atproto.moderation

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 ReasonSpam : Token("com.atproto.moderation.defs#reasonSpam")

  public data object ReasonViolation : Token("com.atproto.moderation.defs#reasonViolation")

  public data object ReasonMisleading : Token("com.atproto.moderation.defs#reasonMisleading")

  public data object ReasonSexual : Token("com.atproto.moderation.defs#reasonSexual")

  public data object ReasonRude : Token("com.atproto.moderation.defs#reasonRude")

  public data object ReasonOther : Token("com.atproto.moderation.defs#reasonOther")

  public data object ReasonAppeal : Token("com.atproto.moderation.defs#reasonAppeal")

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

  public companion object {
    public fun safeValueOf(`value`: String): Token = when (value) {
      "com.atproto.moderation.defs#reasonSpam" -> ReasonSpam
      "com.atproto.moderation.defs#reasonViolation" -> ReasonViolation
      "com.atproto.moderation.defs#reasonMisleading" -> ReasonMisleading
      "com.atproto.moderation.defs#reasonSexual" -> ReasonSexual
      "com.atproto.moderation.defs#reasonRude" -> ReasonRude
      "com.atproto.moderation.defs#reasonOther" -> ReasonOther
      "com.atproto.moderation.defs#reasonAppeal" -> ReasonAppeal
      else -> Unknown(value)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy