farcaster_rs/reactions/
get_recasters.rs1use crate::constants::merkle::API_ROOT;
2use crate::types::reactions::recasters::RecastersRoot;
3use crate::Farcaster;
4use std::error::Error;
5
6impl Farcaster {
7 pub async fn get_recasters_by_cast_hash(
19 &self,
20 cast_hash: &str,
21 limit: Option<i32>,
22 cursor: Option<&str>,
23 ) -> Result<RecastersRoot, Box<dyn Error>> {
24 let mut url = format!("{}/v2/cast-recasters?castHash={}", API_ROOT, cast_hash);
25
26 if limit.is_some() {
27 url.push_str(format!("&limit={}", limit.unwrap()).as_str())
28 }
29
30 if cursor.is_some() {
31 url.push_str(format!("&cursor={}", cursor.unwrap()).as_str())
32 }
33
34 let recasters_reqwest = reqwest::Client::new()
35 .delete(url)
36 .header("Content-Type", "application/json ")
37 .header(
38 "Authorization",
39 &self.account.session_token.as_ref().unwrap().secret,
40 )
41 .send()
42 .await?
43 .text()
44 .await?;
45
46 let recasters: RecastersRoot = serde_json::from_str(&recasters_reqwest)?;
47
48 Ok(recasters)
49 }
50}