jacquard_api/tools_ozone/set/
get_values.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: tools.ozone.set.getValues
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9    serde::Serialize,
10    serde::Deserialize,
11    Debug,
12    Clone,
13    PartialEq,
14    Eq,
15    bon::Builder,
16    jacquard_derive::IntoStatic
17)]
18#[builder(start_fn = new)]
19#[serde(rename_all = "camelCase")]
20pub struct GetValues<'a> {
21    #[serde(skip_serializing_if = "std::option::Option::is_none")]
22    #[serde(borrow)]
23    #[builder(into)]
24    pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
25    ///(default: 100, min: 1, max: 1000)
26    #[serde(skip_serializing_if = "std::option::Option::is_none")]
27    pub limit: std::option::Option<i64>,
28    #[serde(borrow)]
29    #[builder(into)]
30    pub name: jacquard_common::CowStr<'a>,
31}
32
33#[jacquard_derive::lexicon]
34#[derive(
35    serde::Serialize,
36    serde::Deserialize,
37    Debug,
38    Clone,
39    PartialEq,
40    Eq,
41    jacquard_derive::IntoStatic
42)]
43#[serde(rename_all = "camelCase")]
44pub struct GetValuesOutput<'a> {
45    #[serde(skip_serializing_if = "std::option::Option::is_none")]
46    #[serde(borrow)]
47    pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
48    #[serde(borrow)]
49    pub set: crate::tools_ozone::set::SetView<'a>,
50    #[serde(borrow)]
51    pub values: Vec<jacquard_common::CowStr<'a>>,
52}
53
54#[jacquard_derive::open_union]
55#[derive(
56    serde::Serialize,
57    serde::Deserialize,
58    Debug,
59    Clone,
60    PartialEq,
61    Eq,
62    thiserror::Error,
63    miette::Diagnostic
64)]
65#[serde(tag = "error", content = "message")]
66#[serde(bound(deserialize = "'de: 'a"))]
67pub enum GetValuesError<'a> {
68    ///set with the given name does not exist
69    #[serde(rename = "SetNotFound")]
70    SetNotFound(std::option::Option<String>),
71}
72
73impl std::fmt::Display for GetValuesError<'_> {
74    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
75        match self {
76            Self::SetNotFound(msg) => {
77                write!(f, "SetNotFound")?;
78                if let Some(msg) = msg {
79                    write!(f, ": {}", msg)?;
80                }
81                Ok(())
82            }
83            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
84        }
85    }
86}
87
88impl jacquard_common::IntoStatic for GetValuesError<'_> {
89    type Output = GetValuesError<'static>;
90    fn into_static(self) -> Self::Output {
91        match self {
92            GetValuesError::SetNotFound(v) => {
93                GetValuesError::SetNotFound(v.into_static())
94            }
95            GetValuesError::Unknown(v) => GetValuesError::Unknown(v.into_static()),
96        }
97    }
98}
99
100///Response type for
101///tools.ozone.set.getValues
102pub struct GetValuesResponse;
103impl jacquard_common::xrpc::XrpcResp for GetValuesResponse {
104    const NSID: &'static str = "tools.ozone.set.getValues";
105    const ENCODING: &'static str = "application/json";
106    type Output<'de> = GetValuesOutput<'de>;
107    type Err<'de> = GetValuesError<'de>;
108}
109
110impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetValues<'de> {
111    const NSID: &'static str = "tools.ozone.set.getValues";
112    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
113    type Response = GetValuesResponse;
114}
115
116///Endpoint type for
117///tools.ozone.set.getValues
118pub struct GetValuesRequest;
119impl jacquard_common::xrpc::XrpcEndpoint for GetValuesRequest {
120    const PATH: &'static str = "/xrpc/tools.ozone.set.getValues";
121    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
122    type Request<'de> = GetValues<'de>;
123    type Response = GetValuesResponse;
124}