A better Rust ATProto crate
at main 6.0 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.stream.livestream 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 LivestreamView<'a> { 21 #[serde(borrow)] 22 pub author: crate::app_bsky::actor::ProfileViewBasic<'a>, 23 #[serde(borrow)] 24 pub cid: jacquard_common::types::string::Cid<'a>, 25 pub indexed_at: jacquard_common::types::string::Datetime, 26 #[serde(borrow)] 27 pub record: jacquard_common::types::value::Data<'a>, 28 #[serde(borrow)] 29 pub uri: jacquard_common::types::string::AtUri<'a>, 30 /// The number of viewers watching this livestream. Use when you can't reasonably use #viewerCount directly. 31 #[serde(skip_serializing_if = "std::option::Option::is_none")] 32 #[builder(into)] 33 #[serde(borrow)] 34 pub viewer_count: Option<crate::place_stream::livestream::ViewerCount<'a>>, 35} 36 37/// Record announcing a livestream is happening 38#[jacquard_derive::lexicon] 39#[derive( 40 serde::Serialize, 41 serde::Deserialize, 42 Debug, 43 Clone, 44 PartialEq, 45 Eq, 46 jacquard_derive::IntoStatic, 47 bon::Builder 48)] 49#[serde(rename_all = "camelCase")] 50pub struct Livestream<'a> { 51 /// The source of the livestream, if available, in a User Agent format: `<product> / <product-version> <comment>` e.g. Streamplace/0.7.5 iOS 52 #[serde(skip_serializing_if = "std::option::Option::is_none")] 53 #[builder(into)] 54 #[serde(borrow)] 55 pub agent: Option<jacquard_common::CowStr<'a>>, 56 /// The primary URL where this livestream can be viewed, if available. 57 #[serde(skip_serializing_if = "std::option::Option::is_none")] 58 #[builder(into)] 59 #[serde(borrow)] 60 pub canonical_url: Option<jacquard_common::types::string::Uri<'a>>, 61 /// Client-declared timestamp when this livestream started. 62 pub created_at: jacquard_common::types::string::Datetime, 63 /// The post that announced this livestream. 64 #[serde(skip_serializing_if = "std::option::Option::is_none")] 65 #[builder(into)] 66 #[serde(borrow)] 67 pub post: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 68 #[serde(skip_serializing_if = "std::option::Option::is_none")] 69 #[builder(into)] 70 #[serde(borrow)] 71 pub thumb: Option<jacquard_common::types::blob::Blob<'a>>, 72 /// The title of the livestream, as it will be announced to followers. 73 #[serde(borrow)] 74 #[builder(into)] 75 pub title: jacquard_common::CowStr<'a>, 76 /// The URL where this stream can be found. This is primarily a hint for other Streamplace nodes to locate and replicate the stream. 77 #[serde(skip_serializing_if = "std::option::Option::is_none")] 78 #[builder(into)] 79 #[serde(borrow)] 80 pub url: Option<jacquard_common::types::string::Uri<'a>>, 81} 82 83/// Typed wrapper for GetRecord response with this collection's record type. 84#[derive( 85 serde::Serialize, 86 serde::Deserialize, 87 Debug, 88 Clone, 89 PartialEq, 90 Eq, 91 jacquard_derive::IntoStatic 92)] 93#[serde(rename_all = "camelCase")] 94pub struct LivestreamGetRecordOutput<'a> { 95 #[serde(skip_serializing_if = "std::option::Option::is_none")] 96 #[serde(borrow)] 97 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 98 #[serde(borrow)] 99 pub uri: jacquard_common::types::string::AtUri<'a>, 100 #[serde(borrow)] 101 pub value: Livestream<'a>, 102} 103 104/// Marker type for deserializing records from this collection. 105pub struct LivestreamRecord; 106impl jacquard_common::xrpc::XrpcResp for LivestreamRecord { 107 const NSID: &'static str = "place.stream.livestream"; 108 const ENCODING: &'static str = "application/json"; 109 type Output<'de> = LivestreamGetRecordOutput<'de>; 110 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 111} 112 113impl jacquard_common::types::collection::Collection for Livestream<'_> { 114 const NSID: &'static str = "place.stream.livestream"; 115 type Record = LivestreamRecord; 116} 117 118impl From<LivestreamGetRecordOutput<'_>> for Livestream<'_> { 119 fn from(output: LivestreamGetRecordOutput<'_>) -> Self { 120 use jacquard_common::IntoStatic; 121 output.value.into_static() 122 } 123} 124 125#[jacquard_derive::lexicon] 126#[derive( 127 serde::Serialize, 128 serde::Deserialize, 129 Debug, 130 Clone, 131 PartialEq, 132 Eq, 133 jacquard_derive::IntoStatic, 134 bon::Builder 135)] 136#[serde(rename_all = "camelCase")] 137pub struct StreamplaceAnything<'a> { 138 #[serde(borrow)] 139 pub livestream: StreamplaceAnythingLivestream<'a>, 140} 141 142#[jacquard_derive::open_union] 143#[derive( 144 serde::Serialize, 145 serde::Deserialize, 146 Debug, 147 Clone, 148 PartialEq, 149 Eq, 150 jacquard_derive::IntoStatic 151)] 152#[serde(tag = "$type")] 153#[serde(bound(deserialize = "'de: 'a"))] 154pub enum StreamplaceAnythingLivestream<'a> { 155 #[serde(rename = "place.stream.livestream#livestreamView")] 156 LivestreamView(Box<crate::place_stream::livestream::LivestreamView<'a>>), 157 #[serde(rename = "place.stream.livestream#viewerCount")] 158 ViewerCount(Box<crate::place_stream::livestream::ViewerCount<'a>>), 159 #[serde(rename = "place.stream.defs#blockView")] 160 BlockView(Box<crate::place_stream::BlockView<'a>>), 161 #[serde(rename = "place.stream.defs#renditions")] 162 Renditions(Box<crate::place_stream::Renditions<'a>>), 163 #[serde(rename = "place.stream.defs#rendition")] 164 Rendition(Box<crate::place_stream::Rendition<'a>>), 165 #[serde(rename = "place.stream.chat.defs#messageView")] 166 MessageView(Box<crate::place_stream::chat::MessageView<'a>>), 167} 168 169#[jacquard_derive::lexicon] 170#[derive( 171 serde::Serialize, 172 serde::Deserialize, 173 Debug, 174 Clone, 175 PartialEq, 176 Eq, 177 jacquard_derive::IntoStatic, 178 bon::Builder 179)] 180#[serde(rename_all = "camelCase")] 181pub struct ViewerCount<'a> { 182 pub count: i64, 183}