From 3ff36ad972ab22a97c3e30b37446b10b954c94ab Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sat, 25 Jan 2025 17:41:32 -0500 Subject: [PATCH] Add json objects for other auth endpoints --- src/cardlife/live_json.rs | 42 +++++++++++++++++++++++++++++++++++---- src/cardlife/mod.rs | 2 +- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/cardlife/live_json.rs b/src/cardlife/live_json.rs index a5fa5a6..52d2269 100644 --- a/src/cardlife/live_json.rs +++ b/src/cardlife/live_json.rs @@ -8,6 +8,40 @@ pub struct AuthenticationPayload { pub password: String, } +#[derive(Deserialize, Serialize, Clone)] +pub struct SteamAuthenticationPayload { + #[serde(rename = "SteamTicket")] + pub steam_ticket: String, + #[serde(rename = "Demo")] + pub demo: bool, +} + +#[derive(Deserialize, Serialize, Clone)] +pub struct TokenPayload { + #[serde(rename = "PublicID")] // [sic] compared to AuthenticationInfo's PublidId + pub public_id: String, + #[serde(rename = "Token")] + pub token: String, +} + +#[derive(Deserialize, Serialize, Clone)] +pub struct TempGetUserIdPayload { + #[serde(rename = "publicId")] // [sic] yay consistency + pub public_id: String, + #[serde(rename = "token")] + pub token: String, +} + +#[derive(Deserialize, Serialize, Clone)] +pub struct TempGetUserIdResponse { + #[serde(rename = "publicId")] // [sic] yay consistency + pub public_id: String, + #[serde(rename = "token")] + pub token: String, + #[serde(rename = "userId")] + pub user_id: i32, +} + /// Authentication information #[derive(Deserialize, Serialize, Clone)] pub struct AuthenticationInfo { @@ -22,10 +56,10 @@ pub struct AuthenticationInfo { pub display_name: String, /// Account purchases (???) #[serde(rename = "Purchases")] - purchases: Vec, // ??? + pub purchases: Vec, // ??? /// Account flags (dev, admin, etc.???) #[serde(rename = "Flags")] - flags: Vec, // ??? + pub flags: Vec, // ??? /// Is confirmed account? #[serde(rename = "Confirmed")] pub confirmed: bool, @@ -36,10 +70,10 @@ pub struct AuthenticationInfo { /// /// Since Steam users cannot be authenticated using this lib, this will always be blank or None #[serde(rename = "SteamId")] - steam_id: Option, // ??? + pub steam_id: Option, // ??? /// User ID #[serde(rename = "ID")] - pub id: usize, + pub id: i32, } impl std::string::ToString for AuthenticationInfo { diff --git a/src/cardlife/mod.rs b/src/cardlife/mod.rs index 46e0fde..861f69f 100644 --- a/src/cardlife/mod.rs +++ b/src/cardlife/mod.rs @@ -14,4 +14,4 @@ mod live; mod live_json; pub use self::live::{LiveAPI, AUTHENTICATION_DOMAIN, LOBBY_DOMAIN}; pub use self::live_json::{AuthenticationInfo, LobbyInfo, LiveGameInfo}; -pub use self::live_json::{AuthenticationPayload, LobbyPayload}; +pub use self::live_json::{AuthenticationPayload, LobbyPayload, SteamAuthenticationPayload, TokenPayload, TempGetUserIdPayload, TempGetUserIdResponse};