jacquard_api/app_bsky/embed/
get_embed_external_view.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11use crate::app_bsky::embed::external::View;
12use crate::com_atproto::repo::strong_ref::StrongRef;
13#[allow(unused_imports)]
14use core::marker::PhantomData;
15use jacquard_common::deps::smol_str::SmolStr;
16use jacquard_common::types::string::{AtUri, UriValue};
17use jacquard_common::types::value::Data;
18use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
19use jacquard_derive::IntoStatic;
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 GetEmbedExternalView<S: BosStr = DefaultStr> {
28 pub uris: Vec<AtUri<S>>,
29 pub url: UriValue<S>,
30}
31
32#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
33#[serde(
34 rename_all = "camelCase",
35 bound(deserialize = "S: Deserialize<'de> + BosStr")
36)]
37pub struct GetEmbedExternalViewOutput<S: BosStr = DefaultStr> {
38 #[serde(skip_serializing_if = "Option::is_none")]
39 pub associated_records: Option<Vec<Data<S>>>,
40 #[serde(skip_serializing_if = "Option::is_none")]
42 pub associated_refs: Option<Vec<StrongRef<S>>>,
43 #[serde(skip_serializing_if = "Option::is_none")]
45 pub view: Option<View<S>>,
46 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
47 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
48}
49
50pub struct GetEmbedExternalViewResponse;
54impl jacquard_common::xrpc::XrpcResp for GetEmbedExternalViewResponse {
55 const NSID: &'static str = "app.bsky.embed.getEmbedExternalView";
56 const ENCODING: &'static str = "application/json";
57 type Output<S: BosStr> = GetEmbedExternalViewOutput<S>;
58 type Err = jacquard_common::xrpc::GenericError;
59}
60
61impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetEmbedExternalView<S> {
62 const NSID: &'static str = "app.bsky.embed.getEmbedExternalView";
63 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
64 type Response = GetEmbedExternalViewResponse;
65}
66
67pub struct GetEmbedExternalViewRequest;
71impl jacquard_common::xrpc::XrpcEndpoint for GetEmbedExternalViewRequest {
72 const PATH: &'static str = "/xrpc/app.bsky.embed.getEmbedExternalView";
73 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
74 type Request<S: BosStr> = GetEmbedExternalView<S>;
75 type Response = GetEmbedExternalViewResponse;
76}
77
78pub mod get_embed_external_view_state {
79
80 pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
81 #[allow(unused)]
82 use ::core::marker::PhantomData;
83 mod sealed {
84 pub trait Sealed {}
85 }
86 pub trait State: sealed::Sealed {
88 type Uris;
89 type Url;
90 }
91 pub struct Empty(());
93 impl sealed::Sealed for Empty {}
94 impl State for Empty {
95 type Uris = Unset;
96 type Url = Unset;
97 }
98 pub struct SetUris<St: State = Empty>(PhantomData<fn() -> St>);
100 impl<St: State> sealed::Sealed for SetUris<St> {}
101 impl<St: State> State for SetUris<St> {
102 type Uris = Set<members::uris>;
103 type Url = St::Url;
104 }
105 pub struct SetUrl<St: State = Empty>(PhantomData<fn() -> St>);
107 impl<St: State> sealed::Sealed for SetUrl<St> {}
108 impl<St: State> State for SetUrl<St> {
109 type Uris = St::Uris;
110 type Url = Set<members::url>;
111 }
112 #[allow(non_camel_case_types)]
114 pub mod members {
115 pub struct uris(());
117 pub struct url(());
119 }
120}
121
122pub struct GetEmbedExternalViewBuilder<
124 St: get_embed_external_view_state::State,
125 S: BosStr = DefaultStr,
126> {
127 _state: PhantomData<fn() -> St>,
128 _fields: (Option<Vec<AtUri<S>>>, Option<UriValue<S>>),
129 _type: PhantomData<fn() -> S>,
130}
131
132impl GetEmbedExternalView<DefaultStr> {
133 pub fn new() -> GetEmbedExternalViewBuilder<get_embed_external_view_state::Empty, DefaultStr> {
135 GetEmbedExternalViewBuilder::new()
136 }
137}
138
139impl<S: BosStr> GetEmbedExternalView<S> {
140 pub fn builder() -> GetEmbedExternalViewBuilder<get_embed_external_view_state::Empty, S> {
142 GetEmbedExternalViewBuilder::builder()
143 }
144}
145
146impl GetEmbedExternalViewBuilder<get_embed_external_view_state::Empty, DefaultStr> {
147 pub fn new() -> Self {
149 GetEmbedExternalViewBuilder {
150 _state: PhantomData,
151 _fields: (None, None),
152 _type: PhantomData,
153 }
154 }
155}
156
157impl<S: BosStr> GetEmbedExternalViewBuilder<get_embed_external_view_state::Empty, S> {
158 pub fn builder() -> Self {
160 GetEmbedExternalViewBuilder {
161 _state: PhantomData,
162 _fields: (None, None),
163 _type: PhantomData,
164 }
165 }
166}
167
168impl<St, S: BosStr> GetEmbedExternalViewBuilder<St, S>
169where
170 St: get_embed_external_view_state::State,
171 St::Uris: get_embed_external_view_state::IsUnset,
172{
173 pub fn uris(
175 mut self,
176 value: impl Into<Vec<AtUri<S>>>,
177 ) -> GetEmbedExternalViewBuilder<get_embed_external_view_state::SetUris<St>, S> {
178 self._fields.0 = Option::Some(value.into());
179 GetEmbedExternalViewBuilder {
180 _state: PhantomData,
181 _fields: self._fields,
182 _type: PhantomData,
183 }
184 }
185}
186
187impl<St, S: BosStr> GetEmbedExternalViewBuilder<St, S>
188where
189 St: get_embed_external_view_state::State,
190 St::Url: get_embed_external_view_state::IsUnset,
191{
192 pub fn url(
194 mut self,
195 value: impl Into<UriValue<S>>,
196 ) -> GetEmbedExternalViewBuilder<get_embed_external_view_state::SetUrl<St>, S> {
197 self._fields.1 = Option::Some(value.into());
198 GetEmbedExternalViewBuilder {
199 _state: PhantomData,
200 _fields: self._fields,
201 _type: PhantomData,
202 }
203 }
204}
205
206impl<St, S: BosStr> GetEmbedExternalViewBuilder<St, S>
207where
208 St: get_embed_external_view_state::State,
209 St::Uris: get_embed_external_view_state::IsSet,
210 St::Url: get_embed_external_view_state::IsSet,
211{
212 pub fn build(self) -> GetEmbedExternalView<S> {
214 GetEmbedExternalView {
215 uris: self._fields.0.unwrap(),
216 url: self._fields.1.unwrap(),
217 }
218 }
219}