jacquard-api 0.10.2

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: place.stream.graph.getFollowingUser
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct GetFollowingUser<'a> {
    #[serde(borrow)]
    pub subject_did: jacquard_common::types::string::Did<'a>,
    #[serde(borrow)]
    pub user_did: jacquard_common::types::string::Did<'a>,
}

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 {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type UserDid;
        type SubjectDid;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type UserDid = Unset;
        type SubjectDid = Unset;
    }
    ///State transition - sets the `user_did` field to Set
    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 UserDid = Set<members::user_did>;
        type SubjectDid = S::SubjectDid;
    }
    ///State transition - sets the `subject_did` field to Set
    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 UserDid = S::UserDid;
        type SubjectDid = Set<members::subject_did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `user_did` field
        pub struct user_did(());
        ///Marker type for the `subject_did` field
        pub struct subject_did(());
    }
}

/// Builder for constructing an instance of this type
pub struct GetFollowingUserBuilder<'a, S: get_following_user_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::types::string::Did<'a>>,
    ),
    _phantom: ::core::marker::PhantomData<&'a ()>,
}

impl<'a> GetFollowingUser<'a> {
    /// Create a new builder for this type
    pub fn new() -> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
        GetFollowingUserBuilder::new()
    }
}

impl<'a> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        GetFollowingUserBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: (None, None),
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S> GetFollowingUserBuilder<'a, S>
where
    S: get_following_user_state::State,
    S::SubjectDid: get_following_user_state::IsUnset,
{
    /// Set the `subjectDID` field (required)
    pub fn subject_did(
        mut self,
        value: impl Into<jacquard_common::types::string::Did<'a>>,
    ) -> GetFollowingUserBuilder<'a, get_following_user_state::SetSubjectDid<S>> {
        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
        GetFollowingUserBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S> GetFollowingUserBuilder<'a, S>
where
    S: get_following_user_state::State,
    S::UserDid: get_following_user_state::IsUnset,
{
    /// Set the `userDID` field (required)
    pub fn user_did(
        mut self,
        value: impl Into<jacquard_common::types::string::Did<'a>>,
    ) -> GetFollowingUserBuilder<'a, get_following_user_state::SetUserDid<S>> {
        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
        GetFollowingUserBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S> GetFollowingUserBuilder<'a, S>
where
    S: get_following_user_state::State,
    S::UserDid: get_following_user_state::IsSet,
    S::SubjectDid: get_following_user_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> GetFollowingUser<'a> {
        GetFollowingUser {
            subject_did: self.__unsafe_private_named.0.unwrap(),
            user_did: self.__unsafe_private_named.1.unwrap(),
        }
    }
}

#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic,
    Default
)]
#[serde(rename_all = "camelCase")]
pub struct GetFollowingUserOutput<'a> {
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub follow: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
}

/// Response type for
///place.stream.graph.getFollowingUser
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;
}

/// Endpoint type for
///place.stream.graph.getFollowingUser
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;
}