tangled-api 0.1.0

Lexicon-generated XRPC client for Tangled and AT Protocol APIs
Documentation
// @generated by `cargo xtask codegen` — do not edit.
// source: lexicons/com/atproto/repo/deleteRecord.json (com.atproto.repo.deleteRecord)

#![allow(clippy::all)]

pub const NSID: &str = "com.atproto.repo.deleteRecord";

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Input {
    /// The NSID of the record collection.
    pub collection: String,
    /// The handle or DID of the repo (aka, current account).
    pub repo: String,
    /// The Record Key.
    pub rkey: String,
    /// Compare and swap with the previous commit by CID.
    #[serde(
        rename = "swapCommit",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub swap_commit: Option<String>,
    /// Compare and swap with the previous record by CID.
    #[serde(
        rename = "swapRecord",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub swap_record: Option<String>,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub commit: Option<crate::lexicon::com::atproto::repo::defs::CommitMeta>,
}

/// Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.
///
/// Errors:
/// - `InvalidSwap`
pub fn delete_record(
    http: &reqwest::Client,
    base: &str,
    input: &Input,
) -> reqwest::RequestBuilder {
    let rb = http.post(crate::xrpc::xrpc_url(base, NSID));
    let rb = rb.header(reqwest::header::ACCEPT, "application/json");
    let rb = rb.json(input);
    rb
}