commonMain.com.atproto.repo.applyWrites.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bluesky Show documentation
Show all versions of bluesky Show documentation
Bluesky Social API bindings for Kotlin.
The newest version!
@file:Suppress("DEPRECATION")
package com.atproto.repo
import kotlin.Boolean
import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.collections.immutable.persistentListOf
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.AtIdentifier
import sh.christian.ozone.api.Cid
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.runtime.valueClassSerializer
@Serializable
public sealed interface ApplyWritesRequestWriteUnion {
public class CreateSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#create",
constructor = ::Create,
valueProvider = Create::value,
valueSerializerProvider = { ApplyWritesCreate.serializer() },
)
@Serializable(with = CreateSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#create")
public value class Create(
public val `value`: ApplyWritesCreate,
) : ApplyWritesRequestWriteUnion
public class UpdateSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#update",
constructor = ::Update,
valueProvider = Update::value,
valueSerializerProvider = { ApplyWritesUpdate.serializer() },
)
@Serializable(with = UpdateSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#update")
public value class Update(
public val `value`: ApplyWritesUpdate,
) : ApplyWritesRequestWriteUnion
public class DeleteSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#delete",
constructor = ::Delete,
valueProvider = Delete::value,
valueSerializerProvider = { ApplyWritesDelete.serializer() },
)
@Serializable(with = DeleteSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#delete")
public value class Delete(
public val `value`: ApplyWritesDelete,
) : ApplyWritesRequestWriteUnion
}
@Serializable
public sealed interface ApplyWritesResponseResultUnion {
public class CreateResultSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#createResult",
constructor = ::CreateResult,
valueProvider = CreateResult::value,
valueSerializerProvider = { ApplyWritesCreateResult.serializer() },
)
@Serializable(with = CreateResultSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#createResult")
public value class CreateResult(
public val `value`: ApplyWritesCreateResult,
) : ApplyWritesResponseResultUnion
public class UpdateResultSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#updateResult",
constructor = ::UpdateResult,
valueProvider = UpdateResult::value,
valueSerializerProvider = { ApplyWritesUpdateResult.serializer() },
)
@Serializable(with = UpdateResultSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#updateResult")
public value class UpdateResult(
public val `value`: ApplyWritesUpdateResult,
) : ApplyWritesResponseResultUnion
public class DeleteResultSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.repo.applyWrites#deleteResult",
constructor = ::DeleteResult,
valueProvider = DeleteResult::value,
valueSerializerProvider = { ApplyWritesDeleteResult.serializer() },
)
@Serializable(with = DeleteResultSerializer::class)
@JvmInline
@SerialName("com.atproto.repo.applyWrites#deleteResult")
public value class DeleteResult(
public val `value`: ApplyWritesDeleteResult,
) : ApplyWritesResponseResultUnion
}
/**
* @param repo The handle or DID of the repo (aka, current account).
* @param validate Can be set to 'false' to skip Lexicon schema validation of record data across all
* operations, 'true' to require it, or leave unset to validate only for known Lexicons.
* @param swapCommit If provided, the entire operation will fail if the current repo commit CID does
* not match this value. Used to prevent conflicting repo mutations.
*/
@Serializable
public data class ApplyWritesRequest(
/**
* The handle or DID of the repo (aka, current account).
*/
public val repo: AtIdentifier,
/**
* Can be set to 'false' to skip Lexicon schema validation of record data across all operations,
* 'true' to require it, or leave unset to validate only for known Lexicons.
*/
public val validate: Boolean? = null,
public val writes: ReadOnlyList,
/**
* If provided, the entire operation will fail if the current repo commit CID does not match this
* value. Used to prevent conflicting repo mutations.
*/
public val swapCommit: Cid? = null,
)
@Serializable
public data class ApplyWritesResponse(
public val commit: CommitMeta? = null,
public val results: ReadOnlyList = persistentListOf(),
)