jacquard_api/com_atproto/temp/
fetch_labels.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_derive::{IntoStatic, lexicon};
14use serde::{Serialize, Deserialize};
15use crate::com_atproto::label::Label;
16
17#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
18#[serde(rename_all = "camelCase")]
19pub struct FetchLabels {
20 #[serde(default = "_default_limit")]
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub limit: Option<i64>,
24 #[serde(skip_serializing_if = "Option::is_none")]
25 pub since: Option<i64>,
26}
27
28
29#[lexicon]
30#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
31#[serde(rename_all = "camelCase")]
32pub struct FetchLabelsOutput<'a> {
33 #[serde(borrow)]
34 pub labels: Vec<Label<'a>>,
35}
36
37pub struct FetchLabelsResponse;
39impl jacquard_common::xrpc::XrpcResp for FetchLabelsResponse {
40 const NSID: &'static str = "com.atproto.temp.fetchLabels";
41 const ENCODING: &'static str = "application/json";
42 type Output<'de> = FetchLabelsOutput<'de>;
43 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
44}
45
46impl jacquard_common::xrpc::XrpcRequest for FetchLabels {
47 const NSID: &'static str = "com.atproto.temp.fetchLabels";
48 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
49 type Response = FetchLabelsResponse;
50}
51
52pub struct FetchLabelsRequest;
54impl jacquard_common::xrpc::XrpcEndpoint for FetchLabelsRequest {
55 const PATH: &'static str = "/xrpc/com.atproto.temp.fetchLabels";
56 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
57 type Request<'de> = FetchLabels;
58 type Response = FetchLabelsResponse;
59}
60
61fn _default_limit() -> Option<i64> {
62 Some(50i64)
63}
64
65pub mod fetch_labels_state {
66
67 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
68 #[allow(unused)]
69 use ::core::marker::PhantomData;
70 mod sealed {
71 pub trait Sealed {}
72 }
73 pub trait State: sealed::Sealed {}
75 pub struct Empty(());
77 impl sealed::Sealed for Empty {}
78 impl State for Empty {}
79 #[allow(non_camel_case_types)]
81 pub mod members {}
82}
83
84pub struct FetchLabelsBuilder<S: fetch_labels_state::State> {
86 _state: PhantomData<fn() -> S>,
87 _fields: (Option<i64>, Option<i64>),
88}
89
90impl FetchLabels {
91 pub fn new() -> FetchLabelsBuilder<fetch_labels_state::Empty> {
93 FetchLabelsBuilder::new()
94 }
95}
96
97impl FetchLabelsBuilder<fetch_labels_state::Empty> {
98 pub fn new() -> Self {
100 FetchLabelsBuilder {
101 _state: PhantomData,
102 _fields: (None, None),
103 }
104 }
105}
106
107impl<S: fetch_labels_state::State> FetchLabelsBuilder<S> {
108 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
110 self._fields.0 = value.into();
111 self
112 }
113 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
115 self._fields.0 = value;
116 self
117 }
118}
119
120impl<S: fetch_labels_state::State> FetchLabelsBuilder<S> {
121 pub fn since(mut self, value: impl Into<Option<i64>>) -> Self {
123 self._fields.1 = value.into();
124 self
125 }
126 pub fn maybe_since(mut self, value: Option<i64>) -> Self {
128 self._fields.1 = value;
129 self
130 }
131}
132
133impl<S> FetchLabelsBuilder<S>
134where
135 S: fetch_labels_state::State,
136{
137 pub fn build(self) -> FetchLabels {
139 FetchLabels {
140 limit: self._fields.0,
141 since: self._fields.1,
142 }
143 }
144}