use serde::Serialize;
use crate::{
api::{Form, Method, Payload, PayloadError, WriteForm},
types::{
ChatId,
EditMessageResult,
Float,
InlineKeyboardMarkup,
InputMedia,
InputMediaData,
InputRichMessage,
InputRichMessageData,
InputText,
InputTextCaption,
Integer,
LinkPreviewOptions,
Message,
MessageId,
ReplyMarkup,
ReplyParameters,
SuggestedPostParameters,
},
};
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct CopyMessage {
chat_id: ChatId,
from_chat_id: ChatId,
message_id: Integer,
allow_paid_broadcast: Option<bool>,
#[serde(flatten)]
caption: Option<InputTextCaption>,
direct_messages_topic_id: Option<Integer>,
disable_notification: Option<bool>,
message_effect_id: Option<String>,
message_thread_id: Option<Integer>,
protect_content: Option<bool>,
reply_markup: Option<ReplyMarkup>,
reply_parameters: Option<ReplyParameters>,
show_caption_above_media: Option<bool>,
suggested_post_parameters: Option<SuggestedPostParameters>,
video_start_timestamp: Option<Integer>,
}
impl CopyMessage {
pub fn new<A, B>(chat_id: A, from_chat_id: B, message_id: Integer) -> Self
where
A: Into<ChatId>,
B: Into<ChatId>,
{
Self {
chat_id: chat_id.into(),
from_chat_id: from_chat_id.into(),
message_id,
allow_paid_broadcast: None,
caption: None,
direct_messages_topic_id: None,
disable_notification: None,
message_effect_id: None,
message_thread_id: None,
protect_content: None,
reply_markup: None,
reply_parameters: None,
show_caption_above_media: None,
suggested_post_parameters: None,
video_start_timestamp: None,
}
}
pub fn with_allow_paid_broadcast(mut self, value: bool) -> Self {
self.allow_paid_broadcast = Some(value);
self
}
pub fn with_caption<T>(mut self, value: T) -> Self
where
T: Into<InputTextCaption>,
{
self.caption = Some(value.into());
self
}
pub fn with_direct_messages_topic_id(mut self, value: Integer) -> Self {
self.direct_messages_topic_id = Some(value);
self
}
pub fn with_disable_notification(mut self, value: bool) -> Self {
self.disable_notification = Some(value);
self
}
pub fn with_message_effect_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.message_effect_id = Some(value.into());
self
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn with_protect_content(mut self, value: bool) -> Self {
self.protect_content = Some(value);
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<ReplyMarkup>,
{
self.reply_markup = Some(value.into());
self
}
pub fn with_reply_parameters(mut self, value: ReplyParameters) -> Self {
self.reply_parameters = Some(value);
self
}
pub fn with_show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn with_suggested_post_parameters(mut self, value: SuggestedPostParameters) -> Self {
self.suggested_post_parameters = Some(value);
self
}
pub fn with_video_start_timestamp(mut self, value: Integer) -> Self {
self.video_start_timestamp = Some(value);
self
}
}
impl Method for CopyMessage {
type Response = MessageId;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("copyMessage", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct CopyMessages {
chat_id: ChatId,
from_chat_id: ChatId,
message_ids: Vec<Integer>,
direct_messages_topic_id: Option<Integer>,
disable_notification: Option<bool>,
message_thread_id: Option<Integer>,
protect_content: Option<bool>,
remove_caption: Option<bool>,
}
impl CopyMessages {
pub fn new<A, B, C>(chat_id: A, from_chat_id: B, message_ids: C) -> Self
where
A: Into<ChatId>,
B: Into<ChatId>,
C: IntoIterator<Item = Integer>,
{
Self {
chat_id: chat_id.into(),
from_chat_id: from_chat_id.into(),
message_ids: message_ids.into_iter().collect(),
direct_messages_topic_id: None,
disable_notification: None,
message_thread_id: None,
protect_content: None,
remove_caption: None,
}
}
pub fn with_direct_messages_topic_id(mut self, value: Integer) -> Self {
self.direct_messages_topic_id = Some(value);
self
}
pub fn with_disable_notification(mut self, value: bool) -> Self {
self.disable_notification = Some(value);
self
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn with_protect_content(mut self, value: bool) -> Self {
self.protect_content = Some(value);
self
}
pub fn with_remove_caption(mut self, value: bool) -> Self {
self.remove_caption = Some(value);
self
}
}
impl Method for CopyMessages {
type Response = Vec<MessageId>;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("copyMessages", self)
}
}
#[derive(Clone, Debug, Serialize)]
pub struct DeleteMessage {
chat_id: ChatId,
message_id: Integer,
}
impl DeleteMessage {
pub fn new<T>(chat_id: T, message_id: Integer) -> Self
where
T: Into<ChatId>,
{
Self {
chat_id: chat_id.into(),
message_id,
}
}
}
impl Method for DeleteMessage {
type Response = bool;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("deleteMessage", self)
}
}
#[derive(Clone, Debug, Serialize)]
pub struct DeleteMessages {
chat_id: ChatId,
message_ids: Vec<Integer>,
}
impl DeleteMessages {
pub fn new<A, B>(chat_id: A, message_ids: B) -> Self
where
A: Into<ChatId>,
B: IntoIterator<Item = Integer>,
{
Self {
chat_id: chat_id.into(),
message_ids: message_ids.into_iter().collect(),
}
}
}
impl Method for DeleteMessages {
type Response = bool;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("deleteMessages", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct EditMessageCaption {
business_connection_id: Option<String>,
#[serde(flatten)]
caption: Option<InputTextCaption>,
chat_id: Option<ChatId>,
inline_message_id: Option<String>,
message_id: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
show_caption_above_media: Option<bool>,
}
impl EditMessageCaption {
pub fn for_chat_message<T>(chat_id: T, message_id: Integer) -> Self
where
T: Into<ChatId>,
{
Self {
business_connection_id: None,
caption: None,
chat_id: Some(chat_id.into()),
inline_message_id: None,
message_id: Some(message_id),
reply_markup: None,
show_caption_above_media: None,
}
}
pub fn for_inline_message<T>(inline_message_id: T) -> Self
where
T: Into<String>,
{
Self {
business_connection_id: None,
caption: None,
chat_id: None,
inline_message_id: Some(inline_message_id.into()),
message_id: None,
reply_markup: None,
show_caption_above_media: None,
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.business_connection_id = Some(value.into());
self
}
pub fn with_caption<T>(mut self, value: T) -> Self
where
T: Into<InputTextCaption>,
{
self.caption = Some(value.into());
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.reply_markup = Some(value.into());
self
}
pub fn with_show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
}
impl Method for EditMessageCaption {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("editMessageCaption", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct EditMessageLiveLocation {
latitude: Float,
longitude: Float,
business_connection_id: Option<String>,
chat_id: Option<ChatId>,
heading: Option<Integer>,
horizontal_accuracy: Option<Float>,
inline_message_id: Option<String>,
live_period: Option<Integer>,
message_id: Option<Integer>,
proximity_alert_radius: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
}
impl EditMessageLiveLocation {
pub fn for_chat_message<T>(chat_id: T, message_id: Integer, latitude: Float, longitude: Float) -> Self
where
T: Into<ChatId>,
{
Self {
latitude,
longitude,
business_connection_id: None,
chat_id: Some(chat_id.into()),
inline_message_id: None,
live_period: None,
heading: None,
horizontal_accuracy: None,
message_id: Some(message_id),
proximity_alert_radius: None,
reply_markup: None,
}
}
pub fn for_inline_message<T>(inline_message_id: T, latitude: Float, longitude: Float) -> Self
where
T: Into<String>,
{
Self {
latitude,
longitude,
business_connection_id: None,
chat_id: None,
heading: None,
horizontal_accuracy: None,
inline_message_id: Some(inline_message_id.into()),
live_period: None,
message_id: None,
proximity_alert_radius: None,
reply_markup: None,
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.business_connection_id = Some(value.into());
self
}
pub fn with_horizontal_accuracy(mut self, value: Float) -> Self {
self.horizontal_accuracy = Some(value);
self
}
pub fn with_heading(mut self, value: Integer) -> Self {
self.heading = Some(value);
self
}
pub fn with_live_period(mut self, value: Integer) -> Self {
self.live_period = Some(value);
self
}
pub fn with_proximity_alert_radius(mut self, value: Integer) -> Self {
self.proximity_alert_radius = Some(value);
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.reply_markup = Some(value.into());
self
}
}
impl Method for EditMessageLiveLocation {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("editMessageLiveLocation", self)
}
}
#[derive(Debug)]
pub struct EditMessageMedia {
media: InputMedia,
parameters: EditMessageMediaParameters,
}
impl EditMessageMedia {
pub fn for_chat_message<A, B>(chat_id: A, message_id: Integer, media: B) -> Self
where
A: Into<ChatId>,
B: Into<InputMedia>,
{
Self {
media: media.into(),
parameters: EditMessageMediaParameters {
chat_id: Some(chat_id.into()),
message_id: Some(message_id),
..Default::default()
},
}
}
pub fn for_inline_message<A, B>(inline_message_id: A, media: B) -> Self
where
A: Into<String>,
B: Into<InputMedia>,
{
Self {
media: media.into(),
parameters: EditMessageMediaParameters {
inline_message_id: Some(inline_message_id.into()),
..Default::default()
},
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.parameters.business_connection_id = Some(value.into());
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.parameters.reply_markup = Some(value.into());
self
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Serialize)]
struct EditMessageMediaParameters {
business_connection_id: Option<String>,
chat_id: Option<ChatId>,
inline_message_id: Option<String>,
media: Option<InputMediaData>,
message_id: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
}
impl Method for EditMessageMedia {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
let Self { media, mut parameters } = self;
let mut form = Form::default();
parameters.media = Some(media.write(&mut form));
parameters.serialize(&mut form)?;
Payload::form("editMessageMedia", form)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct EditMessageReplyMarkup {
business_connection_id: Option<String>,
chat_id: Option<ChatId>,
inline_message_id: Option<String>,
message_id: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
}
impl EditMessageReplyMarkup {
pub fn for_chat_message<T>(chat_id: T, message_id: Integer) -> Self
where
T: Into<ChatId>,
{
Self {
business_connection_id: None,
chat_id: Some(chat_id.into()),
inline_message_id: None,
message_id: Some(message_id),
reply_markup: None,
}
}
pub fn for_inline_message<T>(inline_message_id: T) -> Self
where
T: Into<String>,
{
Self {
business_connection_id: None,
chat_id: None,
inline_message_id: Some(inline_message_id.into()),
message_id: None,
reply_markup: None,
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.business_connection_id = Some(value.into());
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.reply_markup = Some(value.into());
self
}
}
impl Method for EditMessageReplyMarkup {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("editMessageReplyMarkup", self)
}
}
#[derive(Debug)]
pub struct EditMessageText {
parameters: EditMessageTextParameters,
rich_message: Option<InputRichMessage>,
}
impl EditMessageText {
pub fn for_chat_message<A, B>(chat_id: A, message_id: Integer, text: B) -> Self
where
A: Into<ChatId>,
B: Into<InputText>,
{
Self {
parameters: EditMessageTextParameters {
chat_id: Some(chat_id.into()),
message_id: Some(message_id),
text: Some(text.into()),
..Default::default()
},
rich_message: None,
}
}
pub fn for_chat_message_rich<T>(chat_id: T, message_id: Integer, rich_message: InputRichMessage) -> Self
where
T: Into<ChatId>,
{
Self {
parameters: EditMessageTextParameters {
chat_id: Some(chat_id.into()),
message_id: Some(message_id),
..Default::default()
},
rich_message: Some(rich_message),
}
}
pub fn for_inline_message<A, B>(inline_message_id: A, text: B) -> Self
where
A: Into<String>,
B: Into<InputText>,
{
Self {
parameters: EditMessageTextParameters {
inline_message_id: Some(inline_message_id.into()),
text: Some(text.into()),
..Default::default()
},
rich_message: None,
}
}
pub fn for_inline_message_rich<T>(inline_message_id: T, rich_message: InputRichMessage) -> Self
where
T: Into<String>,
{
Self {
parameters: EditMessageTextParameters {
inline_message_id: Some(inline_message_id.into()),
..Default::default()
},
rich_message: Some(rich_message),
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.parameters.business_connection_id = Some(value.into());
self
}
pub fn with_link_preview_options(mut self, value: LinkPreviewOptions) -> Self {
self.parameters.link_preview_options = Some(value);
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.parameters.reply_markup = Some(value.into());
self
}
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Default, Serialize)]
struct EditMessageTextParameters {
business_connection_id: Option<String>,
chat_id: Option<ChatId>,
inline_message_id: Option<String>,
link_preview_options: Option<LinkPreviewOptions>,
message_id: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
rich_message: Option<InputRichMessageData>,
#[serde(flatten)]
text: Option<InputText>,
}
impl Method for EditMessageText {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
let Self {
mut parameters,
rich_message,
} = self;
if let Some(rich_message) = rich_message {
let mut form = Form::default();
parameters.rich_message = Some(rich_message.write(&mut form));
Serialize::serialize(¶meters, &mut form)?;
Payload::form("editMessageText", form)
} else {
Payload::json("editMessageText", parameters)
}
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct ForwardMessage {
chat_id: ChatId,
from_chat_id: ChatId,
message_id: Integer,
direct_messages_topic_id: Option<Integer>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_effect_id: Option<String>,
message_thread_id: Option<Integer>,
suggested_post_parameters: Option<SuggestedPostParameters>,
video_start_timestamp: Option<Integer>,
}
impl ForwardMessage {
pub fn new<A, B>(chat_id: A, from_chat_id: B, message_id: Integer) -> Self
where
A: Into<ChatId>,
B: Into<ChatId>,
{
Self {
chat_id: chat_id.into(),
from_chat_id: from_chat_id.into(),
message_id,
direct_messages_topic_id: None,
disable_notification: None,
protect_content: None,
message_effect_id: None,
message_thread_id: None,
suggested_post_parameters: None,
video_start_timestamp: None,
}
}
pub fn with_direct_messages_topic_id(mut self, value: Integer) -> Self {
self.direct_messages_topic_id = Some(value);
self
}
pub fn with_disable_notification(mut self, value: bool) -> Self {
self.disable_notification = Some(value);
self
}
pub fn with_message_effect_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.message_effect_id = Some(value.into());
self
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn with_protect_content(mut self, value: bool) -> Self {
self.protect_content = Some(value);
self
}
pub fn with_suggested_post_parameters(mut self, value: SuggestedPostParameters) -> Self {
self.suggested_post_parameters = Some(value);
self
}
pub fn with_video_start_timestamp(mut self, value: Integer) -> Self {
self.video_start_timestamp = Some(value);
self
}
}
impl Method for ForwardMessage {
type Response = Message;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("forwardMessage", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct ForwardMessages {
chat_id: ChatId,
from_chat_id: ChatId,
message_ids: Vec<Integer>,
direct_messages_topic_id: Option<Integer>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_thread_id: Option<Integer>,
}
impl ForwardMessages {
pub fn new<A, B, C>(chat_id: A, from_chat_id: B, message_ids: C) -> Self
where
A: Into<ChatId>,
B: Into<ChatId>,
C: IntoIterator<Item = Integer>,
{
Self {
chat_id: chat_id.into(),
from_chat_id: from_chat_id.into(),
message_ids: message_ids.into_iter().collect(),
direct_messages_topic_id: None,
disable_notification: None,
protect_content: None,
message_thread_id: None,
}
}
pub fn with_direct_messages_topic_id(mut self, value: Integer) -> Self {
self.direct_messages_topic_id = Some(value);
self
}
pub fn with_disable_notification(mut self, value: bool) -> Self {
self.disable_notification = Some(value);
self
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn with_protect_content(mut self, value: bool) -> Self {
self.protect_content = Some(value);
self
}
}
impl Method for ForwardMessages {
type Response = Vec<MessageId>;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("forwardMessages", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct SendMessage {
chat_id: ChatId,
#[serde(flatten)]
text: InputText,
allow_paid_broadcast: Option<bool>,
business_connection_id: Option<String>,
callback_query_id: Option<String>,
direct_messages_topic_id: Option<Integer>,
disable_notification: Option<bool>,
link_preview_options: Option<LinkPreviewOptions>,
message_effect_id: Option<String>,
message_thread_id: Option<Integer>,
protect_content: Option<bool>,
receiver_user_id: Option<Integer>,
reply_markup: Option<ReplyMarkup>,
reply_parameters: Option<ReplyParameters>,
suggested_post_parameters: Option<SuggestedPostParameters>,
}
impl SendMessage {
pub fn new<A, B>(chat_id: A, text: B) -> Self
where
A: Into<ChatId>,
B: Into<InputText>,
{
Self {
chat_id: chat_id.into(),
text: text.into(),
allow_paid_broadcast: None,
business_connection_id: None,
callback_query_id: None,
direct_messages_topic_id: None,
disable_notification: None,
link_preview_options: None,
message_effect_id: None,
message_thread_id: None,
protect_content: None,
receiver_user_id: None,
reply_markup: None,
reply_parameters: None,
suggested_post_parameters: None,
}
}
pub fn with_allow_paid_broadcast(mut self, value: bool) -> Self {
self.allow_paid_broadcast = Some(value);
self
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.business_connection_id = Some(value.into());
self
}
pub fn with_callback_query_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.callback_query_id = Some(value.into());
self
}
pub fn with_direct_messages_topic_id(mut self, value: Integer) -> Self {
self.direct_messages_topic_id = Some(value);
self
}
pub fn with_disable_notification(mut self, value: bool) -> Self {
self.disable_notification = Some(value);
self
}
pub fn with_link_preview_options(mut self, value: LinkPreviewOptions) -> Self {
self.link_preview_options = Some(value);
self
}
pub fn with_message_effect_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.message_effect_id = Some(value.into());
self
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn with_protect_content(mut self, value: bool) -> Self {
self.protect_content = Some(value);
self
}
pub fn with_receiver_user_id(mut self, value: Integer) -> Self {
self.receiver_user_id = Some(value);
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<ReplyMarkup>,
{
self.reply_markup = Some(value.into());
self
}
pub fn with_reply_parameters(mut self, value: ReplyParameters) -> Self {
self.reply_parameters = Some(value);
self
}
pub fn with_suggested_post_parameters(mut self, value: SuggestedPostParameters) -> Self {
self.suggested_post_parameters = Some(value);
self
}
}
impl Method for SendMessage {
type Response = Message;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("sendMessage", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct SendMessageDraft {
chat_id: Integer,
draft_id: Integer,
#[serde(flatten)]
text: InputText,
message_thread_id: Option<Integer>,
}
impl SendMessageDraft {
pub fn new<T>(chat_id: Integer, draft_id: Integer, text: T) -> Self
where
T: Into<InputText>,
{
Self {
chat_id,
draft_id,
text: text.into(),
message_thread_id: None,
}
}
pub fn with_message_thread_id(mut self, value: Integer) -> Self {
self.message_thread_id = Some(value);
self
}
}
impl Method for SendMessageDraft {
type Response = bool;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("sendMessageDraft", self)
}
}
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Serialize)]
pub struct StopMessageLiveLocation {
business_connection_id: Option<String>,
chat_id: Option<ChatId>,
inline_message_id: Option<String>,
message_id: Option<Integer>,
reply_markup: Option<InlineKeyboardMarkup>,
}
impl StopMessageLiveLocation {
pub fn for_chat_message<T>(chat_id: T, message_id: Integer) -> Self
where
T: Into<ChatId>,
{
Self {
business_connection_id: None,
chat_id: Some(chat_id.into()),
inline_message_id: None,
message_id: Some(message_id),
reply_markup: None,
}
}
pub fn for_inline_message<T>(inline_message_id: T) -> Self
where
T: Into<String>,
{
Self {
business_connection_id: None,
chat_id: None,
inline_message_id: Some(inline_message_id.into()),
message_id: None,
reply_markup: None,
}
}
pub fn with_business_connection_id<T>(mut self, value: T) -> Self
where
T: Into<String>,
{
self.business_connection_id = Some(value.into());
self
}
pub fn with_reply_markup<T>(mut self, value: T) -> Self
where
T: Into<InlineKeyboardMarkup>,
{
self.reply_markup = Some(value.into());
self
}
}
impl Method for StopMessageLiveLocation {
type Response = EditMessageResult;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("stopMessageLiveLocation", self)
}
}