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

#![allow(clippy::all)]

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct ConflictInfo {
    /// Name of the conflicted file
    pub filename: String,
    /// Reason for the conflict
    pub reason: String,
    /// Unknown fields, preserved across read-modify-write round-trips.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}

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

#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
    /// Target branch to merge into
    pub branch: String,
    /// Patch or pull request to check for merge conflicts
    pub patch: String,
    /// DID of the repository
    pub repo: String,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    /// List of files with merge conflicts
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub conflicts: Option<
        Vec<
            crate::lexicon::sh::tangled::git::temp::analyze_merge::ConflictInfo,
        >,
    >,
    /// Whether the merge has conflicts
    pub is_conflicted: bool,
}

/// Check if a merge is possible between two branches
pub fn analyze_merge(
    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
}