#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::AtUri;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DeleteBranch<S: BosStr = DefaultStr> {
pub branch: S,
pub repo: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct DeleteBranchResponse;
impl jacquard_common::xrpc::XrpcResp for DeleteBranchResponse {
const NSID: &'static str = "sh.tangled.repo.deleteBranch";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = ();
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for DeleteBranch<S> {
const NSID: &'static str = "sh.tangled.repo.deleteBranch";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = DeleteBranchResponse;
}
pub struct DeleteBranchRequest;
impl jacquard_common::xrpc::XrpcEndpoint for DeleteBranchRequest {
const PATH: &'static str = "/xrpc/sh.tangled.repo.deleteBranch";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = DeleteBranch<S>;
type Response = DeleteBranchResponse;
}
pub mod delete_branch_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Repo;
type Branch;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Repo = Unset;
type Branch = Unset;
}
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 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 Repo = St::Repo;
type Branch = Set<members::branch>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct repo(());
pub struct branch(());
}
}
pub struct DeleteBranchBuilder<S: BosStr, St: delete_branch_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> DeleteBranch<S> {
pub fn new() -> DeleteBranchBuilder<S, delete_branch_state::Empty> {
DeleteBranchBuilder::new()
}
}
impl<S: BosStr> DeleteBranchBuilder<S, delete_branch_state::Empty> {
pub fn new() -> Self {
DeleteBranchBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> DeleteBranchBuilder<S, St>
where
St: delete_branch_state::State,
St::Branch: delete_branch_state::IsUnset,
{
pub fn branch(
mut self,
value: impl Into<S>,
) -> DeleteBranchBuilder<S, delete_branch_state::SetBranch<St>> {
self._fields.0 = Option::Some(value.into());
DeleteBranchBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> DeleteBranchBuilder<S, St>
where
St: delete_branch_state::State,
St::Repo: delete_branch_state::IsUnset,
{
pub fn repo(
mut self,
value: impl Into<AtUri<S>>,
) -> DeleteBranchBuilder<S, delete_branch_state::SetRepo<St>> {
self._fields.1 = Option::Some(value.into());
DeleteBranchBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> DeleteBranchBuilder<S, St>
where
St: delete_branch_state::State,
St::Repo: delete_branch_state::IsSet,
St::Branch: delete_branch_state::IsSet,
{
pub fn build(self) -> DeleteBranch<S> {
DeleteBranch {
branch: self._fields.0.unwrap(),
repo: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> DeleteBranch<S> {
DeleteBranch {
branch: self._fields.0.unwrap(),
repo: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}