Skip to main content

Crate egs_api

Crate egs_api 

Source
Expand description

§Epic Games Store API

Async Rust client for the Epic Games Store API. Provides authentication, asset management, download manifest parsing (binary + JSON), and Fab marketplace integration.

§Quick Start

use egs_api::EpicGames;

#[tokio::main]
async fn main() {
    let mut egs = EpicGames::new();

    // Authenticate with an authorization code
    let code = "your_authorization_code".to_string();
    if egs.auth_code(None, Some(code)).await {
        println!("Logged in as {}", egs.user_details().display_name.unwrap_or_default());
    }

    // List all owned assets
    let assets = egs.list_assets(None, None).await;
    println!("You own {} assets", assets.len());
}

§Authentication

Epic uses OAuth2 with a public launcher client ID. The flow is:

  1. Open the authorization URL in a browser — the user logs in and gets redirected to a JSON page with an authorizationCode.
  2. Pass that code to EpicGames::auth_code.
  3. Persist the session with EpicGames::user_details (implements Serialize / Deserialize).
  4. Restore it later with EpicGames::set_user_details + EpicGames::login, which uses the refresh token.

§Features

  • Assets — List owned assets, fetch catalog metadata (with DLC trees), retrieve asset manifests with CDN download URLs.
  • Download Manifests — Parse Epic’s binary and JSON manifest formats. Exposes file lists, chunk hashes, and custom fields for download reconstruction.
  • Fab Marketplace — List Fab library items, fetch signed asset manifests, and download manifests from distribution points.
  • Account — Details, bulk ID lookup, friends list.
  • Entitlements — Games, DLC, subscriptions.
  • Library — Paginated listing with optional metadata.
  • Tokens — Game exchange tokens and per-asset ownership tokens (JWT).

§Architecture

EpicGames is the public facade. It wraps an internal EpicAPI struct that holds the reqwest::Client (with cookie store) and session state. Most public methods return Option<T> or Vec<T>, swallowing transport errors for convenience. Fab methods return Result<T, EpicAPIError> to expose timeout/error distinctions.

§Examples

The crate ships with examples covering every endpoint. See the examples/ directory or run:

cargo run --example auth                # Interactive login + token persistence
cargo run --example account             # Account details, ID lookup, friends, external auths, SSO
cargo run --example entitlements        # List all entitlements
cargo run --example library             # Paginated library listing
cargo run --example assets              # Full pipeline: list → info → manifest → download
cargo run --example game_token          # Exchange code + ownership token
cargo run --example fab                 # Fab library → asset manifest → download manifest
cargo run --example catalog             # Catalog items, offers, bulk lookup
cargo run --example commerce            # Currencies, prices, billing, quick purchase
cargo run --example status              # Service status (lightswitch API)
cargo run --example presence            # Update online presence
cargo run --example client_credentials  # App-level auth + library state tokens

Modules§

api
Module for authenticated API communication

Structs§

EpicGames
Client for the Epic Games Store API.