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