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
use crate::{
methods::method::*,
types::{ChatId, Integer, MediaGroupItem, Message},
};
use failure::Error;
use serde::Serialize;
#[derive(Clone, Debug, Serialize)]
pub struct SendMediaGroup {
chat_id: ChatId,
media: Vec<MediaGroupItem>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_to_message_id: Option<Integer>,
}
impl SendMediaGroup {
pub fn new<C: Into<ChatId>>(chat_id: C, media: Vec<MediaGroupItem>) -> Self {
SendMediaGroup {
chat_id: chat_id.into(),
media,
disable_notification: None,
reply_to_message_id: None,
}
}
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
pub fn reply_to_message_id(mut self, reply_to_message_id: Integer) -> Self {
self.reply_to_message_id = Some(reply_to_message_id);
self
}
}
impl Method for SendMediaGroup {
type Response = Vec<Message>;
fn get_request(&self) -> Result<RequestBuilder, Error> {
RequestBuilder::json("sendMediaGroup", &self)
}
}