Skip to main content

EpicGames

Struct EpicGames 

Source
pub struct EpicGames { /* private fields */ }
Expand description

Client for the Epic Games Store API.

This is the main entry point for the library. Create an instance with EpicGames::new, authenticate with EpicGames::auth_code or EpicGames::login, then call API methods.

Most methods return Option<T> or Vec<T>, returning None / empty on errors. Fab methods return Result<T, EpicAPIError> for richer error handling (e.g., distinguishing timeouts from other failures).

Session state is stored in UserData, which implements Serialize / Deserialize for persistence across runs.

Implementations§

Source§

impl EpicGames

Source

pub fn new() -> Self

Creates a new EpicGames client.

Source

pub fn is_logged_in(&self) -> bool

Check whether the user is logged in.

Returns true if the access token exists and has more than 600 seconds remaining before expiry.

Source

pub fn user_details(&self) -> UserData

Returns a clone of the current session state.

The returned UserData implements Serialize / Deserialize, so you can persist it to disk and restore it later with set_user_details.

Source

pub fn set_user_details(&mut self, user_details: UserData)

Restore session state from a previously saved UserData.

Only merges Some fields — existing values are preserved for any field that is None in the input. Call login afterward to refresh the access token.

Source

pub async fn try_auth_code( &mut self, exchange_token: Option<String>, authorization_code: Option<String>, ) -> Result<bool, EpicAPIError>

Like auth_code, but returns a Result instead of swallowing errors.

Source

pub async fn auth_code( &mut self, exchange_token: Option<String>, authorization_code: Option<String>, ) -> bool

Authenticate with an authorization code or exchange token.

Returns true on success, false on failure. Returns None on API errors.

Source

pub async fn logout(&mut self) -> bool

Invalidate the current session and log out.

Source

pub async fn try_login(&mut self) -> Result<bool, EpicAPIError>

Like login, but returns a Result instead of swallowing errors.

Source

pub async fn login(&mut self) -> bool

Resume session using the saved refresh token.

Returns true on success, false if the refresh token has expired or is invalid. Unlike try_login, this method falls through to refresh-token login if session resume fails.

Source

pub async fn try_list_assets( &mut self, platform: Option<String>, label: Option<String>, ) -> Result<Vec<EpicAsset>, EpicAPIError>

Like list_assets, but returns a Result instead of swallowing errors.

Source

pub async fn list_assets( &mut self, platform: Option<String>, label: Option<String>, ) -> Vec<EpicAsset>

List all owned assets.

Defaults to platform=“Windows” and label=“Live” if not specified. Returns empty Vec on API errors.

Source

pub async fn try_asset_manifest( &mut self, platform: Option<String>, label: Option<String>, namespace: Option<String>, item_id: Option<String>, app: Option<String>, ) -> Result<AssetManifest, EpicAPIError>

Like asset_manifest, but returns a Result instead of swallowing errors.

Source

pub async fn asset_manifest( &mut self, platform: Option<String>, label: Option<String>, namespace: Option<String>, item_id: Option<String>, app: Option<String>, ) -> Option<AssetManifest>

Fetch asset manifest with CDN download URLs.

Defaults to platform=“Windows” and label=“Live” if not specified. Returns None on API errors.

Source

pub async fn fab_asset_manifest( &self, artifact_id: &str, namespace: &str, asset_id: &str, platform: Option<&str>, ) -> Result<Vec<DownloadInfo>, EpicAPIError>

Fetch Fab asset manifest with signed distribution points.

Returns Result to expose timeout errors (403 → EpicAPIError::FabTimeout).

Source

pub async fn try_asset_info( &mut self, asset: &EpicAsset, ) -> Result<Option<AssetInfo>, EpicAPIError>

Like asset_info, but returns a Result instead of swallowing errors.

Source

pub async fn asset_info(&mut self, asset: &EpicAsset) -> Option<AssetInfo>

Fetch catalog metadata for an asset (includes DLC tree).

Returns None on API errors.

Source

pub async fn try_account_details(&mut self) -> Result<AccountData, EpicAPIError>

Like account_details, but returns a Result instead of swallowing errors.

Source

pub async fn account_details(&mut self) -> Option<AccountData>

Fetch account details (email, display name, country, 2FA status).

Returns None on API errors.

Source

pub async fn try_account_ids_details( &mut self, ids: Vec<String>, ) -> Result<Vec<AccountInfo>, EpicAPIError>

Like account_ids_details, but returns a Result instead of swallowing errors.

Source

pub async fn account_ids_details( &mut self, ids: Vec<String>, ) -> Option<Vec<AccountInfo>>

Bulk lookup of account IDs to display names.

Returns None on API errors.

Source

pub async fn try_account_friends( &mut self, include_pending: bool, ) -> Result<Vec<Friend>, EpicAPIError>

Like account_friends, but returns a Result instead of swallowing errors.

Source

pub async fn account_friends( &mut self, include_pending: bool, ) -> Option<Vec<Friend>>

Fetch friends list (including pending requests if include_pending is true).

Returns None on API errors.

Source

pub async fn try_game_token(&mut self) -> Result<GameToken, EpicAPIError>

Like game_token, but returns a Result instead of swallowing errors.

Source

pub async fn game_token(&mut self) -> Option<GameToken>

Fetch a short-lived exchange code for game launches.

Returns None on API errors.

Source

pub async fn try_ownership_token( &mut self, asset: &EpicAsset, ) -> Result<String, EpicAPIError>

Like ownership_token, but returns a Result instead of swallowing errors.

Source

pub async fn ownership_token(&mut self, asset: &EpicAsset) -> Option<String>

Fetch a JWT proving ownership of an asset.

Returns None on API errors.

Source

pub async fn try_user_entitlements( &mut self, ) -> Result<Vec<Entitlement>, EpicAPIError>

Like user_entitlements, but returns a Result instead of swallowing errors.

Source

pub async fn user_entitlements(&mut self) -> Vec<Entitlement>

Fetch all user entitlements (games, DLC, subscriptions).

Returns empty Vec on API errors.

Source

pub async fn try_library_items( &mut self, include_metadata: bool, ) -> Result<Library, EpicAPIError>

Like library_items, but returns a Result instead of swallowing errors.

Source

pub async fn library_items(&mut self, include_metadata: bool) -> Option<Library>

Fetch the user library with optional metadata.

Paginates internally and returns all records at once. Returns None on API errors.

Source

pub async fn try_fab_library_items( &mut self, account_id: String, ) -> Result<FabLibrary, EpicAPIError>

Like fab_library_items, but returns a Result instead of swallowing errors.

Source

pub async fn fab_library_items( &mut self, account_id: String, ) -> Option<FabLibrary>

Fetch the user Fab library.

Paginates internally and returns all records at once. Returns None on API errors.

Source

pub async fn asset_download_manifests( &self, manifest: AssetManifest, ) -> Vec<DownloadManifest>

Parse download manifests from all CDN mirrors.

Fetches from all mirrors, parses binary/JSON format, and populates custom fields (BaseUrl, CatalogItemId, etc.). Returns empty Vec on API errors.

Source

pub async fn fab_download_manifest( &self, download_info: DownloadInfo, distribution_point_url: &str, ) -> Result<DownloadManifest, EpicAPIError>

Parse a Fab download manifest from a specific distribution point.

Checks signature expiration before fetching. Returns Result to expose timeout errors.

Source

pub async fn try_auth_client_credentials( &mut self, ) -> Result<bool, EpicAPIError>

Like auth_client_credentials, but returns a Result instead of swallowing errors.

Source

pub async fn auth_client_credentials(&mut self) -> bool

Authenticate with client credentials (app-level, no user context).

Uses the launcher’s public client ID/secret to obtain an access token without any user interaction. The resulting session has limited permissions — it can query public endpoints (catalog, service status, currencies) but cannot access user-specific data (library, entitlements).

Returns true on success, false on failure.

Source

pub async fn try_external_auths( &self, account_id: &str, ) -> Result<Vec<ExternalAuth>, EpicAPIError>

Like external_auths, but returns a Result instead of swallowing errors.

Source

pub async fn external_auths( &self, account_id: &str, ) -> Option<Vec<ExternalAuth>>

Fetch external auth connections linked to an account.

Returns linked platform accounts (Steam, PSN, Xbox, Nintendo, etc.) with external display names and account IDs. Requires a valid user session.

Returns None on API errors.

Source

pub async fn try_sso_domains(&self) -> Result<Vec<String>, EpicAPIError>

Like sso_domains, but returns a Result instead of swallowing errors.

Source

pub async fn sso_domains(&self) -> Option<Vec<String>>

Fetch the list of SSO (Single Sign-On) domains.

Returns domain strings that support Epic’s SSO flow. Used by the launcher to determine which domains can share authentication cookies.

Returns None on API errors.

Source

pub async fn try_catalog_items( &self, namespace: &str, start: i64, count: i64, ) -> Result<CatalogItemPage, EpicAPIError>

Like catalog_items, but returns a Result instead of swallowing errors.

Source

pub async fn catalog_items( &self, namespace: &str, start: i64, count: i64, ) -> Option<CatalogItemPage>

Fetch paginated catalog items for a namespace.

Queries the Epic catalog service for items within a given namespace (e.g., a game’s namespace). Results are paginated — use start and count to page through. Each CatalogItemPage includes a paging field with the total count.

Returns None on API errors.

Source

pub async fn try_catalog_offers( &self, namespace: &str, start: i64, count: i64, ) -> Result<CatalogOfferPage, EpicAPIError>

Like catalog_offers, but returns a Result instead of swallowing errors.

Source

pub async fn catalog_offers( &self, namespace: &str, start: i64, count: i64, ) -> Option<CatalogOfferPage>

Fetch paginated catalog offers for a namespace.

Queries the Epic catalog service for offers (purchasable items) within a namespace. Offers include pricing metadata, seller info, and linked catalog items. Use start and count to paginate.

Returns None on API errors.

Source

pub async fn try_bulk_catalog_items( &self, items: &[(&str, &str)], ) -> Result<HashMap<String, HashMap<String, AssetInfo>>, EpicAPIError>

Like bulk_catalog_items, but returns a Result instead of swallowing errors.

Source

pub async fn bulk_catalog_items( &self, items: &[(&str, &str)], ) -> Option<HashMap<String, HashMap<String, AssetInfo>>>

Bulk fetch catalog items across multiple namespaces.

Accepts a slice of (namespace, item_id) pairs and returns them grouped by namespace → item_id → AssetInfo. Useful for resolving catalog metadata for items from different games in a single request.

Returns None on API errors.

Source

pub async fn try_currencies( &self, start: i64, count: i64, ) -> Result<CurrencyPage, EpicAPIError>

Like currencies, but returns a Result instead of swallowing errors.

Source

pub async fn currencies(&self, start: i64, count: i64) -> Option<CurrencyPage>

Fetch available currencies from the Epic catalog.

Returns paginated currency definitions including code, symbol, and decimal precision. Use start and count to paginate.

Returns None on API errors.

Source

pub async fn try_library_state_token_status( &self, token_id: &str, ) -> Result<bool, EpicAPIError>

Like library_state_token_status, but returns a Result instead of swallowing errors.

Source

pub async fn library_state_token_status(&self, token_id: &str) -> Option<bool>

Check the validity of a library state token.

Returns Some(true) if the token is still valid, Some(false) if expired or invalid, or None on API errors. Library state tokens are used to detect changes to the user’s library since the last sync.

Returns None on API errors.

Source

pub async fn try_service_status( &self, service_id: &str, ) -> Result<Vec<ServiceStatus>, EpicAPIError>

Like service_status, but returns a Result instead of swallowing errors.

Source

pub async fn service_status( &self, service_id: &str, ) -> Option<Vec<ServiceStatus>>

Fetch service status from Epic’s lightswitch API.

Returns the operational status of an Epic online service (e.g., a game’s backend). The response includes whether the service is UP/DOWN, any maintenance message, and whether the current user is banned.

Returns None on API errors.

Source

pub async fn try_offer_prices( &self, namespace: &str, offer_ids: &[String], country: &str, ) -> Result<PriceResponse, EpicAPIError>

Like offer_prices, but returns a Result instead of swallowing errors.

Source

pub async fn offer_prices( &self, namespace: &str, offer_ids: &[String], country: &str, ) -> Option<PriceResponse>

Fetch offer prices from Epic’s price engine.

Queries current pricing for one or more offers within a namespace, localized to a specific country. The response includes original price, discount price, and pre-formatted display strings.

Returns None on API errors.

Source

pub async fn try_quick_purchase( &self, namespace: &str, offer_id: &str, ) -> Result<QuickPurchaseResponse, EpicAPIError>

Like quick_purchase, but returns a Result instead of swallowing errors.

Source

pub async fn quick_purchase( &self, namespace: &str, offer_id: &str, ) -> Option<QuickPurchaseResponse>

Execute a quick purchase (typically for free game claims).

Initiates a purchase order for a free offer. The response contains the order ID and its processing status. For paid offers, use the full checkout flow in the Epic Games launcher instead.

Returns None on API errors.

Source

pub async fn try_billing_account(&self) -> Result<BillingAccount, EpicAPIError>

Like billing_account, but returns a Result instead of swallowing errors.

Source

pub async fn billing_account(&self) -> Option<BillingAccount>

Fetch the default billing account for payment processing.

Returns the account’s billing country, which is used to determine regional pricing and payment availability.

Returns None on API errors.

Source

pub async fn update_presence( &self, session_id: &str, body: &PresenceUpdate, ) -> Result<(), EpicAPIError>

Update the user’s presence status.

Sends a PATCH request to update the user’s online presence (e.g., “online”, “away”) and optionally set an activity with custom properties. The session_id is the OAuth session token from login. Returns Ok(()) on success (204 No Content) or an EpicAPIError on failure.

Source

pub async fn try_fab_file_download_info( &self, listing_id: &str, format_id: &str, file_id: &str, ) -> Result<DownloadInfo, EpicAPIError>

Like fab_file_download_info, but returns a Result instead of swallowing errors.

Source

pub async fn fab_file_download_info( &self, listing_id: &str, format_id: &str, file_id: &str, ) -> Option<DownloadInfo>

Fetch download info for a specific file within a Fab listing.

Returns signed DownloadInfo for a single file identified by listing_id, format_id, and file_id. Use this for targeted downloads of individual files from a Fab asset rather than fetching the entire asset manifest.

Returns None on API errors.

Source

pub async fn cloud_save_list( &self, app_name: Option<&str>, manifests: bool, ) -> Result<CloudSaveResponse, EpicAPIError>

List cloud save files for the logged-in user.

If app_name is provided, lists saves for that specific game. If manifests is true (only relevant when app_name is set), lists manifest files.

Source

pub async fn cloud_save_query( &self, app_name: &str, filenames: &[String], ) -> Result<CloudSaveResponse, EpicAPIError>

Query cloud save files by specific filenames.

Returns metadata including read/write links for the specified files.

Source

pub async fn cloud_save_delete(&self, path: &str) -> Result<(), EpicAPIError>

Delete a cloud save file by its storage path.

Source

pub async fn artifact_service_ticket( &self, sandbox_id: &str, artifact_id: &str, label: Option<&str>, platform: Option<&str>, ) -> Result<ArtifactServiceTicket, EpicAPIError>

Fetch an artifact service ticket for manifest retrieval via EOS Helper.

The sandbox_id is typically the game’s namespace and artifact_id is the app name. Returns a signed ticket for use with game_manifest_by_ticket.

Source

pub async fn game_manifest_by_ticket( &self, artifact_id: &str, signed_ticket: &str, label: Option<&str>, platform: Option<&str>, ) -> Result<AssetManifest, EpicAPIError>

Fetch a game manifest using a signed artifact service ticket.

Alternative to asset_manifest using ticket-based auth from the EOS Helper service.

Source

pub async fn launcher_manifests( &self, platform: Option<&str>, label: Option<&str>, ) -> Result<AssetManifest, EpicAPIError>

Fetch launcher manifests for self-update checks.

Source

pub async fn delta_manifest( &self, base_url: &str, old_build_id: &str, new_build_id: &str, ) -> Option<Vec<u8>>

Try to fetch a delta manifest for optimized patching between builds.

Returns None if no delta is available or the builds are identical.

Source

pub async fn auth_sid(&mut self, sid: &str) -> Result<bool, EpicAPIError>

Authenticate via session ID (SID) from the Epic web login flow.

Performs the multi-step web exchange: set-sid → CSRF → exchange code, then starts a session with the resulting code. Returns true on success.

Source

pub async fn store_get_uplay_codes( &self, ) -> Result<UplayGraphQLResponse<UplayCodesResult>, EpicAPIError>

Fetch Uplay codes linked to the user’s Epic account.

Source

pub async fn store_claim_uplay_code( &self, uplay_account_id: &str, game_id: &str, ) -> Result<UplayGraphQLResponse<UplayClaimResult>, EpicAPIError>

Claim a Uplay code for a specific game.

Source

pub async fn store_redeem_uplay_codes( &self, uplay_account_id: &str, ) -> Result<UplayGraphQLResponse<UplayRedeemResult>, EpicAPIError>

Redeem all pending Uplay codes for the user’s account.

Trait Implementations§

Source§

impl Clone for EpicGames

Source§

fn clone(&self) -> EpicGames

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EpicGames

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EpicGames

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more