#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::types::string::Did;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SendNotification<'a> {
#[serde(borrow)]
pub from: Did<'a>,
#[serde(borrow)]
pub to: Did<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct SendNotificationOutput<'a> {}
pub struct SendNotificationResponse;
impl jacquard_common::xrpc::XrpcResp for SendNotificationResponse {
const NSID: &'static str = "app.bsky.contact.sendNotification";
const ENCODING: &'static str = "application/json";
type Output<'de> = SendNotificationOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for SendNotification<'a> {
const NSID: &'static str = "app.bsky.contact.sendNotification";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = SendNotificationResponse;
}
pub struct SendNotificationRequest;
impl jacquard_common::xrpc::XrpcEndpoint for SendNotificationRequest {
const PATH: &'static str = "/xrpc/app.bsky.contact.sendNotification";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<'de> = SendNotification<'de>;
type Response = SendNotificationResponse;
}
pub mod send_notification_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 From;
type To;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type From = Unset;
type To = Unset;
}
pub struct SetFrom<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFrom<S> {}
impl<S: State> State for SetFrom<S> {
type From = Set<members::from>;
type To = S::To;
}
pub struct SetTo<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTo<S> {}
impl<S: State> State for SetTo<S> {
type From = S::From;
type To = Set<members::to>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct from(());
pub struct to(());
}
}
pub struct SendNotificationBuilder<'a, S: send_notification_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Did<'a>>, Option<Did<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SendNotification<'a> {
pub fn new() -> SendNotificationBuilder<'a, send_notification_state::Empty> {
SendNotificationBuilder::new()
}
}
impl<'a> SendNotificationBuilder<'a, send_notification_state::Empty> {
pub fn new() -> Self {
SendNotificationBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SendNotificationBuilder<'a, S>
where
S: send_notification_state::State,
S::From: send_notification_state::IsUnset,
{
pub fn from(
mut self,
value: impl Into<Did<'a>>,
) -> SendNotificationBuilder<'a, send_notification_state::SetFrom<S>> {
self._fields.0 = Option::Some(value.into());
SendNotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SendNotificationBuilder<'a, S>
where
S: send_notification_state::State,
S::To: send_notification_state::IsUnset,
{
pub fn to(
mut self,
value: impl Into<Did<'a>>,
) -> SendNotificationBuilder<'a, send_notification_state::SetTo<S>> {
self._fields.1 = Option::Some(value.into());
SendNotificationBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SendNotificationBuilder<'a, S>
where
S: send_notification_state::State,
S::From: send_notification_state::IsSet,
S::To: send_notification_state::IsSet,
{
pub fn build(self) -> SendNotification<'a> {
SendNotification {
from: self._fields.0.unwrap(),
to: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SendNotification<'a> {
SendNotification {
from: self._fields.0.unwrap(),
to: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}