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
50
51
52
53
use super::*;

/// <https://vk.com/dev/objects/doc>
#[derive(Deserialize, Clone, Debug)]
pub struct Document {
    pub id: Integer,
    pub owner_id: Integer,
    pub title: String,
    pub size: Integer,
    pub ext: String,
    pub url: String,
    pub date: Integer,

    #[serde(rename = "type")]
    pub type_: Integer,

    pub preview: DocumentPreview,

    /// Access key may be present in attachments
    /// (
    /// <https://vk.com/dev/objects/attachments_w>
    /// or
    /// <https://vk.com/dev/objects/attachments_m>
    /// )
    pub access_key: Option<String>,
}

#[derive(Deserialize, Clone, Debug)]
pub struct DocumentPreview {
    pub photo: Option<Photo>,
    pub graffiti: Option<Graffiti>,
    pub audio_msg: Option<AudioMessage>,
}

#[derive(Deserialize, Clone, Debug)]
pub struct Photo {
    pub sizes: Vec<photo::Size>,
}

#[derive(Deserialize, Clone, Debug)]
pub struct Graffiti {
    pub src: String,
    pub width: Integer,
    pub height: Integer,
}

#[derive(Deserialize, Clone, Debug)]
pub struct AudioMessage {
    pub duration: Integer,
    pub waveform: Vec<Integer>,
    pub link_ogg: String,
    pub link_mp3: String,
}