rvk_objects/
photo.rs

1use super::*;
2
3/// <https://vk.com/dev/objects/photo>
4#[derive(Deserialize, Clone, Debug)]
5pub struct Photo {
6    pub id: Integer,
7    pub album_id: Option<Integer>,
8    pub owner_id: Option<Integer>,
9    pub user_id: Option<Integer>,
10    pub text: Option<String>,
11    pub date: Option<Integer>,
12    pub sizes: Option<Vec<Size>>,
13    pub width: Option<Integer>,
14    pub height: Option<Integer>,
15
16    // for attachment::WallAttachment
17    pub post_id: Option<Integer>,
18
19    /// Access key may be present in attachments
20    /// (
21    /// <https://vk.com/dev/objects/attachments_w>
22    /// or
23    /// <https://vk.com/dev/objects/attachments_m>
24    /// )
25    pub access_key: Option<String>,
26}
27
28/// <https://vk.com/dev/photo_sizes>
29#[derive(Deserialize, Clone, Debug)]
30pub struct Size {
31    pub url: String,
32    pub width: Option<Integer>,
33    pub height: Option<Integer>,
34
35    #[serde(rename = "type")]
36    pub type_: String,
37}
38
39#[derive(Deserialize, Clone, Debug)]
40pub struct Cropped {
41    pub photo: Photo,
42    pub crop: Rect,
43    pub rect: Rect,
44}
45
46#[derive(Deserialize, Copy, Clone, Debug)]
47pub struct Rect {
48    pub x: Number,
49    pub y: Number,
50    pub x2: Number,
51    pub y2: Number,
52}
53
54/// <https://vk.com/dev/objects/attachments_w>
55#[derive(Deserialize, Clone, Debug)]
56pub struct Album {
57    pub id: Integer,
58    pub thumb: photo::Photo,
59    pub owner_id: Integer,
60    pub title: String,
61    pub description: String,
62    pub created: Integer,
63    pub updated: Integer,
64    pub size: Integer,
65}
66
67/// <https://vk.com/dev/objects/attachments_w>
68/// or
69/// <https://vk.com/dev/objects/sticker>
70#[derive(Deserialize, Clone, Debug)]
71pub struct Image {
72    pub url: String,
73    pub width: Integer,
74    pub height: Integer,
75}