Skip to main content

open_library_api_rs/models/
query.rs

1// v0.0.1
2use serde::{Deserialize, Serialize};
3
4/// Response from the generic `GET /query.json` endpoint.
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct QueryResponse {
7    #[serde(default)]
8    pub result: Vec<serde_json::Value>,
9}
10
11/// A single resource-history entry (from `?m=history`).
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct HistoryEntry {
14    #[serde(default)]
15    pub key: Option<String>,
16    #[serde(default)]
17    pub revision: Option<i64>,
18    #[serde(default)]
19    pub timestamp: Option<String>,
20    #[serde(default)]
21    pub kind: Option<String>,
22    #[serde(default)]
23    pub author: Option<serde_json::Value>,
24    #[serde(default)]
25    pub comment: Option<String>,
26    #[serde(default)]
27    pub ip: Option<String>,
28    #[serde(default)]
29    pub machine_comment: Option<String>,
30}
31
32/// Response from the `/api/books` bibkey lookup.
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct BooksApiEntry {
35    #[serde(default)]
36    pub bib_key: Option<String>,
37    #[serde(default)]
38    pub info_url: Option<String>,
39    #[serde(default)]
40    pub preview: Option<String>,
41    #[serde(default)]
42    pub preview_url: Option<String>,
43    #[serde(default)]
44    pub thumbnail_url: Option<String>,
45    #[serde(default)]
46    pub details: Option<serde_json::Value>,
47    #[serde(default)]
48    pub data: Option<serde_json::Value>,
49}