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

#![allow(clippy::all)]

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

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Input {
    /// Default branch to push to
    #[serde(
        rename = "defaultBranch",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub default_branch: Option<String>,
    /// Name of the repository
    pub name: String,
    /// Optional user-provided did:web to use as the repo identity instead of minting a did:plc.
    #[serde(
        rename = "repoDid",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub repo_did: Option<String>,
    /// Rkey of the repository record
    pub rkey: String,
    /// A source URL to clone from, populate this when forking or importing a repository.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub source: Option<String>,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(
        rename = "repoDid",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub repo_did: Option<String>,
}

/// Create a new repository
pub fn create(
    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
}