farcaster_rs/assets/
get_collection_owners.rs1use crate::constants::merkle::API_ROOT;
2use crate::types::assets::collection_owners::CollectionOwnersRoot;
3use crate::Farcaster;
4use std::error::Error;
5
6impl Farcaster {
7 pub async fn get_collection_owners(
8 &self,
9 collection_id: &str,
10 limit: Option<i64>,
11 cursor: Option<String>,
12 ) -> Result<CollectionOwnersRoot, Box<dyn Error>> {
13 let mut url = format!(
14 "{}/v2/collection-owners?collectionid={}",
15 API_ROOT, collection_id
16 );
17
18 if limit.is_some() {
19 url.push_str(format!("&limit={}", limit.unwrap()).as_str())
20 }
21
22 if cursor.is_some() {
23 url.push_str(format!("&cursor={}", cursor.unwrap()).as_str())
24 }
25
26 let collection_reqwest = &self.reqwest_get(&url).await?;
27
28 let collections: CollectionOwnersRoot = serde_json::from_str(&collection_reqwest)?;
29
30 Ok(collections)
31 }
32}