jacquard_api/tools_ozone/set/
delete_set.rs

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