// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.repo.applyWrites // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// Operation which creates a new record. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct Create<'a> { #[serde(borrow)] pub collection: jacquard_common::types::string::Nsid<'a>, /// NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub rkey: Option< jacquard_common::types::string::RecordKey< jacquard_common::types::string::Rkey<'a>, >, >, #[serde(borrow)] pub value: jacquard_common::types::value::Data<'a>, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct CreateResult<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub validation_status: Option>, } /// Operation which deletes an existing record. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct Delete<'a> { #[serde(borrow)] pub collection: jacquard_common::types::string::Nsid<'a>, #[serde(borrow)] pub rkey: jacquard_common::types::string::RecordKey< jacquard_common::types::string::Rkey<'a>, >, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct DeleteResult<'a> {} #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] #[builder(start_fn = new)] pub struct ApplyWrites<'a> { /// The handle or DID of the repo (aka, current account). #[serde(borrow)] pub repo: jacquard_common::types::ident::AtIdentifier<'a>, /// If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub swap_commit: Option>, /// 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. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] pub validate: Option, #[serde(borrow)] pub writes: Vec>, #[serde(flatten)] #[serde(borrow)] #[builder(default)] pub extra_data: ::std::collections::BTreeMap< ::jacquard_common::smol_str::SmolStr, ::jacquard_common::types::value::Data<'a>, >, } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum ApplyWritesWritesItem<'a> { #[serde(rename = "com.atproto.repo.applyWrites#create")] Create(Box>), #[serde(rename = "com.atproto.repo.applyWrites#update")] Update(Box>), #[serde(rename = "com.atproto.repo.applyWrites#delete")] Delete(Box>), } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct ApplyWritesOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub commit: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub results: std::option::Option>>, } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum ApplyWritesOutputResultsItem<'a> { #[serde(rename = "com.atproto.repo.applyWrites#createResult")] CreateResult(Box>), #[serde(rename = "com.atproto.repo.applyWrites#updateResult")] UpdateResult(Box>), #[serde(rename = "com.atproto.repo.applyWrites#deleteResult")] DeleteResult(Box>), } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum ApplyWritesError<'a> { /// Indicates that the 'swapCommit' parameter did not match current commit. #[serde(rename = "InvalidSwap")] InvalidSwap(std::option::Option), } impl std::fmt::Display for ApplyWritesError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::InvalidSwap(msg) => { write!(f, "InvalidSwap")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } ///Response type for ///com.atproto.repo.applyWrites pub struct ApplyWritesResponse; impl jacquard_common::xrpc::XrpcResp for ApplyWritesResponse { const NSID: &'static str = "com.atproto.repo.applyWrites"; const ENCODING: &'static str = "application/json"; type Output<'de> = ApplyWritesOutput<'de>; type Err<'de> = ApplyWritesError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for ApplyWrites<'a> { const NSID: &'static str = "com.atproto.repo.applyWrites"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = ApplyWritesResponse; } ///Endpoint type for ///com.atproto.repo.applyWrites pub struct ApplyWritesRequest; impl jacquard_common::xrpc::XrpcEndpoint for ApplyWritesRequest { const PATH: &'static str = "/xrpc/com.atproto.repo.applyWrites"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = ApplyWrites<'de>; type Response = ApplyWritesResponse; } /// Operation which updates an existing record. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct Update<'a> { #[serde(borrow)] pub collection: jacquard_common::types::string::Nsid<'a>, #[serde(borrow)] pub rkey: jacquard_common::types::string::RecordKey< jacquard_common::types::string::Rkey<'a>, >, #[serde(borrow)] pub value: jacquard_common::types::value::Data<'a>, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct UpdateResult<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub validation_status: Option>, }