use crate::EpicGames;
use crate::api::error::EpicAPIError;
use crate::api::types::cosmos;
impl EpicGames {
pub async fn cosmos_session_setup(
&self,
exchange_code: &str,
) -> Result<cosmos::CosmosAuthResponse, EpicAPIError> {
self.egs.cosmos_session_setup(exchange_code).await
}
pub async fn cosmos_auth_upgrade(&self) -> Result<cosmos::CosmosAuthResponse, EpicAPIError> {
self.egs.cosmos_auth_upgrade().await
}
pub async fn cosmos_eula_check(&self, eula_id: &str, locale: &str) -> Option<bool> {
self.egs
.cosmos_eula_check(eula_id, locale)
.await
.ok()
.map(|r| r.accepted)
}
pub async fn try_cosmos_eula_check(
&self,
eula_id: &str,
locale: &str,
) -> Result<cosmos::CosmosEulaResponse, EpicAPIError> {
self.egs.cosmos_eula_check(eula_id, locale).await
}
pub async fn cosmos_eula_accept(
&self,
eula_id: &str,
locale: &str,
version: u32,
) -> Option<bool> {
self.egs
.cosmos_eula_accept(eula_id, locale, version)
.await
.ok()
.map(|r| r.accepted)
}
pub async fn try_cosmos_eula_accept(
&self,
eula_id: &str,
locale: &str,
version: u32,
) -> Result<cosmos::CosmosEulaResponse, EpicAPIError> {
self.egs.cosmos_eula_accept(eula_id, locale, version).await
}
pub async fn cosmos_account(&self) -> Option<cosmos::CosmosAccount> {
self.egs.cosmos_account().await.ok()
}
pub async fn try_cosmos_account(&self) -> Result<cosmos::CosmosAccount, EpicAPIError> {
self.egs.cosmos_account().await
}
pub async fn cosmos_policy_aodc(&self) -> Option<cosmos::CosmosPolicyAodc> {
self.egs.cosmos_policy_aodc().await.ok()
}
pub async fn try_cosmos_policy_aodc(&self) -> Result<cosmos::CosmosPolicyAodc, EpicAPIError> {
self.egs.cosmos_policy_aodc().await
}
pub async fn cosmos_comm_opt_in(&self, setting: &str) -> Option<cosmos::CosmosCommOptIn> {
self.egs.cosmos_comm_opt_in(setting).await.ok()
}
pub async fn try_cosmos_comm_opt_in(
&self,
setting: &str,
) -> Result<cosmos::CosmosCommOptIn, EpicAPIError> {
self.egs.cosmos_comm_opt_in(setting).await
}
pub async fn cosmos_search(
&self,
query: &str,
slug: Option<&str>,
locale: Option<&str>,
filter: Option<&str>,
) -> Option<cosmos::CosmosSearchResults> {
self.try_cosmos_search(query, slug, locale, filter)
.await
.ok()
}
pub async fn try_cosmos_search(
&self,
query: &str,
slug: Option<&str>,
locale: Option<&str>,
filter: Option<&str>,
) -> Result<cosmos::CosmosSearchResults, EpicAPIError> {
self.egs.cosmos_search(query, slug, locale, filter).await
}
}