A better Rust ATProto crate
at main 7.0 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: net.anisota.beta.game.progress 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Record representing a player's level progression and game statistics 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 Progress<'a> { 22 /// URI of the card that was advanced when triggerSource is card_advance 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[builder(into)] 25 #[serde(borrow)] 26 pub card_uri: Option<jacquard_common::CowStr<'a>>, 27 /// When the progress record was created 28 pub created_at: jacquard_common::types::string::Datetime, 29 /// Current stamina level when this progress was recorded (decimal string, e.g. '85.5') 30 #[serde(skip_serializing_if = "std::option::Option::is_none")] 31 #[builder(into)] 32 #[serde(borrow)] 33 pub current_stamina: Option<jacquard_common::CowStr<'a>>, 34 /// Current player level 35 pub level: i64, 36 #[serde(skip_serializing_if = "std::option::Option::is_none")] 37 #[builder(into)] 38 #[serde(borrow)] 39 pub metadata: Option<crate::net_anisota::beta::game::progress::Metadata<'a>>, 40 /// Previous level before this update (for tracking level progression) 41 #[serde(skip_serializing_if = "std::option::Option::is_none")] 42 #[builder(into)] 43 pub previous_level: Option<i64>, 44 /// Progress percentage to the next level (decimal string, e.g. '75.5') 45 #[serde(borrow)] 46 #[builder(into)] 47 pub progress_percentage: jacquard_common::CowStr<'a>, 48 /// URIs of related game log records that contributed to this progress 49 #[serde(skip_serializing_if = "std::option::Option::is_none")] 50 #[builder(into)] 51 #[serde(borrow)] 52 pub related_log_uris: Option<Vec<jacquard_common::CowStr<'a>>>, 53 /// Session ID when this progress was recorded (for linking with log records) 54 #[serde(skip_serializing_if = "std::option::Option::is_none")] 55 #[builder(into)] 56 #[serde(borrow)] 57 pub session_id: Option<jacquard_common::CowStr<'a>>, 58 /// URI of the session record when this progress was recorded 59 #[serde(skip_serializing_if = "std::option::Option::is_none")] 60 #[builder(into)] 61 #[serde(borrow)] 62 pub session_uri: Option<jacquard_common::CowStr<'a>>, 63 #[serde(skip_serializing_if = "std::option::Option::is_none")] 64 #[builder(into)] 65 #[serde(borrow)] 66 pub stats: Option<crate::net_anisota::beta::game::progress::Stats<'a>>, 67 /// Total experience points accumulated 68 pub total_xp: i64, 69 /// What action triggered this progress save 70 #[serde(skip_serializing_if = "std::option::Option::is_none")] 71 #[builder(into)] 72 #[serde(borrow)] 73 pub trigger_source: Option<jacquard_common::CowStr<'a>>, 74 /// Experience points gained since the last progress save 75 #[serde(skip_serializing_if = "std::option::Option::is_none")] 76 #[builder(into)] 77 pub xp_gained_since_last_save: Option<i64>, 78 /// Experience points needed to reach the next level 79 pub xp_to_next_level: i64, 80} 81 82/// Typed wrapper for GetRecord response with this collection's record type. 83#[derive( 84 serde::Serialize, 85 serde::Deserialize, 86 Debug, 87 Clone, 88 PartialEq, 89 Eq, 90 jacquard_derive::IntoStatic 91)] 92#[serde(rename_all = "camelCase")] 93pub struct ProgressGetRecordOutput<'a> { 94 #[serde(skip_serializing_if = "std::option::Option::is_none")] 95 #[serde(borrow)] 96 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 97 #[serde(borrow)] 98 pub uri: jacquard_common::types::string::AtUri<'a>, 99 #[serde(borrow)] 100 pub value: Progress<'a>, 101} 102 103/// Marker type for deserializing records from this collection. 104pub struct ProgressRecord; 105impl jacquard_common::xrpc::XrpcResp for ProgressRecord { 106 const NSID: &'static str = "net.anisota.beta.game.progress"; 107 const ENCODING: &'static str = "application/json"; 108 type Output<'de> = ProgressGetRecordOutput<'de>; 109 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 110} 111 112impl jacquard_common::types::collection::Collection for Progress<'_> { 113 const NSID: &'static str = "net.anisota.beta.game.progress"; 114 type Record = ProgressRecord; 115} 116 117impl From<ProgressGetRecordOutput<'_>> for Progress<'_> { 118 fn from(output: ProgressGetRecordOutput<'_>) -> Self { 119 use jacquard_common::IntoStatic; 120 output.value.into_static() 121 } 122} 123 124/// Additional metadata about this progress update 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 Default 135)] 136#[serde(rename_all = "camelCase")] 137pub struct Metadata<'a> { 138 /// Version of the client when this progress was recorded 139 #[serde(skip_serializing_if = "std::option::Option::is_none")] 140 #[serde(borrow)] 141 pub client_version: std::option::Option<jacquard_common::CowStr<'a>>, 142 /// Platform where the level up occurred (web, mobile, etc.) 143 #[serde(skip_serializing_if = "std::option::Option::is_none")] 144 #[serde(borrow)] 145 pub platform: std::option::Option<jacquard_common::CowStr<'a>>, 146} 147 148/// Game-specific statistics and metrics 149#[jacquard_derive::lexicon] 150#[derive( 151 serde::Serialize, 152 serde::Deserialize, 153 Debug, 154 Clone, 155 PartialEq, 156 Eq, 157 jacquard_derive::IntoStatic, 158 Default 159)] 160#[serde(rename_all = "camelCase")] 161pub struct Stats<'a> { 162 /// Total daily rewards claimed 163 #[serde(skip_serializing_if = "std::option::Option::is_none")] 164 pub daily_rewards_claimed: std::option::Option<i64>, 165 /// Total items collected 166 #[serde(skip_serializing_if = "std::option::Option::is_none")] 167 pub items_collected: std::option::Option<i64>, 168 /// Date when posts read today was last updated (for daily reset tracking) 169 #[serde(skip_serializing_if = "std::option::Option::is_none")] 170 pub last_post_read_date: std::option::Option< 171 jacquard_common::types::string::Datetime, 172 >, 173 /// Posts read today (resets daily) 174 #[serde(skip_serializing_if = "std::option::Option::is_none")] 175 pub posts_read_today: std::option::Option<i64>, 176 /// Total posts read (all time, cumulative) 177 #[serde(skip_serializing_if = "std::option::Option::is_none")] 178 pub posts_read_total: std::option::Option<i64>, 179 /// Total posts viewed 180 #[serde(skip_serializing_if = "std::option::Option::is_none")] 181 pub posts_viewed: std::option::Option<i64>, 182 /// Total shuffles performed 183 #[serde(skip_serializing_if = "std::option::Option::is_none")] 184 pub shuffles_performed: std::option::Option<i64>, 185 /// Total specimens collected 186 #[serde(skip_serializing_if = "std::option::Option::is_none")] 187 pub specimens_collected: std::option::Option<i64>, 188}