use serde::{Deserialize, Serialize};
use steamid::SteamID;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TwoFactorResponse {
pub status: i32,
pub shared_secret: Option<String>,
pub identity_secret: Option<String>,
pub secret_1: Option<String>,
pub revocation_code: Option<String>,
pub serial_number: Option<u64>,
pub uri: Option<String>,
pub server_time: Option<u64>,
pub account_name: Option<String>,
pub token_gid: Option<String>,
pub confirm_type: Option<i32>,
pub phone_number_hint: Option<String>,
}
impl TwoFactorResponse {
pub fn setup_instructions(&self) -> String {
let mut s = String::new();
s.push_str("=== Steam Authenticator Setup ===\n");
if let Some(ref secret) = self.shared_secret {
s.push_str(&format!("Shared Secret: {}\n", secret));
}
if let Some(ref secret) = self.identity_secret {
s.push_str(&format!("Identity Secret: {}\n", secret));
}
if let Some(ref code) = self.revocation_code {
s.push_str(&format!("Revocation Code: {}\n", code));
}
if let Some(ref serial) = self.serial_number {
s.push_str(&format!("Serial Number: {}\n", serial));
}
if let Some(ref uri) = self.uri {
s.push_str(&format!("OTP URI: {}\n", uri));
}
s.push_str("==================================\n");
s.push_str("IMPORTANT: Save your Revocation Code! You will need it if you lose access to your authenticator.\n");
s.push_str("To finalize, call `finalize_authenticator(sms_code)` with the code you received via SMS.\n");
s
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserComment {
pub id: String,
pub author: CommentAuthor,
pub timestamp: u64,
pub content: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommentAuthor {
pub steam_id: Option<SteamID>,
pub name: String,
pub avatar: String,
pub avatar_hash: String,
pub profile_url: Option<String>,
pub custom_url: Option<String>,
pub miniprofile: Option<u64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AliasEntry {
pub newname: String,
pub timechanged: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SteamGuardStatus {
Mobile,
Email,
None,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct FriendPageInfo {
#[serde(default)]
pub persona_name: String,
#[serde(default)]
pub profile_url: String,
#[serde(default)]
pub steam_id: SteamID,
#[serde(default)]
pub friends_count: u32,
#[serde(default)]
pub friends_pending_count: u32,
#[serde(default)]
pub blocked_count: u32,
#[serde(default)]
pub following_count: u32,
#[serde(default)]
pub groups_count: u32,
#[serde(default)]
pub groups_pending_count: u32,
#[serde(default)]
pub friends_limit: u32,
#[serde(default)]
pub wallet_balance: Option<super::account::WalletBalance>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct FriendListPage {
pub friends: Vec<FriendDetails>,
pub page_info: Option<FriendPageInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct FriendDetails {
#[serde(alias = "name")]
pub username: String,
#[serde(default)]
pub steam_id: SteamID,
#[serde(default)]
pub game: String,
#[serde(default)]
pub online_status: String,
#[serde(default)]
pub last_online: String,
#[serde(default)]
pub miniprofile: u64,
#[serde(default)]
pub is_nickname: bool,
#[serde(default)]
pub avatar: String,
#[serde(default)]
pub avatar_hash: String,
#[serde(default)]
pub profile_url: String,
#[serde(default)]
pub custom_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommunitySearchPlayer {
pub miniprofile: u64,
pub steam_id: SteamID,
pub avatar_hash: String,
pub name: String,
pub profile_url: String,
pub custom_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommunitySearchResult {
pub players: Vec<CommunitySearchPlayer>,
pub prev_page: Option<u32>,
pub next_page: Option<u32>,
pub search_filter: String,
pub search_page: u32,
pub search_result_count: u32,
pub search_text: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QuickInviteData {
pub success: bool,
pub invite_token: Option<String>,
pub invite_limit: Option<i32>,
pub invite_duration: Option<i32>,
pub time_created: Option<u64>,
pub steam_id: Option<SteamID>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QuickInviteTokensResponse {
pub success: bool,
pub tokens: Vec<QuickInviteToken>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QuickInviteToken {
pub invite_token: String,
pub invite_limit: i32,
pub invite_duration: i32,
pub time_created: u64,
pub steam_id: Option<SteamID>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PendingFriend {
pub name: String,
pub link: String,
pub avatar: String,
pub steam_id: SteamID,
pub account_id: u32,
pub level: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PendingFriendList {
pub sent_invites: Vec<PendingFriend>,
pub received_invites: Vec<PendingFriend>,
}