Skip to main content

jacquard_api/chat_bsky/group/
get_join_link_previews.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: chat.bsky.group.getJoinLinkPreviews
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
11use crate::chat_bsky::group::DisabledJoinLinkPreviewView;
12use crate::chat_bsky::group::InvalidJoinLinkPreviewView;
13use crate::chat_bsky::group::JoinLinkPreviewView;
14#[allow(unused_imports)]
15use core::marker::PhantomData;
16use jacquard_common::deps::smol_str::SmolStr;
17use jacquard_common::types::value::Data;
18use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
19use jacquard_derive::{IntoStatic, open_union};
20use serde::{Deserialize, Serialize};
21
22#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
23#[serde(
24    rename_all = "camelCase",
25    bound(deserialize = "S: Deserialize<'de> + BosStr")
26)]
27pub struct GetJoinLinkPreviews<S: BosStr = DefaultStr> {
28    pub codes: Vec<S>,
29}
30
31#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
32#[serde(
33    rename_all = "camelCase",
34    bound(deserialize = "S: Deserialize<'de> + BosStr")
35)]
36pub struct GetJoinLinkPreviewsOutput<S: BosStr = DefaultStr> {
37    pub join_link_previews: Vec<GetJoinLinkPreviewsOutputJoinLinkPreviewsItem<S>>,
38    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
39    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
40}
41
42#[open_union]
43#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
44#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
45pub enum GetJoinLinkPreviewsOutputJoinLinkPreviewsItem<S: BosStr = DefaultStr> {
46    #[serde(rename = "chat.bsky.group.defs#joinLinkPreviewView")]
47    JoinLinkPreviewView(Box<JoinLinkPreviewView<S>>),
48    #[serde(rename = "chat.bsky.group.defs#disabledJoinLinkPreviewView")]
49    DisabledJoinLinkPreviewView(Box<DisabledJoinLinkPreviewView<S>>),
50    #[serde(rename = "chat.bsky.group.defs#invalidJoinLinkPreviewView")]
51    InvalidJoinLinkPreviewView(Box<InvalidJoinLinkPreviewView<S>>),
52}
53
54/** Response marker for the `chat.bsky.group.getJoinLinkPreviews` query.
55
56Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetJoinLinkPreviewsOutput<S>` for this endpoint.*/
57pub struct GetJoinLinkPreviewsResponse;
58impl jacquard_common::xrpc::XrpcResp for GetJoinLinkPreviewsResponse {
59    const NSID: &'static str = "chat.bsky.group.getJoinLinkPreviews";
60    const ENCODING: &'static str = "application/json";
61    type Output<S: BosStr> = GetJoinLinkPreviewsOutput<S>;
62    type Err = jacquard_common::xrpc::GenericError;
63}
64
65impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetJoinLinkPreviews<S> {
66    const NSID: &'static str = "chat.bsky.group.getJoinLinkPreviews";
67    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
68    type Response = GetJoinLinkPreviewsResponse;
69}
70
71/** Endpoint marker for the `chat.bsky.group.getJoinLinkPreviews` query.
72
73Path: `/xrpc/chat.bsky.group.getJoinLinkPreviews`. The request payload type is `GetJoinLinkPreviews<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
74pub struct GetJoinLinkPreviewsRequest;
75impl jacquard_common::xrpc::XrpcEndpoint for GetJoinLinkPreviewsRequest {
76    const PATH: &'static str = "/xrpc/chat.bsky.group.getJoinLinkPreviews";
77    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
78    type Request<S: BosStr> = GetJoinLinkPreviews<S>;
79    type Response = GetJoinLinkPreviewsResponse;
80}
81
82pub mod get_join_link_previews_state {
83
84    pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
85    #[allow(unused)]
86    use ::core::marker::PhantomData;
87    mod sealed {
88        pub trait Sealed {}
89    }
90    /// State trait tracking which required fields have been set
91    pub trait State: sealed::Sealed {
92        type Codes;
93    }
94    /// Empty state - all required fields are unset
95    pub struct Empty(());
96    impl sealed::Sealed for Empty {}
97    impl State for Empty {
98        type Codes = Unset;
99    }
100    ///State transition - sets the `codes` field to Set
101    pub struct SetCodes<St: State = Empty>(PhantomData<fn() -> St>);
102    impl<St: State> sealed::Sealed for SetCodes<St> {}
103    impl<St: State> State for SetCodes<St> {
104        type Codes = Set<members::codes>;
105    }
106    /// Marker types for field names
107    #[allow(non_camel_case_types)]
108    pub mod members {
109        ///Marker type for the `codes` field
110        pub struct codes(());
111    }
112}
113
114/// Builder for constructing an instance of this type.
115pub struct GetJoinLinkPreviewsBuilder<
116    St: get_join_link_previews_state::State,
117    S: BosStr = DefaultStr,
118> {
119    _state: PhantomData<fn() -> St>,
120    _fields: (Option<Vec<S>>,),
121    _type: PhantomData<fn() -> S>,
122}
123
124impl GetJoinLinkPreviews<DefaultStr> {
125    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
126    pub fn new() -> GetJoinLinkPreviewsBuilder<get_join_link_previews_state::Empty, DefaultStr> {
127        GetJoinLinkPreviewsBuilder::new()
128    }
129}
130
131impl<S: BosStr> GetJoinLinkPreviews<S> {
132    /// Create a new builder for this type
133    pub fn builder() -> GetJoinLinkPreviewsBuilder<get_join_link_previews_state::Empty, S> {
134        GetJoinLinkPreviewsBuilder::builder()
135    }
136}
137
138impl GetJoinLinkPreviewsBuilder<get_join_link_previews_state::Empty, DefaultStr> {
139    /// Create a new builder with all fields unset, using the default string type, if needed
140    pub fn new() -> Self {
141        GetJoinLinkPreviewsBuilder {
142            _state: PhantomData,
143            _fields: (None,),
144            _type: PhantomData,
145        }
146    }
147}
148
149impl<S: BosStr> GetJoinLinkPreviewsBuilder<get_join_link_previews_state::Empty, S> {
150    /// Create a new builder with all fields unset
151    pub fn builder() -> Self {
152        GetJoinLinkPreviewsBuilder {
153            _state: PhantomData,
154            _fields: (None,),
155            _type: PhantomData,
156        }
157    }
158}
159
160impl<St, S: BosStr> GetJoinLinkPreviewsBuilder<St, S>
161where
162    St: get_join_link_previews_state::State,
163    St::Codes: get_join_link_previews_state::IsUnset,
164{
165    /// Set the `codes` field (required)
166    pub fn codes(
167        mut self,
168        value: impl Into<Vec<S>>,
169    ) -> GetJoinLinkPreviewsBuilder<get_join_link_previews_state::SetCodes<St>, S> {
170        self._fields.0 = Option::Some(value.into());
171        GetJoinLinkPreviewsBuilder {
172            _state: PhantomData,
173            _fields: self._fields,
174            _type: PhantomData,
175        }
176    }
177}
178
179impl<St, S: BosStr> GetJoinLinkPreviewsBuilder<St, S>
180where
181    St: get_join_link_previews_state::State,
182    St::Codes: get_join_link_previews_state::IsSet,
183{
184    /// Build the final struct.
185    pub fn build(self) -> GetJoinLinkPreviews<S> {
186        GetJoinLinkPreviews {
187            codes: self._fields.0.unwrap(),
188        }
189    }
190}