use crate::api::EpicAPI;
use crate::api::error::EpicAPIError;
use crate::api::types::cloud_save::CloudSaveResponse;
impl EpicAPI {
#[allow(dead_code)]
pub async fn cloud_save_list(
&self,
app_name: Option<&str>,
manifests: bool,
) -> Result<CloudSaveResponse, EpicAPIError> {
let user_id = self
.user_data
.account_id
.as_deref()
.ok_or(EpicAPIError::InvalidCredentials)?;
let app_path = match app_name {
Some(name) if manifests => format!("{}/manifests/", name),
Some(name) => format!("{}/", name),
None => String::new(),
};
let url = format!(
"https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/access/egstore/savesync/{}/{}",
user_id, app_path
);
self.authorized_get_json(&url).await
}
#[allow(dead_code)]
pub async fn cloud_save_query(
&self,
app_name: &str,
filenames: &[String],
) -> Result<CloudSaveResponse, EpicAPIError> {
let user_id = self
.user_data
.account_id
.as_deref()
.ok_or(EpicAPIError::InvalidCredentials)?;
let url = format!(
"https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/access/egstore/savesync/{}/{}/",
user_id, app_name
);
let body = serde_json::json!({ "files": filenames });
self.authorized_post_json(&url, &body).await
}
#[allow(dead_code)]
pub async fn cloud_save_delete(&self, path: &str) -> Result<(), EpicAPIError> {
let url = format!(
"https://datastorage-public-service-liveegs.live.use1a.on.epicgames.com/api/v1/data/egstore/{}",
path
);
self.authorized_delete(&url).await
}
}