highlevel_api/apis/custom_menus/
client.rs1use super::types::*;
2use crate::{error::Result, http::HttpClient};
3use std::sync::Arc;
4
5pub struct CustomMenusApi {
6 http: Arc<HttpClient>,
7}
8
9impl CustomMenusApi {
10 pub fn new(http: Arc<HttpClient>) -> Self {
11 Self { http }
12 }
13
14 pub async fn list(&self, location_id: &str) -> Result<GetCustomMenusResponse> {
15 #[derive(serde::Serialize)]
16 struct Q<'a> {
17 #[serde(rename = "locationId")]
18 location_id: &'a str,
19 }
20 self.http.get_with_query("/menus", &Q { location_id }).await
21 }
22
23 pub async fn get(&self, menu_id: &str) -> Result<GetCustomMenuResponse> {
24 self.http.get(&format!("/menus/{menu_id}")).await
25 }
26
27 pub async fn create(&self, params: &CreateCustomMenuParams) -> Result<GetCustomMenuResponse> {
28 self.http.post("/menus", params).await
29 }
30
31 pub async fn update(
32 &self,
33 menu_id: &str,
34 params: &CreateCustomMenuParams,
35 ) -> Result<GetCustomMenuResponse> {
36 self.http.put(&format!("/menus/{menu_id}"), params).await
37 }
38
39 pub async fn delete(&self, menu_id: &str) -> Result<DeleteCustomMenuResponse> {
40 self.http.delete(&format!("/menus/{menu_id}")).await
41 }
42}