add: app data rename method
This commit is contained in:
parent
35b66c94d0
commit
6f2d556c65
10 changed files with 100 additions and 12 deletions
|
@ -129,6 +129,25 @@ impl DataClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// Update a record's key given its ID and the new key.
|
||||
pub async fn rename(&self, id: usize, key: String) -> Result<()> {
|
||||
match self
|
||||
.http
|
||||
.post(format!("{}/api/v1/app_data/{id}/key", self.host))
|
||||
.header("Atto-Secret-Key", &self.api_key)
|
||||
.json(&serde_json::Value::Object({
|
||||
let mut map = serde_json::Map::new();
|
||||
map.insert("key".to_string(), serde_json::Value::String(key));
|
||||
map
|
||||
}))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
Ok(x) => api_return_ok!((), x),
|
||||
Err(e) => Err(Error::MiscError(e.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Delete a row from the app's data by its `id`.
|
||||
pub async fn remove(&self, id: usize) -> Result<()> {
|
||||
match self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue