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() {
  /**
   * Spam: frequent unwanted promotion, replies, mentions
   */
  public data object ReasonSpam : Token("com.atproto.moderation.defs#reasonSpam")

  /**
   * Direct violation of server rules, laws, terms of service
   */
  public data object ReasonViolation : Token("com.atproto.moderation.defs#reasonViolation")

  /**
   * Misleading identity, affiliation, or content
   */
  public data object ReasonMisleading : Token("com.atproto.moderation.defs#reasonMisleading")

  /**
   * Unwanted or mislabeled sexual content
   */
  public data object ReasonSexual : Token("com.atproto.moderation.defs#reasonSexual")

  /**
   * Rude, harassing, explicit, or otherwise unwelcoming behavior
   */
  public data object ReasonRude : Token("com.atproto.moderation.defs#reasonRude")

  /**
   * Other: reports not falling under another report category
   */
  public data object ReasonOther : Token("com.atproto.moderation.defs#reasonOther")

  /**
   * Appeal: appeal a previously taken moderation action
   */
  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