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

commonMain.com.atproto.label.Label.kt Maven / Gradle / Ivy

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

package com.atproto.label

import kotlin.Boolean
import kotlin.ByteArray
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlinx.serialization.Serializable
import kotlinx.serialization.cbor.ByteString
import sh.christian.ozone.api.Cid
import sh.christian.ozone.api.Did
import sh.christian.ozone.api.Uri
import sh.christian.ozone.api.model.Timestamp

/**
 * Metadata tag on an atproto resource (eg, repo or record).
 *
 * @param ver The AT Protocol version of the label object.
 * @param src DID of the actor who created this label.
 * @param uri AT URI of the record, repository (account), or other resource that this label applies
 * to.
 * @param cid Optionally, CID specifying the specific version of 'uri' resource this label applies
 * to.
 * @param val The short string name of the value or type of this label.
 * @param neg If true, this is a negation label, overwriting a previous label.
 * @param cts Timestamp when this label was created.
 * @param exp Timestamp at which this label expires (no longer applies).
 * @param sig Signature of dag-cbor encoded label.
 */
@Serializable
public data class Label(
  /**
   * The AT Protocol version of the label object.
   */
  public val ver: Long? = null,
  /**
   * DID of the actor who created this label.
   */
  public val src: Did,
  /**
   * AT URI of the record, repository (account), or other resource that this label applies to.
   */
  public val uri: Uri,
  /**
   * Optionally, CID specifying the specific version of 'uri' resource this label applies to.
   */
  public val cid: Cid? = null,
  /**
   * The short string name of the value or type of this label.
   */
  public val `val`: String,
  /**
   * If true, this is a negation label, overwriting a previous label.
   */
  public val neg: Boolean? = null,
  /**
   * Timestamp when this label was created.
   */
  public val cts: Timestamp,
  /**
   * Timestamp at which this label expires (no longer applies).
   */
  public val exp: Timestamp? = null,
  /**
   * Signature of dag-cbor encoded label.
   */
  @ByteString
  public val sig: ByteArray? = null,
) {
  init {
    require(`val`.count() <= 128) {
      "val.count() must be <= 128, but was ${`val`.count()}"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy