highlevel-api 0.2.0

Unofficial Rust SDK for the GoHighLevel (HighLevel) API
Documentation
use super::types::*;
use crate::{error::Result, http::HttpClient};
use std::sync::Arc;

pub struct SurveysApi {
    http: Arc<HttpClient>,
}

impl SurveysApi {
    pub fn new(http: Arc<HttpClient>) -> Self {
        Self { http }
    }

    pub async fn list(&self, location_id: &str) -> Result<GetSurveysResponse> {
        #[derive(serde::Serialize)]
        struct Q<'a> {
            #[serde(rename = "locationId")]
            location_id: &'a str,
        }
        self.http
            .get_with_query("/surveys", &Q { location_id })
            .await
    }

    pub async fn get_submissions(
        &self,
        params: &GetSurveySubmissionsParams,
    ) -> Result<GetSurveySubmissionsResponse> {
        self.http
            .get_with_query("/surveys/submissions", params)
            .await
    }
}