use super::types::*;
use crate::{error::Result, http::HttpClient};
use std::sync::Arc;
pub struct SnapshotsApi {
http: Arc<HttpClient>,
}
impl SnapshotsApi {
pub fn new(http: Arc<HttpClient>) -> Self {
Self { http }
}
pub async fn list(&self, company_id: &str) -> Result<GetSnapshotsResponse> {
#[derive(serde::Serialize)]
struct Q<'a> {
#[serde(rename = "companyId")]
company_id: &'a str,
}
self.http
.get_with_query("/snapshots", &Q { company_id })
.await
}
pub async fn create_share_link(
&self,
params: &SnapshotShareLinkParams,
) -> Result<SnapshotShareLinkResponse> {
self.http.post("/snapshots/share/link", params).await
}
}