1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.label.op
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 Op<'a> {
21 #[serde(borrow)]
22 pub add: Vec<crate::sh_tangled::label::op::Operand<'a>>,
23 #[serde(borrow)]
24 pub delete: Vec<crate::sh_tangled::label::op::Operand<'a>>,
25 pub performed_at: jacquard_common::types::string::Datetime,
26 /// The subject (task, pull or discussion) of this label. Appviews may apply a `scope` check and refuse this op.
27 #[serde(borrow)]
28 pub subject: jacquard_common::types::string::AtUri<'a>,
29}
30
31/// Typed wrapper for GetRecord response with this collection's record type.
32#[derive(
33 serde::Serialize,
34 serde::Deserialize,
35 Debug,
36 Clone,
37 PartialEq,
38 Eq,
39 jacquard_derive::IntoStatic
40)]
41#[serde(rename_all = "camelCase")]
42pub struct OpGetRecordOutput<'a> {
43 #[serde(skip_serializing_if = "std::option::Option::is_none")]
44 #[serde(borrow)]
45 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
46 #[serde(borrow)]
47 pub uri: jacquard_common::types::string::AtUri<'a>,
48 #[serde(borrow)]
49 pub value: Op<'a>,
50}
51
52/// Marker type for deserializing records from this collection.
53pub struct OpRecord;
54impl jacquard_common::xrpc::XrpcResp for OpRecord {
55 const NSID: &'static str = "sh.tangled.label.op";
56 const ENCODING: &'static str = "application/json";
57 type Output<'de> = OpGetRecordOutput<'de>;
58 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
59}
60
61impl jacquard_common::types::collection::Collection for Op<'_> {
62 const NSID: &'static str = "sh.tangled.label.op";
63 type Record = OpRecord;
64}
65
66impl From<OpGetRecordOutput<'_>> for Op<'_> {
67 fn from(output: OpGetRecordOutput<'_>) -> Self {
68 use jacquard_common::IntoStatic;
69 output.value.into_static()
70 }
71}
72
73#[jacquard_derive::lexicon]
74#[derive(
75 serde::Serialize,
76 serde::Deserialize,
77 Debug,
78 Clone,
79 PartialEq,
80 Eq,
81 jacquard_derive::IntoStatic,
82 bon::Builder
83)]
84#[serde(rename_all = "camelCase")]
85pub struct Operand<'a> {
86 /// ATURI to the label definition
87 #[serde(borrow)]
88 pub key: jacquard_common::types::string::AtUri<'a>,
89 /// Stringified value of the label. This is first unstringed by appviews and then interpreted as a concrete value.
90 #[serde(borrow)]
91 #[builder(into)]
92 pub value: jacquard_common::CowStr<'a>,
93}