Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot API 7.2 - Working on Behalf of Business Accounts #156

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions src/api_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ pub struct DeleteWebhookParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendMessageParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -435,6 +439,10 @@ pub struct CopyMessagesParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendPhotoParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -480,6 +488,10 @@ pub struct SendPhotoParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendAudioParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -537,6 +549,10 @@ pub struct SendAudioParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendDocumentParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -586,6 +602,10 @@ pub struct SendDocumentParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendVideoParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -651,6 +671,10 @@ pub struct SendVideoParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendAnimationParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -712,6 +736,10 @@ pub struct SendAnimationParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendVoiceParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -757,6 +785,10 @@ pub struct SendVoiceParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendVideoNoteParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -798,6 +830,10 @@ pub struct SendVideoNoteParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendMediaGroupParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand All @@ -822,6 +858,10 @@ pub struct SendMediaGroupParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
pub struct SendLocationParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -922,6 +962,10 @@ pub struct StopMessageLiveLocationParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
pub struct SendVenueParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -974,6 +1018,10 @@ pub struct SendVenueParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendContactParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -1014,6 +1062,10 @@ pub struct SendContactParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendPollParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -1085,6 +1137,10 @@ pub struct SendPollParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendDiceParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -1115,6 +1171,10 @@ pub struct SendDiceParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendChatActionParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -1861,6 +1921,10 @@ pub struct DeleteMessagesParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendStickerParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat_id: ChatId,

Expand Down Expand Up @@ -2278,6 +2342,10 @@ pub struct SetPassportDataErrorsParams {

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct SendGameParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

pub chat_id: i64,

#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
8 changes: 8 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,16 @@ pub struct Message {
#[builder(setter(into, strip_option), default)]
pub sender_boost_count: Option<u32>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub sender_business_bot: Option<Box<User>>,

pub date: u64,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_connection_id: Option<String>,

#[builder(setter(into))]
pub chat: Box<Chat>,

Expand Down