use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct VolumeResponse {
pub kind: String,
#[serde(rename(deserialize = "totalItems"))]
pub total_items: i32,
pub items: Option<Vec<Book>>,
}
#[derive(Deserialize, Debug)]
pub struct Book {
pub id: String,
pub etag: String,
pub kind: Option<String>,
#[serde(rename(deserialize = "selfLink"))]
pub self_link: Option<String>,
#[serde(rename(deserialize = "volumeInfo"))]
pub volume_info: VolumeInfo,
}
#[derive(Deserialize, Debug)]
pub struct VolumeInfo {
pub title: String,
pub subtitle: Option<String>,
pub authors: Option<Vec<String>>,
pub publisher: Option<String>,
#[serde(rename(deserialize = "publishedDate"))]
pub published_date: Option<String>,
pub description: Option<String>,
#[serde(rename(deserialize = "industryIdentifiers"))]
pub industry_identifiers: Option<Vec<IndustryIdentifiers>>,
#[serde(rename(deserialize = "pageCount"))]
pub page_count: Option<u16>,
#[serde(
rename(deserialize = "printType"),
default = "VolumeInfo::default_print_type"
)]
pub print_type: String,
pub categories: Option<Vec<String>>,
#[serde(rename(deserialize = "imageLinks"))]
pub image_links: Option<ImageLink>,
}
impl VolumeInfo {
pub fn default_print_type() -> String {
"".to_string()
}
}
#[derive(Deserialize, Debug)]
pub struct ImageLink {
#[serde(rename(deserialize = "smallThumbnail"))]
pub small_thumbnail: Option<String>,
pub thumbnail: Option<String>,
}
#[derive(Deserialize, Debug)]
pub struct IndustryIdentifiers {
pub identifier: String,
#[serde(rename(deserialize = "type"))]
pub identifier_type: String,
}
#[derive(Debug, Deserialize)]
pub struct GoogleApiError {
pub error: GoogleApiErrorDetail,
}
#[derive(Debug, Deserialize)]
pub struct GoogleApiErrorDetail {
pub code: u16,
pub message: String,
pub status: Option<String>,
pub errors: Option<Vec<GoogleApiErrorItem>>,
}
#[derive(Debug, Deserialize)]
pub struct GoogleApiErrorItem {
pub message: String,
pub domain: String,
pub reason: String,
}