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

#![allow(clippy::all)]

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

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Input {
    /// Branch to check status for
    pub branch: String,
    /// DID of the fork owner
    pub did: String,
    /// Hidden ref to use for comparison
    #[serde(rename = "hiddenRef")]
    pub hidden_ref: String,
    /// Name of the forked repository
    pub name: String,
    /// Source repository URL
    pub source: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    /// Fork status: 0=UpToDate, 1=FastForwardable, 2=Conflict, 3=MissingBranch
    pub status: i64,
}

/// Check fork status relative to upstream source
pub fn fork_status(
    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
}