1pub mod gate;
9pub mod message;
10pub mod profile;
11
12#[jacquard_derive::lexicon]
13#[derive(
14 serde::Serialize,
15 serde::Deserialize,
16 Debug,
17 Clone,
18 PartialEq,
19 Eq,
20 jacquard_derive::IntoStatic
21)]
22#[serde(rename_all = "camelCase")]
23pub struct MessageView<'a> {
24 #[serde(borrow)]
25 pub author: crate::app_bsky::actor::ProfileViewBasic<'a>,
26 #[serde(skip_serializing_if = "std::option::Option::is_none")]
27 #[serde(borrow)]
28 pub chat_profile: Option<crate::place_stream::chat::profile::Profile<'a>>,
29 #[serde(borrow)]
30 pub cid: jacquard_common::types::string::Cid<'a>,
31 #[serde(skip_serializing_if = "std::option::Option::is_none")]
33 pub deleted: Option<bool>,
34 pub indexed_at: jacquard_common::types::string::Datetime,
35 #[serde(borrow)]
36 pub record: jacquard_common::types::value::Data<'a>,
37 #[serde(skip_serializing_if = "std::option::Option::is_none")]
38 #[serde(borrow)]
39 pub reply_to: Option<MessageViewReplyTo<'a>>,
40 #[serde(borrow)]
41 pub uri: jacquard_common::types::string::AtUri<'a>,
42}
43
44pub mod message_view_state {
45
46 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
47 #[allow(unused)]
48 use ::core::marker::PhantomData;
49 mod sealed {
50 pub trait Sealed {}
51 }
52 pub trait State: sealed::Sealed {
54 type Uri;
55 type Cid;
56 type Author;
57 type Record;
58 type IndexedAt;
59 }
60 pub struct Empty(());
62 impl sealed::Sealed for Empty {}
63 impl State for Empty {
64 type Uri = Unset;
65 type Cid = Unset;
66 type Author = Unset;
67 type Record = Unset;
68 type IndexedAt = Unset;
69 }
70 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
72 impl<S: State> sealed::Sealed for SetUri<S> {}
73 impl<S: State> State for SetUri<S> {
74 type Uri = Set<members::uri>;
75 type Cid = S::Cid;
76 type Author = S::Author;
77 type Record = S::Record;
78 type IndexedAt = S::IndexedAt;
79 }
80 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
82 impl<S: State> sealed::Sealed for SetCid<S> {}
83 impl<S: State> State for SetCid<S> {
84 type Uri = S::Uri;
85 type Cid = Set<members::cid>;
86 type Author = S::Author;
87 type Record = S::Record;
88 type IndexedAt = S::IndexedAt;
89 }
90 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
92 impl<S: State> sealed::Sealed for SetAuthor<S> {}
93 impl<S: State> State for SetAuthor<S> {
94 type Uri = S::Uri;
95 type Cid = S::Cid;
96 type Author = Set<members::author>;
97 type Record = S::Record;
98 type IndexedAt = S::IndexedAt;
99 }
100 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
102 impl<S: State> sealed::Sealed for SetRecord<S> {}
103 impl<S: State> State for SetRecord<S> {
104 type Uri = S::Uri;
105 type Cid = S::Cid;
106 type Author = S::Author;
107 type Record = Set<members::record>;
108 type IndexedAt = S::IndexedAt;
109 }
110 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
112 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
113 impl<S: State> State for SetIndexedAt<S> {
114 type Uri = S::Uri;
115 type Cid = S::Cid;
116 type Author = S::Author;
117 type Record = S::Record;
118 type IndexedAt = Set<members::indexed_at>;
119 }
120 #[allow(non_camel_case_types)]
122 pub mod members {
123 pub struct uri(());
125 pub struct cid(());
127 pub struct author(());
129 pub struct record(());
131 pub struct indexed_at(());
133 }
134}
135
136pub struct MessageViewBuilder<'a, S: message_view_state::State> {
138 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
139 __unsafe_private_named: (
140 ::core::option::Option<crate::app_bsky::actor::ProfileViewBasic<'a>>,
141 ::core::option::Option<crate::place_stream::chat::profile::Profile<'a>>,
142 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
143 ::core::option::Option<bool>,
144 ::core::option::Option<jacquard_common::types::string::Datetime>,
145 ::core::option::Option<jacquard_common::types::value::Data<'a>>,
146 ::core::option::Option<MessageViewReplyTo<'a>>,
147 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
148 ),
149 _phantom: ::core::marker::PhantomData<&'a ()>,
150}
151
152impl<'a> MessageView<'a> {
153 pub fn new() -> MessageViewBuilder<'a, message_view_state::Empty> {
155 MessageViewBuilder::new()
156 }
157}
158
159impl<'a> MessageViewBuilder<'a, message_view_state::Empty> {
160 pub fn new() -> Self {
162 MessageViewBuilder {
163 _phantom_state: ::core::marker::PhantomData,
164 __unsafe_private_named: (None, None, None, None, None, None, None, None),
165 _phantom: ::core::marker::PhantomData,
166 }
167 }
168}
169
170impl<'a, S> MessageViewBuilder<'a, S>
171where
172 S: message_view_state::State,
173 S::Author: message_view_state::IsUnset,
174{
175 pub fn author(
177 mut self,
178 value: impl Into<crate::app_bsky::actor::ProfileViewBasic<'a>>,
179 ) -> MessageViewBuilder<'a, message_view_state::SetAuthor<S>> {
180 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
181 MessageViewBuilder {
182 _phantom_state: ::core::marker::PhantomData,
183 __unsafe_private_named: self.__unsafe_private_named,
184 _phantom: ::core::marker::PhantomData,
185 }
186 }
187}
188
189impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
190 pub fn chat_profile(
192 mut self,
193 value: impl Into<Option<crate::place_stream::chat::profile::Profile<'a>>>,
194 ) -> Self {
195 self.__unsafe_private_named.1 = value.into();
196 self
197 }
198 pub fn maybe_chat_profile(
200 mut self,
201 value: Option<crate::place_stream::chat::profile::Profile<'a>>,
202 ) -> Self {
203 self.__unsafe_private_named.1 = value;
204 self
205 }
206}
207
208impl<'a, S> MessageViewBuilder<'a, S>
209where
210 S: message_view_state::State,
211 S::Cid: message_view_state::IsUnset,
212{
213 pub fn cid(
215 mut self,
216 value: impl Into<jacquard_common::types::string::Cid<'a>>,
217 ) -> MessageViewBuilder<'a, message_view_state::SetCid<S>> {
218 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
219 MessageViewBuilder {
220 _phantom_state: ::core::marker::PhantomData,
221 __unsafe_private_named: self.__unsafe_private_named,
222 _phantom: ::core::marker::PhantomData,
223 }
224 }
225}
226
227impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
228 pub fn deleted(mut self, value: impl Into<Option<bool>>) -> Self {
230 self.__unsafe_private_named.3 = value.into();
231 self
232 }
233 pub fn maybe_deleted(mut self, value: Option<bool>) -> Self {
235 self.__unsafe_private_named.3 = value;
236 self
237 }
238}
239
240impl<'a, S> MessageViewBuilder<'a, S>
241where
242 S: message_view_state::State,
243 S::IndexedAt: message_view_state::IsUnset,
244{
245 pub fn indexed_at(
247 mut self,
248 value: impl Into<jacquard_common::types::string::Datetime>,
249 ) -> MessageViewBuilder<'a, message_view_state::SetIndexedAt<S>> {
250 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
251 MessageViewBuilder {
252 _phantom_state: ::core::marker::PhantomData,
253 __unsafe_private_named: self.__unsafe_private_named,
254 _phantom: ::core::marker::PhantomData,
255 }
256 }
257}
258
259impl<'a, S> MessageViewBuilder<'a, S>
260where
261 S: message_view_state::State,
262 S::Record: message_view_state::IsUnset,
263{
264 pub fn record(
266 mut self,
267 value: impl Into<jacquard_common::types::value::Data<'a>>,
268 ) -> MessageViewBuilder<'a, message_view_state::SetRecord<S>> {
269 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into());
270 MessageViewBuilder {
271 _phantom_state: ::core::marker::PhantomData,
272 __unsafe_private_named: self.__unsafe_private_named,
273 _phantom: ::core::marker::PhantomData,
274 }
275 }
276}
277
278impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
279 pub fn reply_to(mut self, value: impl Into<Option<MessageViewReplyTo<'a>>>) -> Self {
281 self.__unsafe_private_named.6 = value.into();
282 self
283 }
284 pub fn maybe_reply_to(mut self, value: Option<MessageViewReplyTo<'a>>) -> Self {
286 self.__unsafe_private_named.6 = value;
287 self
288 }
289}
290
291impl<'a, S> MessageViewBuilder<'a, S>
292where
293 S: message_view_state::State,
294 S::Uri: message_view_state::IsUnset,
295{
296 pub fn uri(
298 mut self,
299 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
300 ) -> MessageViewBuilder<'a, message_view_state::SetUri<S>> {
301 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
302 MessageViewBuilder {
303 _phantom_state: ::core::marker::PhantomData,
304 __unsafe_private_named: self.__unsafe_private_named,
305 _phantom: ::core::marker::PhantomData,
306 }
307 }
308}
309
310impl<'a, S> MessageViewBuilder<'a, S>
311where
312 S: message_view_state::State,
313 S::Uri: message_view_state::IsSet,
314 S::Cid: message_view_state::IsSet,
315 S::Author: message_view_state::IsSet,
316 S::Record: message_view_state::IsSet,
317 S::IndexedAt: message_view_state::IsSet,
318{
319 pub fn build(self) -> MessageView<'a> {
321 MessageView {
322 author: self.__unsafe_private_named.0.unwrap(),
323 chat_profile: self.__unsafe_private_named.1,
324 cid: self.__unsafe_private_named.2.unwrap(),
325 deleted: self.__unsafe_private_named.3,
326 indexed_at: self.__unsafe_private_named.4.unwrap(),
327 record: self.__unsafe_private_named.5.unwrap(),
328 reply_to: self.__unsafe_private_named.6,
329 uri: self.__unsafe_private_named.7.unwrap(),
330 extra_data: Default::default(),
331 }
332 }
333 pub fn build_with_data(
335 self,
336 extra_data: std::collections::BTreeMap<
337 jacquard_common::smol_str::SmolStr,
338 jacquard_common::types::value::Data<'a>,
339 >,
340 ) -> MessageView<'a> {
341 MessageView {
342 author: self.__unsafe_private_named.0.unwrap(),
343 chat_profile: self.__unsafe_private_named.1,
344 cid: self.__unsafe_private_named.2.unwrap(),
345 deleted: self.__unsafe_private_named.3,
346 indexed_at: self.__unsafe_private_named.4.unwrap(),
347 record: self.__unsafe_private_named.5.unwrap(),
348 reply_to: self.__unsafe_private_named.6,
349 uri: self.__unsafe_private_named.7.unwrap(),
350 extra_data: Some(extra_data),
351 }
352 }
353}
354
355#[jacquard_derive::open_union]
356#[derive(
357 serde::Serialize,
358 serde::Deserialize,
359 Debug,
360 Clone,
361 PartialEq,
362 Eq,
363 jacquard_derive::IntoStatic
364)]
365#[serde(tag = "$type")]
366#[serde(bound(deserialize = "'de: 'a"))]
367pub enum MessageViewReplyTo<'a> {
368 #[serde(rename = "place.stream.chat.defs#messageView")]
369 MessageView(Box<crate::place_stream::chat::MessageView<'a>>),
370}
371
372fn lexicon_doc_place_stream_chat_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
373 'static,
374> {
375 ::jacquard_lexicon::lexicon::LexiconDoc {
376 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
377 id: ::jacquard_common::CowStr::new_static("place.stream.chat.defs"),
378 revision: None,
379 description: None,
380 defs: {
381 let mut map = ::std::collections::BTreeMap::new();
382 map.insert(
383 ::jacquard_common::smol_str::SmolStr::new_static("messageView"),
384 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
385 description: None,
386 required: Some(
387 vec![
388 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
389 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
390 ::jacquard_common::smol_str::SmolStr::new_static("author"),
391 ::jacquard_common::smol_str::SmolStr::new_static("record"),
392 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt")
393 ],
394 ),
395 nullable: None,
396 properties: {
397 #[allow(unused_mut)]
398 let mut map = ::std::collections::BTreeMap::new();
399 map.insert(
400 ::jacquard_common::smol_str::SmolStr::new_static("author"),
401 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
402 description: None,
403 r#ref: ::jacquard_common::CowStr::new_static(
404 "app.bsky.actor.defs#profileViewBasic",
405 ),
406 }),
407 );
408 map.insert(
409 ::jacquard_common::smol_str::SmolStr::new_static(
410 "chatProfile",
411 ),
412 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
413 description: None,
414 r#ref: ::jacquard_common::CowStr::new_static(
415 "place.stream.chat.profile",
416 ),
417 }),
418 );
419 map.insert(
420 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
421 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
422 description: None,
423 format: Some(
424 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
425 ),
426 default: None,
427 min_length: None,
428 max_length: None,
429 min_graphemes: None,
430 max_graphemes: None,
431 r#enum: None,
432 r#const: None,
433 known_values: None,
434 }),
435 );
436 map.insert(
437 ::jacquard_common::smol_str::SmolStr::new_static("deleted"),
438 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
439 description: None,
440 default: None,
441 r#const: None,
442 }),
443 );
444 map.insert(
445 ::jacquard_common::smol_str::SmolStr::new_static(
446 "indexedAt",
447 ),
448 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
449 description: None,
450 format: Some(
451 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
452 ),
453 default: None,
454 min_length: None,
455 max_length: None,
456 min_graphemes: None,
457 max_graphemes: None,
458 r#enum: None,
459 r#const: None,
460 known_values: None,
461 }),
462 );
463 map.insert(
464 ::jacquard_common::smol_str::SmolStr::new_static("record"),
465 ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown {
466 description: None,
467 }),
468 );
469 map.insert(
470 ::jacquard_common::smol_str::SmolStr::new_static("replyTo"),
471 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
472 description: None,
473 refs: vec![
474 ::jacquard_common::CowStr::new_static("#messageView")
475 ],
476 closed: None,
477 }),
478 );
479 map.insert(
480 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
481 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
482 description: None,
483 format: Some(
484 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
485 ),
486 default: None,
487 min_length: None,
488 max_length: None,
489 min_graphemes: None,
490 max_graphemes: None,
491 r#enum: None,
492 r#const: None,
493 known_values: None,
494 }),
495 );
496 map
497 },
498 }),
499 );
500 map
501 },
502 }
503}
504
505impl<'a> ::jacquard_lexicon::schema::LexiconSchema for MessageView<'a> {
506 fn nsid() -> &'static str {
507 "place.stream.chat.defs"
508 }
509 fn def_name() -> &'static str {
510 "messageView"
511 }
512 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
513 lexicon_doc_place_stream_chat_defs()
514 }
515 fn validate(
516 &self,
517 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
518 Ok(())
519 }
520}