Skip to main content

jacquard_api/sh_weaver/graph/
get_actor_bookmarks.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.graph.getActorBookmarks
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::CowStr;
14use jacquard_common::types::ident::AtIdentifier;
15use jacquard_common::types::value::Data;
16use jacquard_derive::{IntoStatic, lexicon};
17use serde::{Serialize, Deserialize};
18
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
20#[serde(rename_all = "camelCase")]
21pub struct GetActorBookmarks<'a> {
22    #[serde(borrow)]
23    pub actor: AtIdentifier<'a>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    #[serde(borrow)]
26    pub cursor: Option<CowStr<'a>>,
27    ///Defaults to `50`. Min: 1. Max: 100.
28    #[serde(default = "_default_limit")]
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub limit: Option<i64>,
31}
32
33
34#[lexicon]
35#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
36#[serde(rename_all = "camelCase")]
37pub struct GetActorBookmarksOutput<'a> {
38    #[serde(borrow)]
39    pub bookmarks: Vec<Data<'a>>,
40    #[serde(skip_serializing_if = "Option::is_none")]
41    #[serde(borrow)]
42    pub cursor: Option<CowStr<'a>>,
43}
44
45/// Response type for sh.weaver.graph.getActorBookmarks
46pub struct GetActorBookmarksResponse;
47impl jacquard_common::xrpc::XrpcResp for GetActorBookmarksResponse {
48    const NSID: &'static str = "sh.weaver.graph.getActorBookmarks";
49    const ENCODING: &'static str = "application/json";
50    type Output<'de> = GetActorBookmarksOutput<'de>;
51    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
52}
53
54impl<'a> jacquard_common::xrpc::XrpcRequest for GetActorBookmarks<'a> {
55    const NSID: &'static str = "sh.weaver.graph.getActorBookmarks";
56    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
57    type Response = GetActorBookmarksResponse;
58}
59
60/// Endpoint type for sh.weaver.graph.getActorBookmarks
61pub struct GetActorBookmarksRequest;
62impl jacquard_common::xrpc::XrpcEndpoint for GetActorBookmarksRequest {
63    const PATH: &'static str = "/xrpc/sh.weaver.graph.getActorBookmarks";
64    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
65    type Request<'de> = GetActorBookmarks<'de>;
66    type Response = GetActorBookmarksResponse;
67}
68
69fn _default_limit() -> Option<i64> {
70    Some(50i64)
71}
72
73pub mod get_actor_bookmarks_state {
74
75    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
76    #[allow(unused)]
77    use ::core::marker::PhantomData;
78    mod sealed {
79        pub trait Sealed {}
80    }
81    /// State trait tracking which required fields have been set
82    pub trait State: sealed::Sealed {
83        type Actor;
84    }
85    /// Empty state - all required fields are unset
86    pub struct Empty(());
87    impl sealed::Sealed for Empty {}
88    impl State for Empty {
89        type Actor = Unset;
90    }
91    ///State transition - sets the `actor` field to Set
92    pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
93    impl<S: State> sealed::Sealed for SetActor<S> {}
94    impl<S: State> State for SetActor<S> {
95        type Actor = Set<members::actor>;
96    }
97    /// Marker types for field names
98    #[allow(non_camel_case_types)]
99    pub mod members {
100        ///Marker type for the `actor` field
101        pub struct actor(());
102    }
103}
104
105/// Builder for constructing an instance of this type
106pub struct GetActorBookmarksBuilder<'a, S: get_actor_bookmarks_state::State> {
107    _state: PhantomData<fn() -> S>,
108    _fields: (Option<AtIdentifier<'a>>, Option<CowStr<'a>>, Option<i64>),
109    _lifetime: PhantomData<&'a ()>,
110}
111
112impl<'a> GetActorBookmarks<'a> {
113    /// Create a new builder for this type
114    pub fn new() -> GetActorBookmarksBuilder<'a, get_actor_bookmarks_state::Empty> {
115        GetActorBookmarksBuilder::new()
116    }
117}
118
119impl<'a> GetActorBookmarksBuilder<'a, get_actor_bookmarks_state::Empty> {
120    /// Create a new builder with all fields unset
121    pub fn new() -> Self {
122        GetActorBookmarksBuilder {
123            _state: PhantomData,
124            _fields: (None, None, None),
125            _lifetime: PhantomData,
126        }
127    }
128}
129
130impl<'a, S> GetActorBookmarksBuilder<'a, S>
131where
132    S: get_actor_bookmarks_state::State,
133    S::Actor: get_actor_bookmarks_state::IsUnset,
134{
135    /// Set the `actor` field (required)
136    pub fn actor(
137        mut self,
138        value: impl Into<AtIdentifier<'a>>,
139    ) -> GetActorBookmarksBuilder<'a, get_actor_bookmarks_state::SetActor<S>> {
140        self._fields.0 = Option::Some(value.into());
141        GetActorBookmarksBuilder {
142            _state: PhantomData,
143            _fields: self._fields,
144            _lifetime: PhantomData,
145        }
146    }
147}
148
149impl<'a, S: get_actor_bookmarks_state::State> GetActorBookmarksBuilder<'a, S> {
150    /// Set the `cursor` field (optional)
151    pub fn cursor(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
152        self._fields.1 = value.into();
153        self
154    }
155    /// Set the `cursor` field to an Option value (optional)
156    pub fn maybe_cursor(mut self, value: Option<CowStr<'a>>) -> Self {
157        self._fields.1 = value;
158        self
159    }
160}
161
162impl<'a, S: get_actor_bookmarks_state::State> GetActorBookmarksBuilder<'a, S> {
163    /// Set the `limit` field (optional)
164    pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
165        self._fields.2 = value.into();
166        self
167    }
168    /// Set the `limit` field to an Option value (optional)
169    pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
170        self._fields.2 = value;
171        self
172    }
173}
174
175impl<'a, S> GetActorBookmarksBuilder<'a, S>
176where
177    S: get_actor_bookmarks_state::State,
178    S::Actor: get_actor_bookmarks_state::IsSet,
179{
180    /// Build the final struct
181    pub fn build(self) -> GetActorBookmarks<'a> {
182        GetActorBookmarks {
183            actor: self._fields.0.unwrap(),
184            cursor: self._fields.1,
185            limit: self._fields.2,
186        }
187    }
188}