jacquard_api/tools_ozone/set/
add_values.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: tools.ozone.set.addValues
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 AddValues<'a> {
20    /// Name of the set to add values to
21    #[serde(borrow)]
22    pub name: jacquard_common::CowStr<'a>,
23    /// Array of string values to add to the set
24    #[serde(borrow)]
25    pub values: Vec<jacquard_common::CowStr<'a>>,
26}
27
28pub mod add_values_state {
29
30    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
31    #[allow(unused)]
32    use ::core::marker::PhantomData;
33    mod sealed {
34        pub trait Sealed {}
35    }
36    /// State trait tracking which required fields have been set
37    pub trait State: sealed::Sealed {
38        type Name;
39        type Values;
40    }
41    /// Empty state - all required fields are unset
42    pub struct Empty(());
43    impl sealed::Sealed for Empty {}
44    impl State for Empty {
45        type Name = Unset;
46        type Values = Unset;
47    }
48    ///State transition - sets the `name` field to Set
49    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
50    impl<S: State> sealed::Sealed for SetName<S> {}
51    impl<S: State> State for SetName<S> {
52        type Name = Set<members::name>;
53        type Values = S::Values;
54    }
55    ///State transition - sets the `values` field to Set
56    pub struct SetValues<S: State = Empty>(PhantomData<fn() -> S>);
57    impl<S: State> sealed::Sealed for SetValues<S> {}
58    impl<S: State> State for SetValues<S> {
59        type Name = S::Name;
60        type Values = Set<members::values>;
61    }
62    /// Marker types for field names
63    #[allow(non_camel_case_types)]
64    pub mod members {
65        ///Marker type for the `name` field
66        pub struct name(());
67        ///Marker type for the `values` field
68        pub struct values(());
69    }
70}
71
72/// Builder for constructing an instance of this type
73pub struct AddValuesBuilder<'a, S: add_values_state::State> {
74    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
75    __unsafe_private_named: (
76        ::core::option::Option<jacquard_common::CowStr<'a>>,
77        ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>,
78    ),
79    _phantom: ::core::marker::PhantomData<&'a ()>,
80}
81
82impl<'a> AddValues<'a> {
83    /// Create a new builder for this type
84    pub fn new() -> AddValuesBuilder<'a, add_values_state::Empty> {
85        AddValuesBuilder::new()
86    }
87}
88
89impl<'a> AddValuesBuilder<'a, add_values_state::Empty> {
90    /// Create a new builder with all fields unset
91    pub fn new() -> Self {
92        AddValuesBuilder {
93            _phantom_state: ::core::marker::PhantomData,
94            __unsafe_private_named: (None, None),
95            _phantom: ::core::marker::PhantomData,
96        }
97    }
98}
99
100impl<'a, S> AddValuesBuilder<'a, S>
101where
102    S: add_values_state::State,
103    S::Name: add_values_state::IsUnset,
104{
105    /// Set the `name` field (required)
106    pub fn name(
107        mut self,
108        value: impl Into<jacquard_common::CowStr<'a>>,
109    ) -> AddValuesBuilder<'a, add_values_state::SetName<S>> {
110        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
111        AddValuesBuilder {
112            _phantom_state: ::core::marker::PhantomData,
113            __unsafe_private_named: self.__unsafe_private_named,
114            _phantom: ::core::marker::PhantomData,
115        }
116    }
117}
118
119impl<'a, S> AddValuesBuilder<'a, S>
120where
121    S: add_values_state::State,
122    S::Values: add_values_state::IsUnset,
123{
124    /// Set the `values` field (required)
125    pub fn values(
126        mut self,
127        value: impl Into<Vec<jacquard_common::CowStr<'a>>>,
128    ) -> AddValuesBuilder<'a, add_values_state::SetValues<S>> {
129        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
130        AddValuesBuilder {
131            _phantom_state: ::core::marker::PhantomData,
132            __unsafe_private_named: self.__unsafe_private_named,
133            _phantom: ::core::marker::PhantomData,
134        }
135    }
136}
137
138impl<'a, S> AddValuesBuilder<'a, S>
139where
140    S: add_values_state::State,
141    S::Name: add_values_state::IsSet,
142    S::Values: add_values_state::IsSet,
143{
144    /// Build the final struct
145    pub fn build(self) -> AddValues<'a> {
146        AddValues {
147            name: self.__unsafe_private_named.0.unwrap(),
148            values: self.__unsafe_private_named.1.unwrap(),
149            extra_data: Default::default(),
150        }
151    }
152    /// Build the final struct with custom extra_data
153    pub fn build_with_data(
154        self,
155        extra_data: std::collections::BTreeMap<
156            jacquard_common::smol_str::SmolStr,
157            jacquard_common::types::value::Data<'a>,
158        >,
159    ) -> AddValues<'a> {
160        AddValues {
161            name: self.__unsafe_private_named.0.unwrap(),
162            values: self.__unsafe_private_named.1.unwrap(),
163            extra_data: Some(extra_data),
164        }
165    }
166}
167
168/// Response type for
169///tools.ozone.set.addValues
170pub struct AddValuesResponse;
171impl jacquard_common::xrpc::XrpcResp for AddValuesResponse {
172    const NSID: &'static str = "tools.ozone.set.addValues";
173    const ENCODING: &'static str = "application/json";
174    type Output<'de> = ();
175    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
176}
177
178impl<'a> jacquard_common::xrpc::XrpcRequest for AddValues<'a> {
179    const NSID: &'static str = "tools.ozone.set.addValues";
180    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
181        "application/json",
182    );
183    type Response = AddValuesResponse;
184}
185
186/// Endpoint type for
187///tools.ozone.set.addValues
188pub struct AddValuesRequest;
189impl jacquard_common::xrpc::XrpcEndpoint for AddValuesRequest {
190    const PATH: &'static str = "/xrpc/tools.ozone.set.addValues";
191    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
192        "application/json",
193    );
194    type Request<'de> = AddValues<'de>;
195    type Response = AddValuesResponse;
196}