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)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct GetValues<'a> {
20 #[serde(skip_serializing_if = "std::option::Option::is_none")]
21 #[serde(borrow)]
22 #[builder(into)]
23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
24 ///(default: 100, min: 1, max: 1000)
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 pub limit: std::option::Option<i64>,
27 #[serde(borrow)]
28 #[builder(into)]
29 pub name: jacquard_common::CowStr<'a>,
30}
31
32impl jacquard_common::IntoStatic for GetValues<'_> {
33 type Output = GetValues<'static>;
34 fn into_static(self) -> Self::Output {
35 GetValues {
36 cursor: self.cursor.into_static(),
37 limit: self.limit.into_static(),
38 name: self.name.into_static(),
39 }
40 }
41}
42
43#[jacquard_derive::lexicon]
44#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
45#[serde(rename_all = "camelCase")]
46pub struct GetValuesOutput<'a> {
47 #[serde(skip_serializing_if = "std::option::Option::is_none")]
48 #[serde(borrow)]
49 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
50 #[serde(borrow)]
51 pub set: crate::tools_ozone::set::SetView<'a>,
52 #[serde(borrow)]
53 pub values: Vec<jacquard_common::CowStr<'a>>,
54}
55
56impl jacquard_common::IntoStatic for GetValuesOutput<'_> {
57 type Output = GetValuesOutput<'static>;
58 fn into_static(self) -> Self::Output {
59 GetValuesOutput {
60 cursor: self.cursor.into_static(),
61 set: self.set.into_static(),
62 values: self.values.into_static(),
63 extra_data: self.extra_data.into_static(),
64 }
65 }
66}
67
68#[jacquard_derive::open_union]
69#[derive(
70 serde::Serialize,
71 serde::Deserialize,
72 Debug,
73 Clone,
74 PartialEq,
75 Eq,
76 thiserror::Error,
77 miette::Diagnostic
78)]
79#[serde(tag = "error", content = "message")]
80#[serde(bound(deserialize = "'de: 'a"))]
81pub enum GetValuesError<'a> {
82 ///set with the given name does not exist
83 #[serde(rename = "SetNotFound")]
84 SetNotFound(std::option::Option<String>),
85}
86
87impl std::fmt::Display for GetValuesError<'_> {
88 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
89 match self {
90 Self::SetNotFound(msg) => {
91 write!(f, "SetNotFound")?;
92 if let Some(msg) = msg {
93 write!(f, ": {}", msg)?;
94 }
95 Ok(())
96 }
97 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
98 }
99 }
100}
101
102impl jacquard_common::IntoStatic for GetValuesError<'_> {
103 type Output = GetValuesError<'static>;
104 fn into_static(self) -> Self::Output {
105 match self {
106 GetValuesError::SetNotFound(v) => {
107 GetValuesError::SetNotFound(v.into_static())
108 }
109 GetValuesError::Unknown(v) => GetValuesError::Unknown(v.into_static()),
110 }
111 }
112}
113
114impl jacquard_common::types::xrpc::XrpcRequest for GetValues<'_> {
115 const NSID: &'static str = "tools.ozone.set.getValues";
116 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
117 const OUTPUT_ENCODING: &'static str = "application/json";
118 type Output<'de> = GetValuesOutput<'de>;
119 type Err<'de> = GetValuesError<'de>;
120}