use super::types::*;
use crate::{error::Result, http::HttpClient};
use std::sync::Arc;
pub struct FormsApi {
http: Arc<HttpClient>,
}
impl FormsApi {
pub fn new(http: Arc<HttpClient>) -> Self {
Self { http }
}
pub async fn list(&self, location_id: &str) -> Result<GetFormsResponse> {
#[derive(serde::Serialize)]
struct Q<'a> {
#[serde(rename = "locationId")]
location_id: &'a str,
}
self.http.get_with_query("/forms", &Q { location_id }).await
}
pub async fn get_submissions(
&self,
params: &GetSubmissionsParams,
) -> Result<GetSubmissionsResponse> {
self.http.get_with_query("/forms/submissions", params).await
}
}