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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
use serde::{Deserialize, Serialize};
use super::files::photo_size::PhotoSize;
use super::files::video::Video;
use super::user::User;
// ---------------------------------------------------------------------------
// PaidMediaPreview
// ---------------------------------------------------------------------------
/// Paid media that is not yet available before payment.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PaidMediaPreview {
/// Media width as defined by the sender.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
/// Media height as defined by the sender.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// Duration of the media in seconds as defined by the sender.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
}
// ---------------------------------------------------------------------------
// PaidMediaPhoto
// ---------------------------------------------------------------------------
/// The paid media is a photo.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PaidMediaPhoto {
/// The photo.
pub photo: Vec<PhotoSize>,
}
// ---------------------------------------------------------------------------
// PaidMediaVideo
// ---------------------------------------------------------------------------
/// The paid media is a video.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PaidMediaVideo {
/// The video.
pub video: Video,
}
// ---------------------------------------------------------------------------
// PaidMedia — polymorphic, tagged on "type"
// ---------------------------------------------------------------------------
/// Paid media added to a message.
///
/// Discriminated by the `"type"` JSON field.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
#[non_exhaustive]
pub enum PaidMedia {
/// Media not yet available before payment.
Preview(PaidMediaPreview),
/// A photo.
Photo(PaidMediaPhoto),
/// A video.
Video(Box<PaidMediaVideo>),
}
// ---------------------------------------------------------------------------
// PaidMediaInfo
// ---------------------------------------------------------------------------
/// Paid media added to a message, together with the required Star count.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PaidMediaInfo {
/// Number of Telegram Stars that must be paid to buy access to the media.
pub star_count: i64,
/// Information about the paid media.
pub paid_media: Vec<PaidMedia>,
}
// ---------------------------------------------------------------------------
// PaidMediaPurchased
// ---------------------------------------------------------------------------
/// Information about a paid media purchase.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PaidMediaPurchased {
/// User who purchased the media.
///
/// JSON field name is `"from"` (reserved word in Rust).
#[serde(rename = "from")]
pub from_user: User,
/// Bot-specified paid media payload.
pub paid_media_payload: String,
}