tbot/methods/
edit_inline_reply_markup.rs1use super::call_method;
2use crate::{
3 connectors::Client,
4 errors, token,
5 types::{inline_message_id, keyboard::inline},
6};
7use serde::Serialize;
8
9#[derive(Serialize, Debug, Clone)]
15#[must_use = "methods do nothing unless turned into a future"]
16pub struct EditInlineReplyMarkup<'a> {
17 #[serde(skip)]
18 client: &'a Client,
19 #[serde(skip)]
20 token: token::Ref<'a>,
21 inline_message_id: inline_message_id::Ref<'a>,
22 reply_markup: inline::Keyboard<'a>,
23}
24
25impl<'a> EditInlineReplyMarkup<'a> {
26 pub(crate) const fn new(
27 client: &'a Client,
28 token: token::Ref<'a>,
29 inline_message_id: inline_message_id::Ref<'a>,
30 reply_markup: inline::Keyboard<'a>,
31 ) -> Self {
32 Self {
33 client,
34 token,
35 inline_message_id,
36 reply_markup,
37 }
38 }
39}
40
41impl EditInlineReplyMarkup<'_> {
42 pub async fn call(self) -> Result<(), errors::MethodCall> {
44 call_method::<bool>(
45 self.client,
46 self.token,
47 "editMessageReplyMarkup",
48 None,
49 serde_json::to_vec(&self).unwrap(),
50 )
51 .await?;
52
53 Ok(())
54 }
55}