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

#![allow(clippy::all)]

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

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Input {
    /// Fork reference name
    #[serde(rename = "forkRef")]
    pub fork_ref: String,
    /// Remote reference name
    #[serde(rename = "remoteRef")]
    pub remote_ref: String,
    /// AT-URI of the repository
    pub repo: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    /// Error message if creation failed
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub error: Option<String>,
    /// The created hidden ref name
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub r#ref: Option<String>,
    /// Whether the hidden ref was created successfully
    pub success: bool,
}

/// Create a hidden ref in a repository
pub fn hidden_ref(
    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
}