1use crate::EpicGames;
2use crate::api::error::EpicAPIError;
3use crate::api::types::cosmos;
4
5impl EpicGames {
6 pub async fn cosmos_session_setup(
9 &self,
10 exchange_code: &str,
11 ) -> Result<cosmos::CosmosAuthResponse, EpicAPIError> {
12 self.egs.cosmos_session_setup(exchange_code).await
13 }
14
15 pub async fn cosmos_auth_upgrade(&self) -> Result<cosmos::CosmosAuthResponse, EpicAPIError> {
17 self.egs.cosmos_auth_upgrade().await
18 }
19
20 pub async fn cosmos_eula_check(&self, eula_id: &str, locale: &str) -> Option<bool> {
22 self.egs
23 .cosmos_eula_check(eula_id, locale)
24 .await
25 .ok()
26 .map(|r| r.accepted)
27 }
28
29 pub async fn try_cosmos_eula_check(
31 &self,
32 eula_id: &str,
33 locale: &str,
34 ) -> Result<cosmos::CosmosEulaResponse, EpicAPIError> {
35 self.egs.cosmos_eula_check(eula_id, locale).await
36 }
37
38 pub async fn cosmos_eula_accept(
40 &self,
41 eula_id: &str,
42 locale: &str,
43 version: u32,
44 ) -> Option<bool> {
45 self.egs
46 .cosmos_eula_accept(eula_id, locale, version)
47 .await
48 .ok()
49 .map(|r| r.accepted)
50 }
51
52 pub async fn try_cosmos_eula_accept(
54 &self,
55 eula_id: &str,
56 locale: &str,
57 version: u32,
58 ) -> Result<cosmos::CosmosEulaResponse, EpicAPIError> {
59 self.egs.cosmos_eula_accept(eula_id, locale, version).await
60 }
61
62 pub async fn cosmos_account(&self) -> Option<cosmos::CosmosAccount> {
64 self.egs.cosmos_account().await.ok()
65 }
66
67 pub async fn try_cosmos_account(&self) -> Result<cosmos::CosmosAccount, EpicAPIError> {
69 self.egs.cosmos_account().await
70 }
71
72 pub async fn cosmos_policy_aodc(&self) -> Option<cosmos::CosmosPolicyAodc> {
74 self.egs.cosmos_policy_aodc().await.ok()
75 }
76
77 pub async fn try_cosmos_policy_aodc(&self) -> Result<cosmos::CosmosPolicyAodc, EpicAPIError> {
79 self.egs.cosmos_policy_aodc().await
80 }
81
82 pub async fn cosmos_comm_opt_in(&self, setting: &str) -> Option<cosmos::CosmosCommOptIn> {
84 self.egs.cosmos_comm_opt_in(setting).await.ok()
85 }
86
87 pub async fn try_cosmos_comm_opt_in(
89 &self,
90 setting: &str,
91 ) -> Result<cosmos::CosmosCommOptIn, EpicAPIError> {
92 self.egs.cosmos_comm_opt_in(setting).await
93 }
94
95 pub async fn cosmos_search(
99 &self,
100 query: &str,
101 slug: Option<&str>,
102 locale: Option<&str>,
103 filter: Option<&str>,
104 ) -> Option<cosmos::CosmosSearchResults> {
105 self.try_cosmos_search(query, slug, locale, filter)
106 .await
107 .ok()
108 }
109
110 pub async fn try_cosmos_search(
112 &self,
113 query: &str,
114 slug: Option<&str>,
115 locale: Option<&str>,
116 filter: Option<&str>,
117 ) -> Result<cosmos::CosmosSearchResults, EpicAPIError> {
118 self.egs.cosmos_search(query, slug, locale, filter).await
119 }
120}