edgequake_sdk/resources/
users.rs1use crate::client::EdgeQuakeClient;
4use crate::error::Result;
5use crate::types::auth::*;
6
7pub struct UsersResource<'a> {
8 pub(crate) client: &'a EdgeQuakeClient,
9}
10
11impl<'a> UsersResource<'a> {
12 pub async fn list(&self) -> Result<Vec<UserInfo>> {
14 self.client.get("/api/v1/users").await
15 }
16
17 pub async fn create(&self, req: &CreateUserRequest) -> Result<UserInfo> {
19 self.client.post("/api/v1/users", Some(req)).await
20 }
21
22 pub async fn get(&self, id: &str) -> Result<UserInfo> {
24 self.client.get(&format!("/api/v1/users/{id}")).await
25 }
26
27 pub async fn delete(&self, id: &str) -> Result<()> {
29 self.client
30 .delete_no_content(&format!("/api/v1/users/{id}"))
31 .await
32 }
33}