doll active state
This commit is contained in:
@@ -22,6 +22,7 @@ pub struct UserBasicDto {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub username: Option<String>,
|
||||
pub active_doll_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
|
||||
@@ -18,6 +18,7 @@ pub struct UserProfile {
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub last_login_at: Option<String>,
|
||||
pub active_doll_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
@@ -79,4 +80,18 @@ impl UserRemote {
|
||||
resp.error_for_status()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn set_active_doll(&self, doll_id: &str) -> Result<(), Error> {
|
||||
let url = format!("{}/users/me/active-doll/{}", self.base_url, doll_id);
|
||||
let resp = with_auth(self.client.put(url)).await.send().await?;
|
||||
resp.error_for_status()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn remove_active_doll(&self) -> Result<(), Error> {
|
||||
let url = format!("{}/users/me/active-doll", self.base_url);
|
||||
let resp = with_auth(self.client.delete(url)).await.send().await?;
|
||||
resp.error_for_status()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user