Skip to main content

highlevel_api/apis/forms/
client.rs

1use super::types::*;
2use crate::{error::Result, http::HttpClient};
3use std::sync::Arc;
4
5pub struct FormsApi {
6    http: Arc<HttpClient>,
7}
8
9impl FormsApi {
10    pub fn new(http: Arc<HttpClient>) -> Self {
11        Self { http }
12    }
13
14    pub async fn list(&self, location_id: &str) -> Result<GetFormsResponse> {
15        #[derive(serde::Serialize)]
16        struct Q<'a> {
17            #[serde(rename = "locationId")]
18            location_id: &'a str,
19        }
20        self.http.get_with_query("/forms", &Q { location_id }).await
21    }
22
23    pub async fn get_submissions(
24        &self,
25        params: &GetSubmissionsParams,
26    ) -> Result<GetSubmissionsResponse> {
27        self.http.get_with_query("/forms/submissions", params).await
28    }
29}