#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Delete<'a> {
#[serde(borrow)]
pub did: jacquard_common::types::string::Did<'a>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub rkey: jacquard_common::CowStr<'a>,
}
pub mod delete_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 Did;
type Name;
type Rkey;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
type Name = Unset;
type Rkey = Unset;
}
pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDid<S> {}
impl<S: State> State for SetDid<S> {
type Did = Set<members::did>;
type Name = S::Name;
type Rkey = S::Rkey;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Did = S::Did;
type Name = Set<members::name>;
type Rkey = S::Rkey;
}
pub struct SetRkey<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRkey<S> {}
impl<S: State> State for SetRkey<S> {
type Did = S::Did;
type Name = S::Name;
type Rkey = Set<members::rkey>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
pub struct name(());
pub struct rkey(());
}
}
pub struct DeleteBuilder<'a, S: delete_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Did<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Delete<'a> {
pub fn new() -> DeleteBuilder<'a, delete_state::Empty> {
DeleteBuilder::new()
}
}
impl<'a> DeleteBuilder<'a, delete_state::Empty> {
pub fn new() -> Self {
DeleteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DeleteBuilder<'a, S>
where
S: delete_state::State,
S::Did: delete_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<jacquard_common::types::string::Did<'a>>,
) -> DeleteBuilder<'a, delete_state::SetDid<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
DeleteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DeleteBuilder<'a, S>
where
S: delete_state::State,
S::Name: delete_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> DeleteBuilder<'a, delete_state::SetName<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
DeleteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DeleteBuilder<'a, S>
where
S: delete_state::State,
S::Rkey: delete_state::IsUnset,
{
pub fn rkey(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> DeleteBuilder<'a, delete_state::SetRkey<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
DeleteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> DeleteBuilder<'a, S>
where
S: delete_state::State,
S::Did: delete_state::IsSet,
S::Name: delete_state::IsSet,
S::Rkey: delete_state::IsSet,
{
pub fn build(self) -> Delete<'a> {
Delete {
did: self.__unsafe_private_named.0.unwrap(),
name: self.__unsafe_private_named.1.unwrap(),
rkey: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Delete<'a> {
Delete {
did: self.__unsafe_private_named.0.unwrap(),
name: self.__unsafe_private_named.1.unwrap(),
rkey: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub struct DeleteResponse;
impl jacquard_common::xrpc::XrpcResp for DeleteResponse {
const NSID: &'static str = "sh.tangled.repo.delete";
const ENCODING: &'static str = "application/json";
type Output<'de> = ();
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for Delete<'a> {
const NSID: &'static str = "sh.tangled.repo.delete";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = DeleteResponse;
}
pub struct DeleteRequest;
impl jacquard_common::xrpc::XrpcEndpoint for DeleteRequest {
const PATH: &'static str = "/xrpc/sh.tangled.repo.delete";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<'de> = Delete<'de>;
type Response = DeleteResponse;
}