farcaster_rs/reactions/
delete_recast.rs1use crate::constants::merkle::API_ROOT;
2use crate::types::reactions::deleted_recast::DeletedRecastRoot;
3use crate::Farcaster;
4use serde_json::{json, Value};
5use std::error::Error;
6
7impl Farcaster {
8 pub async fn delete_recast_by_cast_hash(
18 &self,
19 cast_hash: &str,
20 ) -> Result<DeletedRecastRoot, Box<dyn Error>> {
21 let payload: Value = json!({ "castHash": cast_hash });
22
23 let delete_recast_reqwest = reqwest::Client::new()
24 .delete(format!("{}/v2/recasts", API_ROOT))
25 .header("Content-Type", "application/json")
26 .header(
27 "Authorization",
28 &self.account.session_token.as_ref().unwrap().secret,
29 )
30 .json(&payload)
31 .send()
32 .await?
33 .text()
34 .await?;
35
36 let deleted_recast: DeletedRecastRoot = serde_json::from_str(&delete_recast_reqwest)?;
37
38 Ok(deleted_recast)
39 }
40}