#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::AtUri;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::sh_tangled::git::temp::analyze_merge;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ConflictInfo<S: BosStr = DefaultStr> {
pub filename: S,
pub reason: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct AnalyzeMerge<S: BosStr = DefaultStr> {
pub branch: S,
pub patch: S,
pub repo: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct AnalyzeMergeOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub conflicts: Option<Vec<analyze_merge::ConflictInfo<S>>>,
pub is_conflicted: bool,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for ConflictInfo<S> {
fn nsid() -> &'static str {
"sh.tangled.git.temp.analyzeMerge"
}
fn def_name() -> &'static str {
"conflictInfo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_tangled_git_temp_analyzeMerge()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub struct AnalyzeMergeResponse;
impl jacquard_common::xrpc::XrpcResp for AnalyzeMergeResponse {
const NSID: &'static str = "sh.tangled.git.temp.analyzeMerge";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = AnalyzeMergeOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for AnalyzeMerge<S> {
const NSID: &'static str = "sh.tangled.git.temp.analyzeMerge";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = AnalyzeMergeResponse;
}
pub struct AnalyzeMergeRequest;
impl jacquard_common::xrpc::XrpcEndpoint for AnalyzeMergeRequest {
const PATH: &'static str = "/xrpc/sh.tangled.git.temp.analyzeMerge";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = AnalyzeMerge<S>;
type Response = AnalyzeMergeResponse;
}
fn lexicon_doc_sh_tangled_git_temp_analyzeMerge() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("sh.tangled.git.temp.analyzeMerge"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("conflictInfo"),
LexUserType::Object(LexObject {
required: Some(vec![
SmolStr::new_static("filename"),
SmolStr::new_static("reason"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("filename"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static(
"Name of the conflicted file",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("reason"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Reason for the conflict")),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![
SmolStr::new_static("repo"),
SmolStr::new_static("patch"),
SmolStr::new_static("branch"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("branch"),
LexXrpcParametersProperty::String(LexString {
description: Some(CowStr::new_static(
"Target branch to merge into",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("patch"),
LexXrpcParametersProperty::String(LexString {
description: Some(CowStr::new_static(
"Patch or pull request to check for merge conflicts",
)),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("repo"),
LexXrpcParametersProperty::String(LexString {
description: Some(CowStr::new_static(
"AT-URI of the repository",
)),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
})),
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod analyze_merge_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Patch;
type Repo;
type Branch;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Patch = Unset;
type Repo = Unset;
type Branch = Unset;
}
pub struct SetPatch<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPatch<St> {}
impl<St: State> State for SetPatch<St> {
type Patch = Set<members::patch>;
type Repo = St::Repo;
type Branch = St::Branch;
}
pub struct SetRepo<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRepo<St> {}
impl<St: State> State for SetRepo<St> {
type Patch = St::Patch;
type Repo = Set<members::repo>;
type Branch = St::Branch;
}
pub struct SetBranch<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBranch<St> {}
impl<St: State> State for SetBranch<St> {
type Patch = St::Patch;
type Repo = St::Repo;
type Branch = Set<members::branch>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct patch(());
pub struct repo(());
pub struct branch(());
}
}
pub struct AnalyzeMergeBuilder<S: BosStr, St: analyze_merge_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> AnalyzeMerge<S> {
pub fn new() -> AnalyzeMergeBuilder<S, analyze_merge_state::Empty> {
AnalyzeMergeBuilder::new()
}
}
impl<S: BosStr> AnalyzeMergeBuilder<S, analyze_merge_state::Empty> {
pub fn new() -> Self {
AnalyzeMergeBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AnalyzeMergeBuilder<S, St>
where
St: analyze_merge_state::State,
St::Branch: analyze_merge_state::IsUnset,
{
pub fn branch(
mut self,
value: impl Into<S>,
) -> AnalyzeMergeBuilder<S, analyze_merge_state::SetBranch<St>> {
self._fields.0 = Option::Some(value.into());
AnalyzeMergeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AnalyzeMergeBuilder<S, St>
where
St: analyze_merge_state::State,
St::Patch: analyze_merge_state::IsUnset,
{
pub fn patch(
mut self,
value: impl Into<S>,
) -> AnalyzeMergeBuilder<S, analyze_merge_state::SetPatch<St>> {
self._fields.1 = Option::Some(value.into());
AnalyzeMergeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AnalyzeMergeBuilder<S, St>
where
St: analyze_merge_state::State,
St::Repo: analyze_merge_state::IsUnset,
{
pub fn repo(
mut self,
value: impl Into<AtUri<S>>,
) -> AnalyzeMergeBuilder<S, analyze_merge_state::SetRepo<St>> {
self._fields.2 = Option::Some(value.into());
AnalyzeMergeBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> AnalyzeMergeBuilder<S, St>
where
St: analyze_merge_state::State,
St::Patch: analyze_merge_state::IsSet,
St::Repo: analyze_merge_state::IsSet,
St::Branch: analyze_merge_state::IsSet,
{
pub fn build(self) -> AnalyzeMerge<S> {
AnalyzeMerge {
branch: self._fields.0.unwrap(),
patch: self._fields.1.unwrap(),
repo: self._fields.2.unwrap(),
}
}
}