Skip to main content

jacquard_api/com_atproto/temp/
fetch_labels.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.temp.fetchLabels
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[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    ///Defaults to `50`. Min: 1. Max: 250.
21    #[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
37/// Response type for com.atproto.temp.fetchLabels
38pub 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
52/// Endpoint type for com.atproto.temp.fetchLabels
53pub 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    /// State trait tracking which required fields have been set
74    pub trait State: sealed::Sealed {}
75    /// Empty state - all required fields are unset
76    pub struct Empty(());
77    impl sealed::Sealed for Empty {}
78    impl State for Empty {}
79    /// Marker types for field names
80    #[allow(non_camel_case_types)]
81    pub mod members {}
82}
83
84/// Builder for constructing an instance of this type
85pub struct FetchLabelsBuilder<S: fetch_labels_state::State> {
86    _state: PhantomData<fn() -> S>,
87    _fields: (Option<i64>, Option<i64>),
88}
89
90impl FetchLabels {
91    /// Create a new builder for this type
92    pub fn new() -> FetchLabelsBuilder<fetch_labels_state::Empty> {
93        FetchLabelsBuilder::new()
94    }
95}
96
97impl FetchLabelsBuilder<fetch_labels_state::Empty> {
98    /// Create a new builder with all fields unset
99    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    /// Set the `limit` field (optional)
109    pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
110        self._fields.0 = value.into();
111        self
112    }
113    /// Set the `limit` field to an Option value (optional)
114    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    /// Set the `since` field (optional)
122    pub fn since(mut self, value: impl Into<Option<i64>>) -> Self {
123        self._fields.1 = value.into();
124        self
125    }
126    /// Set the `since` field to an Option value (optional)
127    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    /// Build the final struct
138    pub fn build(self) -> FetchLabels {
139        FetchLabels {
140            limit: self._fields.0,
141            since: self._fields.1,
142        }
143    }
144}