#![allow(clippy::all)]
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct LastCommit {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub author: Option<crate::lexicon::sh::tangled::repo::tree::Signature>,
pub hash: String,
pub message: String,
pub when: String,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
pub const NSID: &str = "sh.tangled.repo.tree";
#[derive(Debug, Clone, Default, serde::Serialize)]
pub struct Params {
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<String>,
pub r#ref: String,
pub repo: String,
}
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Output {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub dotdot: Option<String>,
pub files: Vec<crate::lexicon::sh::tangled::repo::tree::TreeEntry>,
#[serde(
rename = "lastCommit",
skip_serializing_if = "Option::is_none",
default
)]
pub last_commit:
Option<crate::lexicon::sh::tangled::repo::tree::LastCommit>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub parent: Option<String>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub readme: Option<crate::lexicon::sh::tangled::repo::tree::Readme>,
pub r#ref: String,
}
pub fn tree(
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 Readme {
pub contents: String,
pub filename: String,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct Signature {
pub email: String,
pub name: String,
pub when: String,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct TreeEntry {
#[serde(skip_serializing_if = "Option::is_none", default)]
pub last_commit:
Option<crate::lexicon::sh::tangled::repo::tree::LastCommit>,
pub mode: String,
pub name: String,
pub size: i64,
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}