Skip to content

Commit

Permalink
Add business_connection_id to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Desiders committed Aug 14, 2024
1 parent 9344aad commit abdf003
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 0 deletions.
19 changes: 19 additions & 0 deletions telers/src/methods/edit_message_caption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct EditMessageCaption {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message to edit
Expand All @@ -38,6 +40,7 @@ impl EditMessageCaption {
#[must_use]
pub fn new(caption: impl Into<String>) -> Self {
Self {
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
Expand All @@ -49,6 +52,14 @@ impl EditMessageCaption {
}
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -135,6 +146,14 @@ impl EditMessageCaption {
}

impl EditMessageCaption {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/edit_message_live_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct EditMessageLiveLocation {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message to edit
Expand All @@ -43,6 +45,7 @@ impl EditMessageLiveLocation {
#[must_use]
pub fn new(longitude: f64, latitude: f64) -> Self {
Self {
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
Expand All @@ -56,6 +59,14 @@ impl EditMessageLiveLocation {
}
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -138,6 +149,14 @@ impl EditMessageLiveLocation {
}

impl EditMessageLiveLocation {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/edit_message_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, Hash, PartialEq, Serialize)]
pub struct EditMessageMedia<'a> {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message to edit
Expand All @@ -32,6 +34,7 @@ impl<'a> EditMessageMedia<'a> {
#[must_use]
pub fn new(media: impl Into<InputMedia<'a>>) -> Self {
Self {
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
Expand All @@ -40,6 +43,14 @@ impl<'a> EditMessageMedia<'a> {
}
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -82,6 +93,14 @@ impl<'a> EditMessageMedia<'a> {
}

impl<'a> EditMessageMedia<'a> {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
18 changes: 18 additions & 0 deletions telers/src/methods/edit_message_reply_markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct EditMessageReplyMarkup {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message to edit
Expand All @@ -32,6 +34,14 @@ impl EditMessageReplyMarkup {
Self::default()
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -66,6 +76,14 @@ impl EditMessageReplyMarkup {
}

impl EditMessageReplyMarkup {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/edit_message_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct EditMessageText {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message to edit
Expand All @@ -38,6 +40,7 @@ impl EditMessageText {
#[must_use]
pub fn new(text: impl Into<String>) -> Self {
Self {
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
Expand All @@ -49,6 +52,14 @@ impl EditMessageText {
}
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -121,6 +132,14 @@ impl EditMessageText {
}

impl EditMessageText {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
18 changes: 18 additions & 0 deletions telers/src/methods/stop_message_live_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct StopMessageLiveLocation {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Required if `inline_message_id` is not specified. Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Option<ChatIdKind>,
/// Required if `inline_message_id` is not specified. Identifier of the message with live location to stop
Expand All @@ -33,6 +35,14 @@ impl StopMessageLiveLocation {
Self::default()
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand Down Expand Up @@ -67,6 +77,14 @@ impl StopMessageLiveLocation {
}

impl StopMessageLiveLocation {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn chat_id_option(self, val: Option<impl Into<ChatIdKind>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/stop_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize)]
pub struct StopPoll {
/// Unique identifier of the business connection on behalf of which the message to be edited was sent
pub business_connection_id: Option<String>,
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatIdKind,
/// Identifier of the original message with the poll
Expand All @@ -28,12 +30,21 @@ impl StopPoll {
#[must_use]
pub fn new(chat_id: impl Into<ChatIdKind>, message_id: i64) -> Self {
Self {
business_connection_id: None,
chat_id: chat_id.into(),
message_id,
reply_markup: None,
}
}

#[must_use]
pub fn business_connection_id(self, val: impl Into<String>) -> Self {
Self {
business_connection_id: Some(val.into()),
..self
}
}

#[must_use]
pub fn chat_id(self, val: impl Into<ChatIdKind>) -> Self {
Self {
Expand All @@ -60,6 +71,14 @@ impl StopPoll {
}

impl StopPoll {
#[must_use]
pub fn business_connection_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
business_connection_id: val.map(Into::into),
..self
}
}

#[must_use]
pub fn reply_markup_option(self, val: Option<impl Into<InlineKeyboardMarkup>>) -> Self {
Self {
Expand Down

0 comments on commit abdf003

Please sign in to comment.