egs_api/api/
cloud_save.rs1use crate::api::error::EpicAPIError;
2use crate::api::types::cloud_save::CloudSaveResponse;
3use crate::api::EpicAPI;
4
5impl EpicAPI {
6 #[allow(dead_code)]
7 pub async fn cloud_save_list(
12 &self,
13 app_name: Option<&str>,
14 manifests: bool,
15 ) -> Result<CloudSaveResponse, EpicAPIError> {
16 let user_id = self
17 .user_data
18 .account_id
19 .as_deref()
20 .ok_or(EpicAPIError::InvalidCredentials)?;
21 let app_path = match app_name {
22 Some(name) if manifests => format!("{}/manifests/", name),
23 Some(name) => format!("{}/", name),
24 None => String::new(),
25 };
26 let url = format!(
27 "https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/access/egstore/savesync/{}/{}",
28 user_id, app_path
29 );
30 self.authorized_get_json(&url).await
31 }
32
33 #[allow(dead_code)]
34 pub async fn cloud_save_query(
38 &self,
39 app_name: &str,
40 filenames: &[String],
41 ) -> Result<CloudSaveResponse, EpicAPIError> {
42 let user_id = self
43 .user_data
44 .account_id
45 .as_deref()
46 .ok_or(EpicAPIError::InvalidCredentials)?;
47 let url = format!(
48 "https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/access/egstore/savesync/{}/{}/",
49 user_id, app_name
50 );
51 let body = serde_json::json!({ "files": filenames });
52 self.authorized_post_json(&url, &body).await
53 }
54
55 #[allow(dead_code)]
56 pub async fn cloud_save_delete(&self, path: &str) -> Result<(), EpicAPIError> {
58 let url = format!(
59 "https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/data/egstore/{}",
60 path
61 );
62 self.authorized_delete(&url).await
63 }
64}