Skip to main content

game_manager_lib/commands/
subscriptions.rs

1//! Comamdos para obter catálogo de jogos de serviços assinados.
2
3use crate::database::AppState;
4use crate::scrapers::amazon_luna::LunaGame;
5use crate::scrapers::ea_play::EAPlayGame;
6use crate::scrapers::game_pass::GamePassGame;
7use crate::scrapers::ubisoft_plus::UbisoftGame;
8use crate::services::subscriptions;
9use tauri::State;
10
11#[tauri::command]
12pub async fn get_amazon_luna_catalog(
13    state: State<'_, AppState>,
14    lang: String,
15) -> Result<Vec<LunaGame>, String> {
16    subscriptions::get_amazon_luna_games(&state, &lang).await
17}
18
19#[tauri::command]
20pub async fn get_game_pass_catalog(
21    state: State<'_, AppState>,
22    exclude_ea_play: bool,
23    lang: String,
24) -> Result<Vec<GamePassGame>, String> {
25    subscriptions::get_game_pass_games(&state, exclude_ea_play, &lang).await
26}
27
28#[tauri::command]
29pub async fn get_ea_play_catalog(
30    state: State<'_, AppState>,
31    lang: String,
32) -> Result<Vec<EAPlayGame>, String> {
33    subscriptions::get_ea_play_games(&state, &lang).await
34}
35
36#[tauri::command]
37pub async fn get_ubisoft_plus_catalog(
38    state: State<'_, AppState>,
39) -> Result<Vec<UbisoftGame>, String> {
40    subscriptions::get_ubisoft_plus_games(&state).await
41}
42
43#[tauri::command]
44pub fn get_subscription_settings(state: State<'_, AppState>) -> Result<Vec<String>, String> {
45    subscriptions::get_enabled_services(&state)
46}
47
48#[tauri::command]
49pub fn save_subscription_settings(
50    state: State<'_, AppState>,
51    services: Vec<String>,
52) -> Result<(), String> {
53    subscriptions::set_enabled_services(&state, services)
54}