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/sync/listRepos.json (sh.tangled.sync.listRepos)

#![allow(clippy::all)]

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct DefaultBranch {
    /// Commit SHA at the tip of the default branch, for reconciling against a last-known state. Width depends on the repo's git object-format.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub head: Option<String>,
    /// Default branch ref name, eg. refs/heads/main.
    pub r#ref: 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.sync.listRepos";

#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
    /// Pagination cursor
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    /// Sort direction over the service's repo listing order.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub order: Option<String>,
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub cursor: Option<String>,
    pub repos: Vec<crate::lexicon::sh::tangled::sync::list_repos::Repo>,
}

/// List git repos hosted on this service.
///
/// Errors:
/// - `InvalidRequest`: Invalid request parameters
pub fn list_repos(
    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
}

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Repo {
    #[serde(
        rename = "defaultBranch",
        skip_serializing_if = "Option::is_none",
        default
    )]
    pub default_branch:
        Option<crate::lexicon::sh::tangled::sync::list_repos::DefaultBranch>,
    /// DID of the git repo as minted by the knot
    pub repo: String,
    /// Serving status of the repo according to the knot.
    pub status: String,
    /// Unknown fields, preserved across read-modify-write round-trips.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}