use crate::client::OpenLibraryClient;
use crate::error::{Error, Result};
use crate::models::query::HistoryEntry;
impl OpenLibraryClient {
pub async fn get_resource_history(&self, key: &str) -> Result<Vec<HistoryEntry>> {
if key.is_empty() {
return Err(Error::InvalidInput("resource key must not be empty".into()));
}
let stripped = key.trim_start_matches('/');
let mut url = self.base_url.join(&format!("{stripped}.json"))?;
url.query_pairs_mut().append_pair("m", "history");
self.get_json(url).await
}
}