open_library_api_rs/api/
history.rs1use crate::client::OpenLibraryClient;
3use crate::error::{Error, Result};
4use crate::models::query::HistoryEntry;
5
6impl OpenLibraryClient {
7 pub async fn get_resource_history(&self, key: &str) -> Result<Vec<HistoryEntry>> {
11 if key.is_empty() {
12 return Err(Error::InvalidInput("resource key must not be empty".into()));
13 }
14 let stripped = key.trim_start_matches('/');
16 let mut url = self.base_url.join(&format!("{stripped}.json"))?;
17 url.query_pairs_mut().append_pair("m", "history");
18 self.get_json(url).await
19 }
20}