diff --git a/src/data.rs b/src/data.rs index cfbe602..c935d4d 100644 --- a/src/data.rs +++ b/src/data.rs @@ -65,12 +65,8 @@ pub async fn get_auth_id(token: &str) -> Result> { async fn get_shout_followers(shout_id: &str) -> Result, Box> { let api_base = env::var("API_BASE")?; - let query = r#"query ShoutFollowers($shout: Int!) { - shoutFollowers(shout: $shout) { - follower { - id - } - } + let query = r#"query GetShoutFollowers($slug: String, shout_id: Int) { + get_shout_followers(slug: $slug, shout_id: $shout_id) { id } } "#; let shout_id = shout_id.parse::()?; @@ -79,7 +75,7 @@ async fn get_shout_followers(shout_id: &str) -> Result, Box> }); let body = json!({ "query": query, - "operationName": "ShoutFollowers", + "operationName": "GetShoutFollowers", "variables": variables }); @@ -88,11 +84,11 @@ async fn get_shout_followers(shout_id: &str) -> Result, Box> if response.status().is_success() { let response_body: serde_json::Value = response.json().await?; - let ids: Vec = response_body["data"]["shoutFollowers"] + let ids: Vec = response_body["data"]["get_shout_followers"] .as_array() .ok_or("Failed to parse follower array")? .iter() - .filter_map(|f| f["follower"]["id"].as_i64().map(|id| id as i32)) + .filter_map(|f| f["id"].as_i64().map(|id| id as i32)) .collect(); Ok(ids)