1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.label.definition
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 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct Definition<'a> {
20 ///The hex value for the background color for the label. Appviews may choose to respect this.
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 pub color: std::option::Option<jacquard_common::CowStr<'a>>,
24 pub created_at: jacquard_common::types::string::Datetime,
25 ///Whether this label can be repeated for a given entity, eg.: [reviewer:foo, reviewer:bar]
26 #[serde(skip_serializing_if = "std::option::Option::is_none")]
27 pub multiple: std::option::Option<bool>,
28 ///The display name of this label.
29 #[serde(borrow)]
30 pub name: jacquard_common::CowStr<'a>,
31 ///The areas of the repo this label may apply to, eg.: sh.tangled.repo.issue. Appviews may choose to respect this.
32 #[serde(borrow)]
33 pub scope: Vec<jacquard_common::types::string::Nsid<'a>>,
34 ///The type definition of this label. Appviews may allow sorting for certain types.
35 #[serde(borrow)]
36 pub value_type: crate::sh_tangled::label::definition::ValueType<'a>,
37}
38
39/// Typed wrapper for GetRecord response with this collection's record type.
40#[derive(
41 serde::Serialize,
42 serde::Deserialize,
43 Debug,
44 Clone,
45 PartialEq,
46 Eq,
47 jacquard_derive::IntoStatic
48)]
49#[serde(rename_all = "camelCase")]
50pub struct DefinitionGetRecordOutput<'a> {
51 #[serde(skip_serializing_if = "std::option::Option::is_none")]
52 #[serde(borrow)]
53 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
54 #[serde(borrow)]
55 pub uri: jacquard_common::types::string::AtUri<'a>,
56 #[serde(borrow)]
57 pub value: Definition<'a>,
58}
59
60/// Marker type for deserializing records from this collection.
61pub struct DefinitionRecord;
62impl jacquard_common::xrpc::XrpcResp for DefinitionRecord {
63 const NSID: &'static str = "sh.tangled.label.definition";
64 const ENCODING: &'static str = "application/json";
65 type Output<'de> = DefinitionGetRecordOutput<'de>;
66 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
67}
68
69impl jacquard_common::types::collection::Collection for Definition<'_> {
70 const NSID: &'static str = "sh.tangled.label.definition";
71 type Record = DefinitionRecord;
72}
73
74impl From<DefinitionGetRecordOutput<'_>> for Definition<'_> {
75 fn from(output: DefinitionGetRecordOutput<'_>) -> Self {
76 use jacquard_common::IntoStatic;
77 output.value.into_static()
78 }
79}
80
81#[jacquard_derive::lexicon]
82#[derive(
83 serde::Serialize,
84 serde::Deserialize,
85 Debug,
86 Clone,
87 PartialEq,
88 Eq,
89 jacquard_derive::IntoStatic
90)]
91#[serde(rename_all = "camelCase")]
92pub struct ValueType<'a> {
93 ///Closed set of values that this label can take.
94 #[serde(skip_serializing_if = "std::option::Option::is_none")]
95 #[serde(borrow)]
96 pub r#enum: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
97 ///An optional constraint that can be applied on string concrete types.
98 #[serde(borrow)]
99 pub format: jacquard_common::CowStr<'a>,
100 ///The concrete type of this label's value.
101 #[serde(borrow)]
102 pub r#type: jacquard_common::CowStr<'a>,
103}