1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use crate::models::books::{Author, BookIdentifierKey, Classifications};
use crate::models::identifiers::InternationalStandardBookNumber;
use crate::models::{OpenLibraryModel, Resource};
use chrono::NaiveDate;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Deserialize, Debug, Eq, PartialEq, Serialize)]
pub struct Work {
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub publishers: Vec<String>,
pub number_of_pages: u32,
#[serde(rename = "isbn_10")]
pub isbns_10: Vec<InternationalStandardBookNumber>,
pub covers: Vec<u32>,
pub key: Resource,
pub authors: Vec<Author>,
pub ocaid: String,
pub contributions: Vec<String>,
#[serde(with = "crate::format::keyed_list")]
pub languages: Vec<String>,
pub classifications: Classifications,
pub source_records: Vec<String>,
pub title: String,
#[serde(default)]
pub identifiers: HashMap<BookIdentifierKey, Vec<String>>,
#[serde(rename = "isbn_13")]
pub isbns_13: Vec<InternationalStandardBookNumber>,
pub local_id: Vec<String>,
#[serde(with = "crate::format::date_m_dd_yyyy")]
pub publish_date: NaiveDate,
#[serde(with = "crate::format::keyed_list")]
pub works: Vec<Resource>,
#[serde(rename = "type")]
#[serde(with = "crate::format::keyed_value")]
pub works_type: String,
pub first_sentence: FirstSentence,
pub latest_revision: u32,
}
#[derive(Deserialize, Debug, Eq, PartialEq, Serialize)]
pub struct FirstSentence {
#[serde(rename = "type")]
pub sentence_type: String,
pub value: String,
}
impl OpenLibraryModel for Work {}