atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.getLikes
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct Like<'a> {
20 #[serde(borrow)]
21 pub actor: crate::app_bsky::actor::ProfileView<'a>,
22 pub created_at: jacquard_common::types::string::Datetime,
23 pub indexed_at: jacquard_common::types::string::Datetime,
24}
25
26pub mod like_state {
27
28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29 #[allow(unused)]
30 use ::core::marker::PhantomData;
31 mod sealed {
32 pub trait Sealed {}
33 }
34 /// State trait tracking which required fields have been set
35 pub trait State: sealed::Sealed {
36 type Actor;
37 type IndexedAt;
38 type CreatedAt;
39 }
40 /// Empty state - all required fields are unset
41 pub struct Empty(());
42 impl sealed::Sealed for Empty {}
43 impl State for Empty {
44 type Actor = Unset;
45 type IndexedAt = Unset;
46 type CreatedAt = Unset;
47 }
48 ///State transition - sets the `actor` field to Set
49 pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
50 impl<S: State> sealed::Sealed for SetActor<S> {}
51 impl<S: State> State for SetActor<S> {
52 type Actor = Set<members::actor>;
53 type IndexedAt = S::IndexedAt;
54 type CreatedAt = S::CreatedAt;
55 }
56 ///State transition - sets the `indexed_at` field to Set
57 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
58 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
59 impl<S: State> State for SetIndexedAt<S> {
60 type Actor = S::Actor;
61 type IndexedAt = Set<members::indexed_at>;
62 type CreatedAt = S::CreatedAt;
63 }
64 ///State transition - sets the `created_at` field to Set
65 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
66 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
67 impl<S: State> State for SetCreatedAt<S> {
68 type Actor = S::Actor;
69 type IndexedAt = S::IndexedAt;
70 type CreatedAt = Set<members::created_at>;
71 }
72 /// Marker types for field names
73 #[allow(non_camel_case_types)]
74 pub mod members {
75 ///Marker type for the `actor` field
76 pub struct actor(());
77 ///Marker type for the `indexed_at` field
78 pub struct indexed_at(());
79 ///Marker type for the `created_at` field
80 pub struct created_at(());
81 }
82}
83
84/// Builder for constructing an instance of this type
85pub struct LikeBuilder<'a, S: like_state::State> {
86 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
87 __unsafe_private_named: (
88 ::core::option::Option<crate::app_bsky::actor::ProfileView<'a>>,
89 ::core::option::Option<jacquard_common::types::string::Datetime>,
90 ::core::option::Option<jacquard_common::types::string::Datetime>,
91 ),
92 _phantom: ::core::marker::PhantomData<&'a ()>,
93}
94
95impl<'a> Like<'a> {
96 /// Create a new builder for this type
97 pub fn new() -> LikeBuilder<'a, like_state::Empty> {
98 LikeBuilder::new()
99 }
100}
101
102impl<'a> LikeBuilder<'a, like_state::Empty> {
103 /// Create a new builder with all fields unset
104 pub fn new() -> Self {
105 LikeBuilder {
106 _phantom_state: ::core::marker::PhantomData,
107 __unsafe_private_named: (None, None, None),
108 _phantom: ::core::marker::PhantomData,
109 }
110 }
111}
112
113impl<'a, S> LikeBuilder<'a, S>
114where
115 S: like_state::State,
116 S::Actor: like_state::IsUnset,
117{
118 /// Set the `actor` field (required)
119 pub fn actor(
120 mut self,
121 value: impl Into<crate::app_bsky::actor::ProfileView<'a>>,
122 ) -> LikeBuilder<'a, like_state::SetActor<S>> {
123 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
124 LikeBuilder {
125 _phantom_state: ::core::marker::PhantomData,
126 __unsafe_private_named: self.__unsafe_private_named,
127 _phantom: ::core::marker::PhantomData,
128 }
129 }
130}
131
132impl<'a, S> LikeBuilder<'a, S>
133where
134 S: like_state::State,
135 S::CreatedAt: like_state::IsUnset,
136{
137 /// Set the `createdAt` field (required)
138 pub fn created_at(
139 mut self,
140 value: impl Into<jacquard_common::types::string::Datetime>,
141 ) -> LikeBuilder<'a, like_state::SetCreatedAt<S>> {
142 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
143 LikeBuilder {
144 _phantom_state: ::core::marker::PhantomData,
145 __unsafe_private_named: self.__unsafe_private_named,
146 _phantom: ::core::marker::PhantomData,
147 }
148 }
149}
150
151impl<'a, S> LikeBuilder<'a, S>
152where
153 S: like_state::State,
154 S::IndexedAt: like_state::IsUnset,
155{
156 /// Set the `indexedAt` field (required)
157 pub fn indexed_at(
158 mut self,
159 value: impl Into<jacquard_common::types::string::Datetime>,
160 ) -> LikeBuilder<'a, like_state::SetIndexedAt<S>> {
161 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
162 LikeBuilder {
163 _phantom_state: ::core::marker::PhantomData,
164 __unsafe_private_named: self.__unsafe_private_named,
165 _phantom: ::core::marker::PhantomData,
166 }
167 }
168}
169
170impl<'a, S> LikeBuilder<'a, S>
171where
172 S: like_state::State,
173 S::Actor: like_state::IsSet,
174 S::IndexedAt: like_state::IsSet,
175 S::CreatedAt: like_state::IsSet,
176{
177 /// Build the final struct
178 pub fn build(self) -> Like<'a> {
179 Like {
180 actor: self.__unsafe_private_named.0.unwrap(),
181 created_at: self.__unsafe_private_named.1.unwrap(),
182 indexed_at: self.__unsafe_private_named.2.unwrap(),
183 extra_data: Default::default(),
184 }
185 }
186 /// Build the final struct with custom extra_data
187 pub fn build_with_data(
188 self,
189 extra_data: std::collections::BTreeMap<
190 jacquard_common::smol_str::SmolStr,
191 jacquard_common::types::value::Data<'a>,
192 >,
193 ) -> Like<'a> {
194 Like {
195 actor: self.__unsafe_private_named.0.unwrap(),
196 created_at: self.__unsafe_private_named.1.unwrap(),
197 indexed_at: self.__unsafe_private_named.2.unwrap(),
198 extra_data: Some(extra_data),
199 }
200 }
201}
202
203fn lexicon_doc_app_bsky_feed_getLikes() -> ::jacquard_lexicon::lexicon::LexiconDoc<
204 'static,
205> {
206 ::jacquard_lexicon::lexicon::LexiconDoc {
207 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
208 id: ::jacquard_common::CowStr::new_static("app.bsky.feed.getLikes"),
209 revision: None,
210 description: None,
211 defs: {
212 let mut map = ::alloc::collections::BTreeMap::new();
213 map.insert(
214 ::jacquard_common::smol_str::SmolStr::new_static("like"),
215 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
216 description: None,
217 required: Some(
218 vec![
219 ::jacquard_common::smol_str::SmolStr::new_static("indexedAt"),
220 ::jacquard_common::smol_str::SmolStr::new_static("createdAt"),
221 ::jacquard_common::smol_str::SmolStr::new_static("actor")
222 ],
223 ),
224 nullable: None,
225 properties: {
226 #[allow(unused_mut)]
227 let mut map = ::alloc::collections::BTreeMap::new();
228 map.insert(
229 ::jacquard_common::smol_str::SmolStr::new_static("actor"),
230 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
231 description: None,
232 r#ref: ::jacquard_common::CowStr::new_static(
233 "app.bsky.actor.defs#profileView",
234 ),
235 }),
236 );
237 map.insert(
238 ::jacquard_common::smol_str::SmolStr::new_static(
239 "createdAt",
240 ),
241 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
242 description: None,
243 format: Some(
244 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
245 ),
246 default: None,
247 min_length: None,
248 max_length: None,
249 min_graphemes: None,
250 max_graphemes: None,
251 r#enum: None,
252 r#const: None,
253 known_values: None,
254 }),
255 );
256 map.insert(
257 ::jacquard_common::smol_str::SmolStr::new_static(
258 "indexedAt",
259 ),
260 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
261 description: None,
262 format: Some(
263 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
264 ),
265 default: None,
266 min_length: None,
267 max_length: None,
268 min_graphemes: None,
269 max_graphemes: None,
270 r#enum: None,
271 r#const: None,
272 known_values: None,
273 }),
274 );
275 map
276 },
277 }),
278 );
279 map.insert(
280 ::jacquard_common::smol_str::SmolStr::new_static("main"),
281 ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery {
282 description: None,
283 parameters: Some(
284 ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters {
285 description: None,
286 required: Some(
287 vec![
288 ::jacquard_common::smol_str::SmolStr::new_static("uri")
289 ],
290 ),
291 properties: {
292 #[allow(unused_mut)]
293 let mut map = ::alloc::collections::BTreeMap::new();
294 map.insert(
295 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
296 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
297 description: Some(
298 ::jacquard_common::CowStr::new_static(
299 "CID of the subject record (aka, specific version of record), to filter likes.",
300 ),
301 ),
302 format: Some(
303 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
304 ),
305 default: None,
306 min_length: None,
307 max_length: None,
308 min_graphemes: None,
309 max_graphemes: None,
310 r#enum: None,
311 r#const: None,
312 known_values: None,
313 }),
314 );
315 map.insert(
316 ::jacquard_common::smol_str::SmolStr::new_static("cursor"),
317 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
318 description: None,
319 format: None,
320 default: None,
321 min_length: None,
322 max_length: None,
323 min_graphemes: None,
324 max_graphemes: None,
325 r#enum: None,
326 r#const: None,
327 known_values: None,
328 }),
329 );
330 map.insert(
331 ::jacquard_common::smol_str::SmolStr::new_static("limit"),
332 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
333 description: None,
334 default: None,
335 minimum: None,
336 maximum: None,
337 r#enum: None,
338 r#const: None,
339 }),
340 );
341 map.insert(
342 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
343 ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString {
344 description: Some(
345 ::jacquard_common::CowStr::new_static(
346 "AT-URI of the subject (eg, a post record).",
347 ),
348 ),
349 format: Some(
350 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
351 ),
352 default: None,
353 min_length: None,
354 max_length: None,
355 min_graphemes: None,
356 max_graphemes: None,
357 r#enum: None,
358 r#const: None,
359 known_values: None,
360 }),
361 );
362 map
363 },
364 }),
365 ),
366 output: None,
367 errors: None,
368 }),
369 );
370 map
371 },
372 }
373}
374
375impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Like<'a> {
376 fn nsid() -> &'static str {
377 "app.bsky.feed.getLikes"
378 }
379 fn def_name() -> &'static str {
380 "like"
381 }
382 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
383 lexicon_doc_app_bsky_feed_getLikes()
384 }
385 fn validate(
386 &self,
387 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
388 Ok(())
389 }
390}
391
392#[derive(
393 serde::Serialize,
394 serde::Deserialize,
395 Debug,
396 Clone,
397 PartialEq,
398 Eq,
399 jacquard_derive::IntoStatic
400)]
401#[serde(rename_all = "camelCase")]
402pub struct GetLikes<'a> {
403 #[serde(skip_serializing_if = "std::option::Option::is_none")]
404 #[serde(borrow)]
405 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
406 #[serde(skip_serializing_if = "std::option::Option::is_none")]
407 #[serde(borrow)]
408 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
409 ///(default: 50, min: 1, max: 100)
410 #[serde(skip_serializing_if = "std::option::Option::is_none")]
411 pub limit: std::option::Option<i64>,
412 #[serde(borrow)]
413 pub uri: jacquard_common::types::string::AtUri<'a>,
414}
415
416pub mod get_likes_state {
417
418 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
419 #[allow(unused)]
420 use ::core::marker::PhantomData;
421 mod sealed {
422 pub trait Sealed {}
423 }
424 /// State trait tracking which required fields have been set
425 pub trait State: sealed::Sealed {
426 type Uri;
427 }
428 /// Empty state - all required fields are unset
429 pub struct Empty(());
430 impl sealed::Sealed for Empty {}
431 impl State for Empty {
432 type Uri = Unset;
433 }
434 ///State transition - sets the `uri` field to Set
435 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
436 impl<S: State> sealed::Sealed for SetUri<S> {}
437 impl<S: State> State for SetUri<S> {
438 type Uri = Set<members::uri>;
439 }
440 /// Marker types for field names
441 #[allow(non_camel_case_types)]
442 pub mod members {
443 ///Marker type for the `uri` field
444 pub struct uri(());
445 }
446}
447
448/// Builder for constructing an instance of this type
449pub struct GetLikesBuilder<'a, S: get_likes_state::State> {
450 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
451 __unsafe_private_named: (
452 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
453 ::core::option::Option<jacquard_common::CowStr<'a>>,
454 ::core::option::Option<i64>,
455 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
456 ),
457 _phantom: ::core::marker::PhantomData<&'a ()>,
458}
459
460impl<'a> GetLikes<'a> {
461 /// Create a new builder for this type
462 pub fn new() -> GetLikesBuilder<'a, get_likes_state::Empty> {
463 GetLikesBuilder::new()
464 }
465}
466
467impl<'a> GetLikesBuilder<'a, get_likes_state::Empty> {
468 /// Create a new builder with all fields unset
469 pub fn new() -> Self {
470 GetLikesBuilder {
471 _phantom_state: ::core::marker::PhantomData,
472 __unsafe_private_named: (None, None, None, None),
473 _phantom: ::core::marker::PhantomData,
474 }
475 }
476}
477
478impl<'a, S: get_likes_state::State> GetLikesBuilder<'a, S> {
479 /// Set the `cid` field (optional)
480 pub fn cid(
481 mut self,
482 value: impl Into<Option<jacquard_common::types::string::Cid<'a>>>,
483 ) -> Self {
484 self.__unsafe_private_named.0 = value.into();
485 self
486 }
487 /// Set the `cid` field to an Option value (optional)
488 pub fn maybe_cid(
489 mut self,
490 value: Option<jacquard_common::types::string::Cid<'a>>,
491 ) -> Self {
492 self.__unsafe_private_named.0 = value;
493 self
494 }
495}
496
497impl<'a, S: get_likes_state::State> GetLikesBuilder<'a, S> {
498 /// Set the `cursor` field (optional)
499 pub fn cursor(
500 mut self,
501 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
502 ) -> Self {
503 self.__unsafe_private_named.1 = value.into();
504 self
505 }
506 /// Set the `cursor` field to an Option value (optional)
507 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
508 self.__unsafe_private_named.1 = value;
509 self
510 }
511}
512
513impl<'a, S: get_likes_state::State> GetLikesBuilder<'a, S> {
514 /// Set the `limit` field (optional)
515 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
516 self.__unsafe_private_named.2 = value.into();
517 self
518 }
519 /// Set the `limit` field to an Option value (optional)
520 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
521 self.__unsafe_private_named.2 = value;
522 self
523 }
524}
525
526impl<'a, S> GetLikesBuilder<'a, S>
527where
528 S: get_likes_state::State,
529 S::Uri: get_likes_state::IsUnset,
530{
531 /// Set the `uri` field (required)
532 pub fn uri(
533 mut self,
534 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
535 ) -> GetLikesBuilder<'a, get_likes_state::SetUri<S>> {
536 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
537 GetLikesBuilder {
538 _phantom_state: ::core::marker::PhantomData,
539 __unsafe_private_named: self.__unsafe_private_named,
540 _phantom: ::core::marker::PhantomData,
541 }
542 }
543}
544
545impl<'a, S> GetLikesBuilder<'a, S>
546where
547 S: get_likes_state::State,
548 S::Uri: get_likes_state::IsSet,
549{
550 /// Build the final struct
551 pub fn build(self) -> GetLikes<'a> {
552 GetLikes {
553 cid: self.__unsafe_private_named.0,
554 cursor: self.__unsafe_private_named.1,
555 limit: self.__unsafe_private_named.2,
556 uri: self.__unsafe_private_named.3.unwrap(),
557 }
558 }
559}
560
561#[jacquard_derive::lexicon]
562#[derive(
563 serde::Serialize,
564 serde::Deserialize,
565 Debug,
566 Clone,
567 PartialEq,
568 Eq,
569 jacquard_derive::IntoStatic
570)]
571#[serde(rename_all = "camelCase")]
572pub struct GetLikesOutput<'a> {
573 #[serde(skip_serializing_if = "std::option::Option::is_none")]
574 #[serde(borrow)]
575 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
576 #[serde(skip_serializing_if = "std::option::Option::is_none")]
577 #[serde(borrow)]
578 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
579 #[serde(borrow)]
580 pub likes: Vec<crate::app_bsky::feed::get_likes::Like<'a>>,
581 #[serde(borrow)]
582 pub uri: jacquard_common::types::string::AtUri<'a>,
583}
584
585/// Response type for
586///app.bsky.feed.getLikes
587pub struct GetLikesResponse;
588impl jacquard_common::xrpc::XrpcResp for GetLikesResponse {
589 const NSID: &'static str = "app.bsky.feed.getLikes";
590 const ENCODING: &'static str = "application/json";
591 type Output<'de> = GetLikesOutput<'de>;
592 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
593}
594
595impl<'a> jacquard_common::xrpc::XrpcRequest for GetLikes<'a> {
596 const NSID: &'static str = "app.bsky.feed.getLikes";
597 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
598 type Response = GetLikesResponse;
599}
600
601/// Endpoint type for
602///app.bsky.feed.getLikes
603pub struct GetLikesRequest;
604impl jacquard_common::xrpc::XrpcEndpoint for GetLikesRequest {
605 const PATH: &'static str = "/xrpc/app.bsky.feed.getLikes";
606 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
607 type Request<'de> = GetLikes<'de>;
608 type Response = GetLikesResponse;
609}