A better Rust ATProto crate
at main 4.5 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: net.anisota.beta.game.pack 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Beta version: Record tracking daily pack openings and streak information 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 Pack<'a> { 22 /// When the record was created 23 pub created_at: jacquard_common::types::string::Datetime, 24 /// When the record was last modified 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[builder(into)] 27 pub last_modified: Option<jacquard_common::types::string::Datetime>, 28 /// When daily pack was last opened 29 pub last_open_time: jacquard_common::types::string::Datetime, 30 /// Longest daily pack opening streak achieved 31 #[serde(skip_serializing_if = "std::option::Option::is_none")] 32 #[builder(into)] 33 pub longest_streak: Option<i64>, 34 /// History of the last few pack openings 35 #[serde(skip_serializing_if = "std::option::Option::is_none")] 36 #[builder(into)] 37 #[serde(borrow)] 38 pub pack_history: Option< 39 Vec<crate::net_anisota::beta::game::pack::PackHistoryEntry<'a>>, 40 >, 41 /// Current daily pack opening streak count 42 pub streak: i64, 43 /// Total number of times daily packs have been opened 44 pub total_opens: i64, 45} 46 47/// Typed wrapper for GetRecord response with this collection's record type. 48#[derive( 49 serde::Serialize, 50 serde::Deserialize, 51 Debug, 52 Clone, 53 PartialEq, 54 Eq, 55 jacquard_derive::IntoStatic 56)] 57#[serde(rename_all = "camelCase")] 58pub struct PackGetRecordOutput<'a> { 59 #[serde(skip_serializing_if = "std::option::Option::is_none")] 60 #[serde(borrow)] 61 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 62 #[serde(borrow)] 63 pub uri: jacquard_common::types::string::AtUri<'a>, 64 #[serde(borrow)] 65 pub value: Pack<'a>, 66} 67 68/// Marker type for deserializing records from this collection. 69pub struct PackRecord; 70impl jacquard_common::xrpc::XrpcResp for PackRecord { 71 const NSID: &'static str = "net.anisota.beta.game.pack"; 72 const ENCODING: &'static str = "application/json"; 73 type Output<'de> = PackGetRecordOutput<'de>; 74 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 75} 76 77impl jacquard_common::types::collection::Collection for Pack<'_> { 78 const NSID: &'static str = "net.anisota.beta.game.pack"; 79 type Record = PackRecord; 80} 81 82impl From<PackGetRecordOutput<'_>> for Pack<'_> { 83 fn from(output: PackGetRecordOutput<'_>) -> Self { 84 use jacquard_common::IntoStatic; 85 output.value.into_static() 86 } 87} 88 89/// A single pack opening entry in the history 90#[jacquard_derive::lexicon] 91#[derive( 92 serde::Serialize, 93 serde::Deserialize, 94 Debug, 95 Clone, 96 PartialEq, 97 Eq, 98 jacquard_derive::IntoStatic, 99 Default 100)] 101#[serde(rename_all = "camelCase")] 102pub struct PackHistoryEntry<'a> { 103 /// Items received from this pack 104 #[serde(skip_serializing_if = "std::option::Option::is_none")] 105 #[serde(borrow)] 106 pub items_received: std::option::Option< 107 Vec<crate::net_anisota::beta::game::pack::ReceivedItem<'a>>, 108 >, 109 /// When this pack was opened 110 #[serde(skip_serializing_if = "std::option::Option::is_none")] 111 pub open_time: std::option::Option<jacquard_common::types::string::Datetime>, 112 /// Streak count at time of opening 113 #[serde(skip_serializing_if = "std::option::Option::is_none")] 114 pub streak_count: std::option::Option<i64>, 115} 116 117/// An item received from a pack opening 118#[jacquard_derive::lexicon] 119#[derive( 120 serde::Serialize, 121 serde::Deserialize, 122 Debug, 123 Clone, 124 PartialEq, 125 Eq, 126 jacquard_derive::IntoStatic, 127 Default 128)] 129#[serde(rename_all = "camelCase")] 130pub struct ReceivedItem<'a> { 131 /// ID of the item received 132 #[serde(skip_serializing_if = "std::option::Option::is_none")] 133 #[serde(borrow)] 134 pub item_id: std::option::Option<jacquard_common::CowStr<'a>>, 135 /// Quantity received 136 #[serde(skip_serializing_if = "std::option::Option::is_none")] 137 pub quantity: std::option::Option<i64>, 138 /// Rarity of the item 139 #[serde(skip_serializing_if = "std::option::Option::is_none")] 140 #[serde(borrow)] 141 pub rarity: std::option::Option<jacquard_common::CowStr<'a>>, 142}