Skip to main content

jacquard_api/sh_weaver/actor/
get_actor_notebooks.rs

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