jacquard_api/place_stream/
key.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.key
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8/// Record linking an atproto identity with a stream signing key
9#[jacquard_derive::lexicon]
10#[derive(
11    serde::Serialize,
12    serde::Deserialize,
13    Debug,
14    Clone,
15    PartialEq,
16    Eq,
17    jacquard_derive::IntoStatic,
18    bon::Builder
19)]
20#[serde(rename_all = "camelCase")]
21pub struct Key<'a> {
22    /// Client-declared timestamp when this key was created.
23    pub created_at: jacquard_common::types::string::Datetime,
24    /// The name of the client that created this key.
25    #[serde(skip_serializing_if = "std::option::Option::is_none")]
26    #[builder(into)]
27    #[serde(borrow)]
28    pub created_by: Option<jacquard_common::CowStr<'a>>,
29    /// The did:key signing key for the stream.
30    #[serde(borrow)]
31    #[builder(into)]
32    pub signing_key: jacquard_common::CowStr<'a>,
33}
34
35impl<'a> Key<'a> {
36    pub fn uri(
37        uri: impl Into<jacquard_common::CowStr<'a>>,
38    ) -> Result<
39        jacquard_common::types::uri::RecordUri<'a, KeyRecord>,
40        jacquard_common::types::uri::UriError,
41    > {
42        jacquard_common::types::uri::RecordUri::try_from_uri(
43            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
44        )
45    }
46}
47
48/// Typed wrapper for GetRecord response with this collection's record type.
49#[derive(
50    serde::Serialize,
51    serde::Deserialize,
52    Debug,
53    Clone,
54    PartialEq,
55    Eq,
56    jacquard_derive::IntoStatic
57)]
58#[serde(rename_all = "camelCase")]
59pub struct KeyGetRecordOutput<'a> {
60    #[serde(skip_serializing_if = "std::option::Option::is_none")]
61    #[serde(borrow)]
62    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
63    #[serde(borrow)]
64    pub uri: jacquard_common::types::string::AtUri<'a>,
65    #[serde(borrow)]
66    pub value: Key<'a>,
67}
68
69impl From<KeyGetRecordOutput<'_>> for Key<'_> {
70    fn from(output: KeyGetRecordOutput<'_>) -> Self {
71        use jacquard_common::IntoStatic;
72        output.value.into_static()
73    }
74}
75
76impl jacquard_common::types::collection::Collection for Key<'_> {
77    const NSID: &'static str = "place.stream.key";
78    type Record = KeyRecord;
79}
80
81/// Marker type for deserializing records from this collection.
82#[derive(Debug, serde::Serialize, serde::Deserialize)]
83pub struct KeyRecord;
84impl jacquard_common::xrpc::XrpcResp for KeyRecord {
85    const NSID: &'static str = "place.stream.key";
86    const ENCODING: &'static str = "application/json";
87    type Output<'de> = KeyGetRecordOutput<'de>;
88    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
89}
90
91impl jacquard_common::types::collection::Collection for KeyRecord {
92    const NSID: &'static str = "place.stream.key";
93    type Record = KeyRecord;
94}