#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::ident::AtIdentifier;
use jacquard_common::types::value::Data;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
use jacquard_derive::IntoStatic;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetParentForReply<S: BosStr = DefaultStr> {
pub did: AtIdentifier<S>,
pub rkey: S,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct GetParentForReplyOutput<S: BosStr = DefaultStr> {
pub did: AtIdentifier<S>,
pub rkey: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetParentForReplyResponse;
impl jacquard_common::xrpc::XrpcResp for GetParentForReplyResponse {
const NSID: &'static str = "com.shinolabs.pinksea.getParentForReply";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetParentForReplyOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetParentForReply<S> {
const NSID: &'static str = "com.shinolabs.pinksea.getParentForReply";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetParentForReplyResponse;
}
pub struct GetParentForReplyRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetParentForReplyRequest {
const PATH: &'static str = "/xrpc/com.shinolabs.pinksea.getParentForReply";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetParentForReply<S>;
type Response = GetParentForReplyResponse;
}
pub mod get_parent_for_reply_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 Rkey;
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Rkey = Unset;
type Did = Unset;
}
pub struct SetRkey<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRkey<St> {}
impl<St: State> State for SetRkey<St> {
type Rkey = Set<members::rkey>;
type Did = St::Did;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Rkey = St::Rkey;
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct rkey(());
pub struct did(());
}
}
pub struct GetParentForReplyBuilder<S: BosStr, St: get_parent_for_reply_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtIdentifier<S>>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetParentForReply<S> {
pub fn new() -> GetParentForReplyBuilder<S, get_parent_for_reply_state::Empty> {
GetParentForReplyBuilder::new()
}
}
impl<S: BosStr> GetParentForReplyBuilder<S, get_parent_for_reply_state::Empty> {
pub fn new() -> Self {
GetParentForReplyBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetParentForReplyBuilder<S, St>
where
St: get_parent_for_reply_state::State,
St::Did: get_parent_for_reply_state::IsUnset,
{
pub fn did(
mut self,
value: impl Into<AtIdentifier<S>>,
) -> GetParentForReplyBuilder<S, get_parent_for_reply_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
GetParentForReplyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetParentForReplyBuilder<S, St>
where
St: get_parent_for_reply_state::State,
St::Rkey: get_parent_for_reply_state::IsUnset,
{
pub fn rkey(
mut self,
value: impl Into<S>,
) -> GetParentForReplyBuilder<S, get_parent_for_reply_state::SetRkey<St>> {
self._fields.1 = Option::Some(value.into());
GetParentForReplyBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetParentForReplyBuilder<S, St>
where
St: get_parent_for_reply_state::State,
St::Rkey: get_parent_for_reply_state::IsSet,
St::Did: get_parent_for_reply_state::IsSet,
{
pub fn build(self) -> GetParentForReply<S> {
GetParentForReply {
did: self._fields.0.unwrap(),
rkey: self._fields.1.unwrap(),
}
}
}