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/repo/getDefaultBranch.json (sh.tangled.repo.getDefaultBranch)

#![allow(clippy::all)]

pub const NSID: &str = "sh.tangled.repo.getDefaultBranch";

#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
    /// Repository identifier in format 'did:plc:.../repoName'
    pub repo: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub author: Option<
        crate::lexicon::sh::tangled::repo::get_default_branch::Signature,
    >,
    /// Latest commit hash on default branch
    pub hash: String,
    /// Latest commit message
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub message: Option<String>,
    /// Default branch name
    pub name: String,
    /// Short commit hash
    #[serde(
        rename = "shortHash",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub short_hash: Option<String>,
    /// Timestamp of latest commit
    pub when: String,
}

///
/// Errors:
/// - `RepoNotFound`: Repository not found or access denied
/// - `InvalidRequest`: Invalid request parameters
pub fn get_default_branch(
    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
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Signature {
    /// Author email
    pub email: String,
    /// Author name
    pub name: String,
    /// Author timestamp
    pub when: String,
    /// Unknown fields, preserved across read-modify-write round-trips.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}