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

commonMain.com.atproto.repo.putRecord.kt Maven / Gradle / Ivy

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

package com.atproto.repo

import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.AtIdentifier
import sh.christian.ozone.api.AtUri
import sh.christian.ozone.api.Cid
import sh.christian.ozone.api.Nsid
import sh.christian.ozone.api.model.JsonContent

/**
 * @param repo The handle or DID of the repo (aka, current account).
 * @param collection The NSID of the record collection.
 * @param rkey The Record Key.
 * @param validate Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to
 * require it, or leave unset to validate only for known Lexicons.
 * @param record The record to write.
 * @param swapRecord Compare and swap with the previous record by CID. WARNING: nullable and
 * optional field; may cause problems with golang implementation
 * @param swapCommit Compare and swap with the previous commit by CID.
 */
@Serializable
public data class PutRecordRequest(
  /**
   * The handle or DID of the repo (aka, current account).
   */
  public val repo: AtIdentifier,
  /**
   * The NSID of the record collection.
   */
  public val collection: Nsid,
  /**
   * The Record Key.
   */
  public val rkey: String,
  /**
   * Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it,
   * or leave unset to validate only for known Lexicons.
   */
  public val validate: Boolean? = null,
  /**
   * The record to write.
   */
  public val record: JsonContent,
  /**
   * Compare and swap with the previous record by CID. WARNING: nullable and optional field; may
   * cause problems with golang implementation
   */
  public val swapRecord: Cid? = null,
  /**
   * Compare and swap with the previous commit by CID.
   */
  public val swapCommit: Cid? = null,
) {
  init {
    require(rkey.count() <= 512) {
      "rkey.count() must be <= 512, but was ${rkey.count()}"
    }
  }
}

@Serializable
public data class PutRecordResponse(
  public val uri: AtUri,
  public val cid: Cid,
  public val commit: CommitMeta? = null,
  public val validationStatus: PutRecordValidationStatus? = null,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy