Skip to main content

jacquard_api/place_stream/graph/
get_following_user.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.graph.getFollowingUser
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::string::Did;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16use crate::com_atproto::repo::strong_ref::StrongRef;
17
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct GetFollowingUser<'a> {
21    #[serde(borrow)]
22    pub subject_did: Did<'a>,
23    #[serde(borrow)]
24    pub user_did: Did<'a>,
25}
26
27
28#[lexicon]
29#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
30#[serde(rename_all = "camelCase")]
31pub struct GetFollowingUserOutput<'a> {
32    #[serde(skip_serializing_if = "Option::is_none")]
33    #[serde(borrow)]
34    pub follow: Option<StrongRef<'a>>,
35}
36
37/// Response type for place.stream.graph.getFollowingUser
38pub struct GetFollowingUserResponse;
39impl jacquard_common::xrpc::XrpcResp for GetFollowingUserResponse {
40    const NSID: &'static str = "place.stream.graph.getFollowingUser";
41    const ENCODING: &'static str = "application/json";
42    type Output<'de> = GetFollowingUserOutput<'de>;
43    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
44}
45
46impl<'a> jacquard_common::xrpc::XrpcRequest for GetFollowingUser<'a> {
47    const NSID: &'static str = "place.stream.graph.getFollowingUser";
48    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
49    type Response = GetFollowingUserResponse;
50}
51
52/// Endpoint type for place.stream.graph.getFollowingUser
53pub struct GetFollowingUserRequest;
54impl jacquard_common::xrpc::XrpcEndpoint for GetFollowingUserRequest {
55    const PATH: &'static str = "/xrpc/place.stream.graph.getFollowingUser";
56    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
57    type Request<'de> = GetFollowingUser<'de>;
58    type Response = GetFollowingUserResponse;
59}
60
61pub mod get_following_user_state {
62
63    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
64    #[allow(unused)]
65    use ::core::marker::PhantomData;
66    mod sealed {
67        pub trait Sealed {}
68    }
69    /// State trait tracking which required fields have been set
70    pub trait State: sealed::Sealed {
71        type SubjectDid;
72        type UserDid;
73    }
74    /// Empty state - all required fields are unset
75    pub struct Empty(());
76    impl sealed::Sealed for Empty {}
77    impl State for Empty {
78        type SubjectDid = Unset;
79        type UserDid = Unset;
80    }
81    ///State transition - sets the `subject_did` field to Set
82    pub struct SetSubjectDid<S: State = Empty>(PhantomData<fn() -> S>);
83    impl<S: State> sealed::Sealed for SetSubjectDid<S> {}
84    impl<S: State> State for SetSubjectDid<S> {
85        type SubjectDid = Set<members::subject_did>;
86        type UserDid = S::UserDid;
87    }
88    ///State transition - sets the `user_did` field to Set
89    pub struct SetUserDid<S: State = Empty>(PhantomData<fn() -> S>);
90    impl<S: State> sealed::Sealed for SetUserDid<S> {}
91    impl<S: State> State for SetUserDid<S> {
92        type SubjectDid = S::SubjectDid;
93        type UserDid = Set<members::user_did>;
94    }
95    /// Marker types for field names
96    #[allow(non_camel_case_types)]
97    pub mod members {
98        ///Marker type for the `subject_did` field
99        pub struct subject_did(());
100        ///Marker type for the `user_did` field
101        pub struct user_did(());
102    }
103}
104
105/// Builder for constructing an instance of this type
106pub struct GetFollowingUserBuilder<'a, S: get_following_user_state::State> {
107    _state: PhantomData<fn() -> S>,
108    _fields: (Option<Did<'a>>, Option<Did<'a>>),
109    _lifetime: PhantomData<&'a ()>,
110}
111
112impl<'a> GetFollowingUser<'a> {
113    /// Create a new builder for this type
114    pub fn new() -> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
115        GetFollowingUserBuilder::new()
116    }
117}
118
119impl<'a> GetFollowingUserBuilder<'a, get_following_user_state::Empty> {
120    /// Create a new builder with all fields unset
121    pub fn new() -> Self {
122        GetFollowingUserBuilder {
123            _state: PhantomData,
124            _fields: (None, None),
125            _lifetime: PhantomData,
126        }
127    }
128}
129
130impl<'a, S> GetFollowingUserBuilder<'a, S>
131where
132    S: get_following_user_state::State,
133    S::SubjectDid: get_following_user_state::IsUnset,
134{
135    /// Set the `subjectDID` field (required)
136    pub fn subject_did(
137        mut self,
138        value: impl Into<Did<'a>>,
139    ) -> GetFollowingUserBuilder<'a, get_following_user_state::SetSubjectDid<S>> {
140        self._fields.0 = Option::Some(value.into());
141        GetFollowingUserBuilder {
142            _state: PhantomData,
143            _fields: self._fields,
144            _lifetime: PhantomData,
145        }
146    }
147}
148
149impl<'a, S> GetFollowingUserBuilder<'a, S>
150where
151    S: get_following_user_state::State,
152    S::UserDid: get_following_user_state::IsUnset,
153{
154    /// Set the `userDID` field (required)
155    pub fn user_did(
156        mut self,
157        value: impl Into<Did<'a>>,
158    ) -> GetFollowingUserBuilder<'a, get_following_user_state::SetUserDid<S>> {
159        self._fields.1 = Option::Some(value.into());
160        GetFollowingUserBuilder {
161            _state: PhantomData,
162            _fields: self._fields,
163            _lifetime: PhantomData,
164        }
165    }
166}
167
168impl<'a, S> GetFollowingUserBuilder<'a, S>
169where
170    S: get_following_user_state::State,
171    S::SubjectDid: get_following_user_state::IsSet,
172    S::UserDid: get_following_user_state::IsSet,
173{
174    /// Build the final struct
175    pub fn build(self) -> GetFollowingUser<'a> {
176        GetFollowingUser {
177            subject_did: self._fields.0.unwrap(),
178            user_did: self._fields.1.unwrap(),
179        }
180    }
181}