jacquard_api/tools_ozone/set/
delete_values.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: tools.ozone.set.deleteValues
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    bon::Builder
17)]
18#[serde(rename_all = "camelCase")]
19#[builder(start_fn = new)]
20pub struct DeleteValues<'a> {
21    ///Name of the set to delete values from
22    #[serde(borrow)]
23    #[builder(into)]
24    pub name: jacquard_common::CowStr<'a>,
25    ///Array of string values to delete from the set
26    #[serde(borrow)]
27    pub values: Vec<jacquard_common::CowStr<'a>>,
28    #[serde(flatten)]
29    #[serde(borrow)]
30    #[builder(default)]
31    pub extra_data: ::std::collections::BTreeMap<
32        ::jacquard_common::smol_str::SmolStr,
33        ::jacquard_common::types::value::Data<'a>,
34    >,
35}
36
37impl jacquard_common::IntoStatic for DeleteValues<'_> {
38    type Output = DeleteValues<'static>;
39    fn into_static(self) -> Self::Output {
40        DeleteValues {
41            name: self.name.into_static(),
42            values: self.values.into_static(),
43            extra_data: self.extra_data.into_static(),
44        }
45    }
46}
47
48#[jacquard_derive::open_union]
49#[derive(
50    serde::Serialize,
51    serde::Deserialize,
52    Debug,
53    Clone,
54    PartialEq,
55    Eq,
56    thiserror::Error,
57    miette::Diagnostic
58)]
59#[serde(tag = "error", content = "message")]
60#[serde(bound(deserialize = "'de: 'a"))]
61pub enum DeleteValuesError<'a> {
62    ///set with the given name does not exist
63    #[serde(rename = "SetNotFound")]
64    SetNotFound(std::option::Option<String>),
65}
66
67impl std::fmt::Display for DeleteValuesError<'_> {
68    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
69        match self {
70            Self::SetNotFound(msg) => {
71                write!(f, "SetNotFound")?;
72                if let Some(msg) = msg {
73                    write!(f, ": {}", msg)?;
74                }
75                Ok(())
76            }
77            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
78        }
79    }
80}
81
82impl jacquard_common::IntoStatic for DeleteValuesError<'_> {
83    type Output = DeleteValuesError<'static>;
84    fn into_static(self) -> Self::Output {
85        match self {
86            DeleteValuesError::SetNotFound(v) => {
87                DeleteValuesError::SetNotFound(v.into_static())
88            }
89            DeleteValuesError::Unknown(v) => DeleteValuesError::Unknown(v.into_static()),
90        }
91    }
92}
93
94impl jacquard_common::types::xrpc::XrpcRequest for DeleteValues<'_> {
95    const NSID: &'static str = "tools.ozone.set.deleteValues";
96    const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure(
97        "application/json",
98    );
99    const OUTPUT_ENCODING: &'static str = "application/json";
100    type Output<'de> = ();
101    type Err<'de> = DeleteValuesError<'de>;
102}