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_common::{BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::value::Data;
16use jacquard_derive::IntoStatic;
17use serde::{Serialize, Deserialize};
18use crate::com_atproto::label::Label;
19
20#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
21#[serde(rename_all = "camelCase")]
22pub struct FetchLabels {
23 #[serde(default = "_default_limit")]
25 #[serde(skip_serializing_if = "Option::is_none")]
26 pub limit: Option<i64>,
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub since: Option<i64>,
29}
30
31
32#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
33#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
34pub struct FetchLabelsOutput<S: BosStr = DefaultStr> {
35 pub labels: Vec<Label<S>>,
36 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
37 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
38}
39
40pub struct FetchLabelsResponse;
44impl jacquard_common::xrpc::XrpcResp for FetchLabelsResponse {
45 const NSID: &'static str = "com.atproto.temp.fetchLabels";
46 const ENCODING: &'static str = "application/json";
47 type Output<S: BosStr> = FetchLabelsOutput<S>;
48 type Err = jacquard_common::xrpc::GenericError;
49}
50
51impl jacquard_common::xrpc::XrpcRequest for FetchLabels {
52 const NSID: &'static str = "com.atproto.temp.fetchLabels";
53 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
54 type Response = FetchLabelsResponse;
55}
56
57pub struct FetchLabelsRequest;
61impl jacquard_common::xrpc::XrpcEndpoint for FetchLabelsRequest {
62 const PATH: &'static str = "/xrpc/com.atproto.temp.fetchLabels";
63 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
64 type Request<S: BosStr> = FetchLabels;
65 type Response = FetchLabelsResponse;
66}
67
68fn _default_limit() -> Option<i64> {
69 Some(50i64)
70}
71
72pub mod fetch_labels_state {
73
74 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
75 #[allow(unused)]
76 use ::core::marker::PhantomData;
77 mod sealed {
78 pub trait Sealed {}
79 }
80 pub trait State: sealed::Sealed {}
82 pub struct Empty(());
84 impl sealed::Sealed for Empty {}
85 impl State for Empty {}
86 #[allow(non_camel_case_types)]
88 pub mod members {}
89}
90
91pub struct FetchLabelsBuilder<St: fetch_labels_state::State> {
93 _state: PhantomData<fn() -> St>,
94 _fields: (Option<i64>, Option<i64>),
95}
96
97impl FetchLabels {
98 pub fn new() -> FetchLabelsBuilder<fetch_labels_state::Empty> {
100 FetchLabelsBuilder::new()
101 }
102}
103
104impl FetchLabelsBuilder<fetch_labels_state::Empty> {
105 pub fn new() -> Self {
107 FetchLabelsBuilder {
108 _state: PhantomData,
109 _fields: (None, None),
110 }
111 }
112}
113
114impl FetchLabelsBuilder<fetch_labels_state::Empty> {
115 pub fn builder() -> Self {
117 FetchLabelsBuilder {
118 _state: PhantomData,
119 _fields: (None, None),
120 }
121 }
122}
123
124impl<St: fetch_labels_state::State> FetchLabelsBuilder<St> {
125 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
127 self._fields.0 = value.into();
128 self
129 }
130 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
132 self._fields.0 = value;
133 self
134 }
135}
136
137impl<St: fetch_labels_state::State> FetchLabelsBuilder<St> {
138 pub fn since(mut self, value: impl Into<Option<i64>>) -> Self {
140 self._fields.1 = value.into();
141 self
142 }
143 pub fn maybe_since(mut self, value: Option<i64>) -> Self {
145 self._fields.1 = value;
146 self
147 }
148}
149
150impl<St> FetchLabelsBuilder<St>
151where
152 St: fetch_labels_state::State,
153{
154 pub fn build(self) -> FetchLabels {
156 FetchLabels {
157 limit: self._fields.0,
158 since: self._fields.1,
159 }
160 }
161}