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/getRecord.json (com.atproto.repo.getRecord)

#![allow(clippy::all)]

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

#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
    /// The CID of the version of the record. If not specified, then return the most recent version.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<String>,
    /// The NSID of the record collection.
    pub collection: String,
    /// The handle or DID of the repo.
    pub repo: String,
    /// The Record Key.
    pub rkey: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub cid: Option<String>,
    pub uri: String,
    pub value: serde_json::Value,
}

/// Get a single record from a repository. Does not require auth.
///
/// Errors:
/// - `RecordNotFound`
pub fn get_record(
    http: &reqwest::Client,
    base: &str,
    params: &Params,
) -> reqwest::RequestBuilder {
    let rb = http.get(crate::xrpc::xrpc_url(base, NSID));
    let rb = rb.header(reqwest::header::ACCEPT, "application/json");
    let rb = crate::xrpc::push_query(rb, params);
    rb
}