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/git/temp/getEntry.json (sh.tangled.git.temp.getEntry)

#![allow(clippy::all)]

pub const NSID: &str = "sh.tangled.git.temp.getEntry";

#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
    /// path of the entity
    pub path: String,
    /// Git revision (branch, tag, or commit id)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#ref: Option<String>,
    /// DID of the repository
    pub repo: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(
        rename = "lastCommit",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub last_commit:
        Option<crate::lexicon::sh::tangled::git::temp::defs::Commit>,
    pub mode: String,
    /// The file name
    pub name: String,
    pub oid: String,
    /// Blob size
    pub size: i64,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub submodule:
        Option<crate::lexicon::sh::tangled::git::temp::defs::Submodule>,
}

/// get metadata of blob by ref and path
///
/// Errors:
/// - `RepoNotFound`: Repository not found or access denied
/// - `RefNotFound`: Git reference not found
/// - `EntryNotFound`: Entry not found
/// - `InvalidRequest`: Invalid request parameters
pub fn get_entry(
    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
}