steam-user 0.1.0

Steam User web client for Rust - HTTP-based Steam Community interactions
Documentation
//! Types for Friend Activity Feed operations.

use serde::{Deserialize, Serialize};
use steamid::SteamID;

/// Type of activity in the friend activity feed.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
#[derive(Default)]
pub enum ActivityType {
    /// Two users became friends.
    NewFriend,
    /// User played a game for the first time.
    PlayedFirstTime,
    /// User earned an achievement.
    Achieved,
    /// User added a game to their wishlist.
    AddedToWishlist,
    /// User started following another user.
    Following,
    /// User joined a group.
    Joined,
    /// User purchased/received a game.
    GamePurchase,
    /// User published a workshop item.
    WorkshopItemPublished,
    /// User posted a recommendation/review.
    Recommendation,
    /// User posted a status update.
    UserStatus,
    /// User shared a screenshot.
    Screenshot,
    /// User published a video.
    VideoPublished,
    /// Daily activity rollup (aggregated activities).
    #[default]
    DailyRollup,
    /// Unknown activity type.
    Unknown(String),
}

/// A player reference in an activity.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityPlayer {
    /// Player's display name.
    pub name: String,
    /// Player's nickname (friend nickname set by you).
    pub nickname: Option<String>,
    /// Player's miniprofile ID.
    pub miniprofile: u64,
    /// Player's SteamID.
    pub steam_id: SteamID,
}

/// An app/game reference in an activity.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityApp {
    /// App ID.
    pub id: u32,
    /// App name.
    pub name: String,
    /// Link to the app's store/community page.
    pub link: String,
}

/// An achievement earned in an activity.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityAchievement {
    /// Achievement title/name.
    pub title: String,
    /// Achievement icon URL.
    pub img: String,
}

/// A group reference in an activity.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityGroup {
    /// Group name.
    pub name: String,
    /// Full link to the group.
    pub link: String,
    /// Group URL slug (e.g., "mygroup" from steamcommunity.com/groups/mygroup).
    pub url: String,
}

/// A comment on an activity item.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityComment {
    /// Comment ID.
    pub id: String,
    /// Author's SteamID.
    pub author_steam_id: SteamID,
    /// Author's miniprofile ID.
    pub author_miniprofile: u64,
    /// Author's avatar hash.
    pub author_avatar_hash: String,
    /// Comment timestamp (Unix seconds).
    pub timestamp: u64,
}

/// Author of an activity (for game purchases, etc.).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityAuthor {
    /// Author's display name.
    pub name: String,
    /// Author's nickname (friend nickname set by you).
    pub nickname: Option<String>,
    /// Author's avatar hash.
    pub avatar_hash: String,
    /// Author's miniprofile ID.
    pub miniprofile: u64,
    /// Author's SteamID.
    pub steam_id: SteamID,
    /// Author's profile URL.
    pub profile_url: String,
    /// Author's custom URL (if set).
    pub custom_url: Option<String>,
}

/// A single activity item from the friend activity feed.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct FriendActivity {
    /// Type of activity.
    pub activity_type: ActivityType,
    /// Timestamp of the activity (Unix seconds).
    pub timestamp: u64,
    /// Human-readable date header (e.g., "January 10").
    pub header_date: String,
    /// Players involved in this activity (for daily rollups).
    pub players: Vec<ActivityPlayer>,
    /// Apps/games involved in this activity.
    pub apps: Vec<ActivityApp>,
    /// Groups involved in this activity.
    pub groups: Vec<ActivityGroup>,
    /// Achievements earned (if applicable).
    pub achieved: Vec<ActivityAchievement>,
    /// Author of the activity (for game purchases).
    pub author: Option<ActivityAuthor>,
    /// Thread ID for commenting on this activity.
    pub thread_id: Option<u64>,
    /// Comments on this activity.
    pub comments: Vec<ActivityComment>,
}

/// Response from getting the friend activity feed.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct FriendActivityResponse {
    /// List of activities.
    pub activities: Vec<FriendActivity>,
    /// Next request timestamp for pagination.
    pub next_request_timestart: Option<u64>,
    /// Next request URL for pagination.
    pub next_request_url: Option<String>,
}

/// Response from commenting/rating an activity.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ActivityCommentResponse {
    /// Whether the operation was successful.
    pub success: bool,
    /// Total number of comments.
    pub total_count: u32,
    /// Number of upvotes on the activity.
    pub upvotes: u32,
    /// Whether the current user has upvoted.
    pub has_upvoted: bool,
}