Skip to main content

highlevel_api/apis/snapshots/
client.rs

1use super::types::*;
2use crate::{error::Result, http::HttpClient};
3use std::sync::Arc;
4
5pub struct SnapshotsApi {
6    http: Arc<HttpClient>,
7}
8
9impl SnapshotsApi {
10    pub fn new(http: Arc<HttpClient>) -> Self {
11        Self { http }
12    }
13
14    pub async fn list(&self, company_id: &str) -> Result<GetSnapshotsResponse> {
15        #[derive(serde::Serialize)]
16        struct Q<'a> {
17            #[serde(rename = "companyId")]
18            company_id: &'a str,
19        }
20        self.http
21            .get_with_query("/snapshots", &Q { company_id })
22            .await
23    }
24
25    pub async fn create_share_link(
26        &self,
27        params: &SnapshotShareLinkParams,
28    ) -> Result<SnapshotShareLinkResponse> {
29        self.http.post("/snapshots/share/link", params).await
30    }
31}