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