#[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};
use crate::com_atproto::repo::strong_ref::StrongRef;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetFollowingUser<'a> {
#[serde(borrow)]
pub subject_did: Did<'a>,
#[serde(borrow)]
pub user_did: Did<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetFollowingUserOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub follow: Option<StrongRef<'a>>,
}
pub struct GetFollowingUserResponse;
impl jacquard_common::xrpc::XrpcResp for GetFollowingUserResponse {
const NSID: &'static str = "place.stream.graph.getFollowingUser";
const ENCODING: &'static str = "application/json";
type Output<'de> = GetFollowingUserOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for GetFollowingUser<'a> {
const NSID: &'static str = "place.stream.graph.getFollowingUser";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetFollowingUserResponse;
}
pub struct GetFollowingUserRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetFollowingUserRequest {
const PATH: &'static str = "/xrpc/place.stream.graph.getFollowingUser";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<'de> = GetFollowingUser<'de>;
type Response = GetFollowingUserResponse;
}
pub mod get_following_user_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 SubjectDid;
type UserDid;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type SubjectDid = Unset;
type UserDid = Unset;
}
pub struct SetSubjectDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubjectDid<S> {}
impl<S: State> State for SetSubjectDid<S> {
type SubjectDid = Set<members::subject_did>;
type UserDid = S::UserDid;
}
pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUserDid<S> {}
impl<S: State> State for SetUserDid<S> {
type SubjectDid = S::SubjectDid;
type UserDid = Set<members::user_did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct subject_did(());
pub struct user_did(());
}
}
pub struct GetFollowingUserBuilder<'a, S: get_following_user_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Did<'a>>, Option<Did<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> GetFollowingUser<'a> {
pub fn new() -> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
GetFollowingUserBuilder::new()
}
}
impl<'a> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
pub fn new() -> Self {
GetFollowingUserBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetFollowingUserBuilder<'a, S>
where
S: get_following_user_state::State,
S::SubjectDid: get_following_user_state::IsUnset,
{
pub fn subject_did(
mut self,
value: impl Into<Did<'a>>,
) -> GetFollowingUserBuilder<'a, get_following_user_state::SetSubjectDid<S>> {
self._fields.0 = Option::Some(value.into());
GetFollowingUserBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetFollowingUserBuilder<'a, S>
where
S: get_following_user_state::State,
S::UserDid: get_following_user_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<Did<'a>>,
) -> GetFollowingUserBuilder<'a, get_following_user_state::SetUserDid<S>> {
self._fields.1 = Option::Some(value.into());
GetFollowingUserBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> GetFollowingUserBuilder<'a, S>
where
S: get_following_user_state::State,
S::SubjectDid: get_following_user_state::IsSet,
S::UserDid: get_following_user_state::IsSet,
{
pub fn build(self) -> GetFollowingUser<'a> {
GetFollowingUser {
subject_did: self._fields.0.unwrap(),
user_did: self._fields.1.unwrap(),
}
}
}