#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Did;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetFollowingUser<S: BosStr = DefaultStr> {
pub subject_did: Did<S>,
pub user_did: Did<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetFollowingUserOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub follow: Option<StrongRef<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
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<S: BosStr> = GetFollowingUserOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetFollowingUser<S> {
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<S: BosStr> = GetFollowingUser<S>;
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubjectDid<St> {}
impl<St: State> State for SetSubjectDid<St> {
type SubjectDid = Set<members::subject_did>;
type UserDid = St::UserDid;
}
pub struct SetUserDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUserDid<St> {}
impl<St: State> State for SetUserDid<St> {
type SubjectDid = St::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<S: BosStr, St: get_following_user_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>, Option<Did<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetFollowingUser<S> {
pub fn new() -> GetFollowingUserBuilder<S, get_following_user_state::Empty> {
GetFollowingUserBuilder::new()
}
}
impl<S: BosStr> GetFollowingUserBuilder<S, get_following_user_state::Empty> {
pub fn new() -> Self {
GetFollowingUserBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetFollowingUserBuilder<S, St>
where
St: get_following_user_state::State,
St::SubjectDid: get_following_user_state::IsUnset,
{
pub fn subject_did(
mut self,
value: impl Into<Did<S>>,
) -> GetFollowingUserBuilder<S, get_following_user_state::SetSubjectDid<St>> {
self._fields.0 = Option::Some(value.into());
GetFollowingUserBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetFollowingUserBuilder<S, St>
where
St: get_following_user_state::State,
St::UserDid: get_following_user_state::IsUnset,
{
pub fn user_did(
mut self,
value: impl Into<Did<S>>,
) -> GetFollowingUserBuilder<S, get_following_user_state::SetUserDid<St>> {
self._fields.1 = Option::Some(value.into());
GetFollowingUserBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetFollowingUserBuilder<S, St>
where
St: get_following_user_state::State,
St::SubjectDid: get_following_user_state::IsSet,
St::UserDid: get_following_user_state::IsSet,
{
pub fn build(self) -> GetFollowingUser<S> {
GetFollowingUser {
subject_did: self._fields.0.unwrap(),
user_did: self._fields.1.unwrap(),
}
}
}