use serde::{Deserialize, Serialize};
use crate::types::{InlineKeyboardMarkup, InputMessageContent, MessageEntity, ParseMode};
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InlineQueryResultCachedAudio {
pub id: String,
pub audio_file_id: String,
pub caption: Option<String>,
pub parse_mode: Option<ParseMode>,
pub caption_entities: Option<Vec<MessageEntity>>,
pub reply_markup: Option<InlineKeyboardMarkup>,
pub input_message_content: Option<InputMessageContent>,
}
impl InlineQueryResultCachedAudio {
pub fn new<S1, S2>(id: S1, audio_file_id: S2) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
id: id.into(),
audio_file_id: audio_file_id.into(),
caption: None,
parse_mode: None,
reply_markup: None,
caption_entities: None,
input_message_content: None,
}
}
pub fn id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.id = val.into();
self
}
pub fn audio_file_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.audio_file_id = val.into();
self
}
pub fn caption<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.caption = Some(val.into());
self
}
#[must_use]
pub fn parse_mode(mut self, val: ParseMode) -> Self {
self.parse_mode = Some(val);
self
}
pub fn caption_entities<C>(mut self, val: C) -> Self
where
C: IntoIterator<Item = MessageEntity>,
{
self.caption_entities = Some(val.into_iter().collect());
self
}
#[must_use]
pub fn reply_markup(mut self, val: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(val);
self
}
#[must_use]
pub fn input_message_content(mut self, val: InputMessageContent) -> Self {
self.input_message_content = Some(val);
self
}
}