use super::{InlineKeyboardMarkup, InputMessageContent, MessageEntity};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct InlineQueryResultCachedMpeg4Gif {
pub id: String,
pub mpeg4_file_id: String,
pub title: Option<String>,
pub caption: Option<String>,
pub parse_mode: Option<String>,
pub caption_entities: Option<Vec<MessageEntity>>,
pub reply_markup: Option<InlineKeyboardMarkup>,
pub input_message_content: Option<InputMessageContent>,
}
impl InlineQueryResultCachedMpeg4Gif {
#[must_use]
pub fn new(id: impl Into<String>, mpeg4_file_id: impl Into<String>) -> Self {
Self {
id: id.into(),
mpeg4_file_id: mpeg4_file_id.into(),
title: None,
caption: None,
parse_mode: None,
caption_entities: None,
reply_markup: None,
input_message_content: None,
}
}
#[must_use]
pub fn id(self, val: impl Into<String>) -> Self {
Self {
id: val.into(),
..self
}
}
#[must_use]
pub fn mpeg4_file_id(self, val: impl Into<String>) -> Self {
Self {
mpeg4_file_id: val.into(),
..self
}
}
#[must_use]
pub fn title(self, val: impl Into<String>) -> Self {
Self {
title: Some(val.into()),
..self
}
}
#[must_use]
pub fn caption(self, val: impl Into<String>) -> Self {
Self {
caption: Some(val.into()),
..self
}
}
#[must_use]
pub fn parse_mode(self, val: impl Into<String>) -> Self {
Self {
parse_mode: Some(val.into()),
..self
}
}
#[must_use]
pub fn caption_entity(self, val: MessageEntity) -> Self {
Self {
caption_entities: Some(
self.caption_entities
.unwrap_or_default()
.into_iter()
.chain(Some(val))
.collect(),
),
..self
}
}
#[must_use]
pub fn caption_entities(self, val: impl IntoIterator<Item = MessageEntity>) -> Self {
Self {
caption_entities: Some(
self.caption_entities
.unwrap_or_default()
.into_iter()
.chain(val)
.collect(),
),
..self
}
}
#[must_use]
pub fn reply_markup(self, val: impl Into<InlineKeyboardMarkup>) -> Self {
Self {
reply_markup: Some(val.into()),
..self
}
}
#[must_use]
pub fn input_message_content(self, val: impl Into<InputMessageContent>) -> Self {
Self {
input_message_content: Some(val.into()),
..self
}
}
}
impl InlineQueryResultCachedMpeg4Gif {
#[must_use]
pub fn title_option(self, val: Option<impl Into<String>>) -> Self {
Self {
title: val.map(Into::into),
..self
}
}
#[must_use]
pub fn caption_option(self, val: Option<impl Into<String>>) -> Self {
Self {
caption: val.map(Into::into),
..self
}
}
#[must_use]
pub fn parse_mode_option(self, val: Option<impl Into<String>>) -> Self {
Self {
parse_mode: val.map(Into::into),
..self
}
}
#[must_use]
pub fn caption_entities_option(
self,
val: Option<impl IntoIterator<Item = MessageEntity>>,
) -> Self {
Self {
caption_entities: val.map(|val| {
self.caption_entities
.unwrap_or_default()
.into_iter()
.chain(val)
.collect()
}),
..self
}
}
#[must_use]
pub fn reply_markup_option(self, val: Option<impl Into<InlineKeyboardMarkup>>) -> Self {
Self {
reply_markup: val.map(Into::into),
..self
}
}
#[must_use]
pub fn input_message_content_option(self, val: Option<impl Into<InputMessageContent>>) -> Self {
Self {
input_message_content: val.map(Into::into),
..self
}
}
}