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