jacquard_api/place_stream/chat/
profile.rs1#[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 Color<'a> {
22 pub blue: i64,
23 pub green: i64,
24 pub red: i64,
25}
26
27#[jacquard_derive::lexicon]
29#[derive(
30 serde::Serialize,
31 serde::Deserialize,
32 Debug,
33 Clone,
34 PartialEq,
35 Eq,
36 jacquard_derive::IntoStatic,
37 bon::Builder
38)]
39#[serde(rename_all = "camelCase")]
40pub struct Profile<'a> {
41 #[serde(skip_serializing_if = "std::option::Option::is_none")]
42 #[builder(into)]
43 #[serde(borrow)]
44 pub color: Option<crate::place_stream::chat::profile::Color<'a>>,
45}
46
47impl<'a> Profile<'a> {
48 pub fn uri(
49 uri: impl Into<jacquard_common::CowStr<'a>>,
50 ) -> Result<
51 jacquard_common::types::uri::RecordUri<'a, ProfileRecord>,
52 jacquard_common::types::uri::UriError,
53 > {
54 jacquard_common::types::uri::RecordUri::try_from_uri(
55 jacquard_common::types::string::AtUri::new_cow(uri.into())?,
56 )
57 }
58}
59
60#[derive(
62 serde::Serialize,
63 serde::Deserialize,
64 Debug,
65 Clone,
66 PartialEq,
67 Eq,
68 jacquard_derive::IntoStatic
69)]
70#[serde(rename_all = "camelCase")]
71pub struct ProfileGetRecordOutput<'a> {
72 #[serde(skip_serializing_if = "std::option::Option::is_none")]
73 #[serde(borrow)]
74 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
75 #[serde(borrow)]
76 pub uri: jacquard_common::types::string::AtUri<'a>,
77 #[serde(borrow)]
78 pub value: Profile<'a>,
79}
80
81impl From<ProfileGetRecordOutput<'_>> for Profile<'_> {
82 fn from(output: ProfileGetRecordOutput<'_>) -> Self {
83 use jacquard_common::IntoStatic;
84 output.value.into_static()
85 }
86}
87
88impl jacquard_common::types::collection::Collection for Profile<'_> {
89 const NSID: &'static str = "place.stream.chat.profile";
90 type Record = ProfileRecord;
91}
92
93#[derive(Debug, serde::Serialize, serde::Deserialize)]
95pub struct ProfileRecord;
96impl jacquard_common::xrpc::XrpcResp for ProfileRecord {
97 const NSID: &'static str = "place.stream.chat.profile";
98 const ENCODING: &'static str = "application/json";
99 type Output<'de> = ProfileGetRecordOutput<'de>;
100 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
101}
102
103impl jacquard_common::types::collection::Collection for ProfileRecord {
104 const NSID: &'static str = "place.stream.chat.profile";
105 type Record = ProfileRecord;
106}