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(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
9#[serde(rename_all = "camelCase")]
10pub struct GetValues<'a> {
11 #[serde(skip_serializing_if = "std::option::Option::is_none")]
12 #[serde(borrow)]
13 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
14 ///(default: 100, min: 1, max: 1000)
15 #[serde(skip_serializing_if = "std::option::Option::is_none")]
16 pub limit: std::option::Option<i64>,
17 #[serde(borrow)]
18 pub name: jacquard_common::CowStr<'a>,
19}
20
21impl jacquard_common::IntoStatic for GetValues<'_> {
22 type Output = GetValues<'static>;
23 fn into_static(self) -> Self::Output {
24 GetValues {
25 cursor: self.cursor.into_static(),
26 limit: self.limit.into_static(),
27 name: self.name.into_static(),
28 }
29 }
30}
31
32#[jacquard_derive::lexicon]
33#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
34#[serde(rename_all = "camelCase")]
35pub struct GetValuesOutput<'a> {
36 #[serde(skip_serializing_if = "std::option::Option::is_none")]
37 #[serde(borrow)]
38 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
39 #[serde(borrow)]
40 pub set: crate::tools_ozone::set::SetView<'a>,
41 #[serde(borrow)]
42 pub values: Vec<jacquard_common::CowStr<'a>>,
43}
44
45impl jacquard_common::IntoStatic for GetValuesOutput<'_> {
46 type Output = GetValuesOutput<'static>;
47 fn into_static(self) -> Self::Output {
48 GetValuesOutput {
49 cursor: self.cursor.into_static(),
50 set: self.set.into_static(),
51 values: self.values.into_static(),
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 GetValuesError<'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 GetValuesError<'_> {
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 GetValuesError<'_> {
92 type Output = GetValuesError<'static>;
93 fn into_static(self) -> Self::Output {
94 match self {
95 GetValuesError::SetNotFound(v) => {
96 GetValuesError::SetNotFound(v.into_static())
97 }
98 GetValuesError::Unknown(v) => GetValuesError::Unknown(v.into_static()),
99 }
100 }
101}
102
103impl jacquard_common::types::xrpc::XrpcRequest for GetValues<'_> {
104 const NSID: &'static str = "tools.ozone.set.getValues";
105 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
106 const OUTPUT_ENCODING: &'static str = "application/json";
107 type Output<'de> = GetValuesOutput<'de>;
108 type Err<'de> = GetValuesError<'de>;
109}