highlevel_api/apis/users/
client.rs1use super::types::*;
2use crate::{error::Result, http::HttpClient};
3use std::sync::Arc;
4
5pub struct UsersApi {
6 http: Arc<HttpClient>,
7}
8
9impl UsersApi {
10 pub fn new(http: Arc<HttpClient>) -> Self {
11 Self { http }
12 }
13
14 pub async fn me(&self) -> Result<GetUserResponse> {
15 self.http.get("/users/me").await
16 }
17
18 pub async fn get(&self, user_id: &str) -> Result<GetUserResponse> {
19 self.http.get(&format!("/users/{user_id}")).await
20 }
21
22 pub async fn search(&self, params: &SearchUsersParams) -> Result<SearchUsersResponse> {
23 self.http.get_with_query("/users/search", params).await
24 }
25
26 pub async fn create(&self, params: &CreateUserParams) -> Result<GetUserResponse> {
27 self.http.post("/users", params).await
28 }
29
30 pub async fn update(
31 &self,
32 user_id: &str,
33 params: &UpdateUserParams,
34 ) -> Result<GetUserResponse> {
35 self.http.put(&format!("/users/{user_id}"), params).await
36 }
37
38 pub async fn delete(&self, user_id: &str) -> Result<DeleteUserResponse> {
39 self.http.delete(&format!("/users/{user_id}")).await
40 }
41}