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/ci/triggerPipeline.json (sh.tangled.ci.triggerPipeline)

#![allow(clippy::all)]

pub const NSID: &str = "sh.tangled.ci.triggerPipeline";

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Input {
    /// Target repository DID. Auth is checked against this repo.
    pub repo: String,
    pub trigger: serde_json::Value,
    /// Workflow names to run. When not provided, every dispatchable workflow is run.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub workflows: Option<Vec<String>>,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    /// AT-URI of the created pipeline
    pub pipeline: String,
}

/// Trigger a pipeline at an explicit commit. Runs the named workflows, or every workflow defined in the repo when none are named.
///
/// Errors:
/// - `InvalidRequest`: Invalid request parameters
pub fn trigger_pipeline(
    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
}