A better Rust ATProto crate
at main 4.7 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.stream.segment 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 Audio<'a> { 21 pub channels: i64, 22 #[serde(borrow)] 23 #[builder(into)] 24 pub codec: jacquard_common::CowStr<'a>, 25 pub rate: i64, 26} 27 28#[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 Framerate<'a> { 41 pub den: i64, 42 pub num: i64, 43} 44 45/// Media file representing a segment of a livestream 46#[jacquard_derive::lexicon] 47#[derive( 48 serde::Serialize, 49 serde::Deserialize, 50 Debug, 51 Clone, 52 PartialEq, 53 Eq, 54 jacquard_derive::IntoStatic, 55 bon::Builder 56)] 57#[serde(rename_all = "camelCase")] 58pub struct Segment<'a> { 59 #[serde(skip_serializing_if = "std::option::Option::is_none")] 60 #[builder(into)] 61 #[serde(borrow)] 62 pub audio: Option<Vec<crate::place_stream::segment::Audio<'a>>>, 63 #[serde(borrow)] 64 pub creator: jacquard_common::types::string::Did<'a>, 65 /// The duration of the segment in nanoseconds 66 #[serde(skip_serializing_if = "std::option::Option::is_none")] 67 #[builder(into)] 68 pub duration: Option<i64>, 69 /// Unique identifier for the segment 70 #[serde(borrow)] 71 #[builder(into)] 72 pub id: jacquard_common::CowStr<'a>, 73 /// The DID of the signing key used for this segment 74 #[serde(borrow)] 75 #[builder(into)] 76 pub signing_key: jacquard_common::CowStr<'a>, 77 /// The size of the segment in bytes 78 #[serde(skip_serializing_if = "std::option::Option::is_none")] 79 #[builder(into)] 80 pub size: Option<i64>, 81 /// When this segment started 82 pub start_time: jacquard_common::types::string::Datetime, 83 #[serde(skip_serializing_if = "std::option::Option::is_none")] 84 #[builder(into)] 85 #[serde(borrow)] 86 pub video: Option<Vec<crate::place_stream::segment::Video<'a>>>, 87} 88 89/// Typed wrapper for GetRecord response with this collection's record type. 90#[derive( 91 serde::Serialize, 92 serde::Deserialize, 93 Debug, 94 Clone, 95 PartialEq, 96 Eq, 97 jacquard_derive::IntoStatic 98)] 99#[serde(rename_all = "camelCase")] 100pub struct SegmentGetRecordOutput<'a> { 101 #[serde(skip_serializing_if = "std::option::Option::is_none")] 102 #[serde(borrow)] 103 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 104 #[serde(borrow)] 105 pub uri: jacquard_common::types::string::AtUri<'a>, 106 #[serde(borrow)] 107 pub value: Segment<'a>, 108} 109 110/// Marker type for deserializing records from this collection. 111pub struct SegmentRecord; 112impl jacquard_common::xrpc::XrpcResp for SegmentRecord { 113 const NSID: &'static str = "place.stream.segment"; 114 const ENCODING: &'static str = "application/json"; 115 type Output<'de> = SegmentGetRecordOutput<'de>; 116 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 117} 118 119impl jacquard_common::types::collection::Collection for Segment<'_> { 120 const NSID: &'static str = "place.stream.segment"; 121 type Record = SegmentRecord; 122} 123 124impl From<SegmentGetRecordOutput<'_>> for Segment<'_> { 125 fn from(output: SegmentGetRecordOutput<'_>) -> Self { 126 use jacquard_common::IntoStatic; 127 output.value.into_static() 128 } 129} 130 131#[jacquard_derive::lexicon] 132#[derive( 133 serde::Serialize, 134 serde::Deserialize, 135 Debug, 136 Clone, 137 PartialEq, 138 Eq, 139 jacquard_derive::IntoStatic, 140 bon::Builder 141)] 142#[serde(rename_all = "camelCase")] 143pub struct SegmentView<'a> { 144 #[serde(borrow)] 145 pub cid: jacquard_common::types::string::Cid<'a>, 146 #[serde(borrow)] 147 pub record: jacquard_common::types::value::Data<'a>, 148} 149 150#[jacquard_derive::lexicon] 151#[derive( 152 serde::Serialize, 153 serde::Deserialize, 154 Debug, 155 Clone, 156 PartialEq, 157 Eq, 158 jacquard_derive::IntoStatic, 159 bon::Builder 160)] 161#[serde(rename_all = "camelCase")] 162pub struct Video<'a> { 163 #[serde(skip_serializing_if = "std::option::Option::is_none")] 164 #[builder(into)] 165 pub bframes: Option<bool>, 166 #[serde(borrow)] 167 #[builder(into)] 168 pub codec: jacquard_common::CowStr<'a>, 169 #[serde(skip_serializing_if = "std::option::Option::is_none")] 170 #[builder(into)] 171 #[serde(borrow)] 172 pub framerate: Option<crate::place_stream::segment::Framerate<'a>>, 173 pub height: i64, 174 pub width: i64, 175}