use crate::{
cdk::types::Principal,
dto::{
authority_restore::{AuthorityRestoreFenceStatusResponse, AuthoritySnapshotRequest},
error::Error,
},
workflow::runtime::authority_restore::AuthorityRestoreWorkflow,
};
pub struct AuthorityRestoreApi;
impl AuthorityRestoreApi {
#[doc(hidden)]
pub fn initialize(authority_canister: Principal) -> Result<(), Error> {
AuthorityRestoreWorkflow::initialize(authority_canister).map_err(Into::into)
}
pub fn status() -> Result<AuthorityRestoreFenceStatusResponse, Error> {
AuthorityRestoreWorkflow::status().map_err(Into::into)
}
pub async fn prepare_snapshot(
request: AuthoritySnapshotRequest,
) -> Result<AuthorityRestoreFenceStatusResponse, Error> {
AuthorityRestoreWorkflow::prepare_snapshot(request)
.await
.map_err(Into::into)
}
pub async fn resume_snapshot(
request: AuthoritySnapshotRequest,
) -> Result<AuthorityRestoreFenceStatusResponse, Error> {
AuthorityRestoreWorkflow::resume_snapshot(request)
.await
.map_err(Into::into)
}
}