Add business_connection_id to add Send* methods except SendInvoice

This commit is contained in:
Akshett Rai Jindal 2024-08-21 00:29:11 +05:30
parent 78f909e621
commit 941d1eb82a
18 changed files with 120 additions and 1 deletions

View file

@ -224,6 +224,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendmessage", tg_doc: "https://core.telegram.org/bots/api#sendmessage",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -520,6 +525,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendphoto", tg_doc: "https://core.telegram.org/bots/api#sendphoto",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -605,6 +615,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendaudio", tg_doc: "https://core.telegram.org/bots/api#sendaudio",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -705,6 +720,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#senddocument", tg_doc: "https://core.telegram.org/bots/api#senddocument",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -798,6 +818,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendvideo", tg_doc: "https://core.telegram.org/bots/api#sendvideo",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -909,6 +934,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendanimation", tg_doc: "https://core.telegram.org/bots/api#sendanimation",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1018,6 +1048,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendvoice", tg_doc: "https://core.telegram.org/bots/api#sendvoice",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1098,6 +1133,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendvideonote", tg_doc: "https://core.telegram.org/bots/api#sendvideonote",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1176,6 +1216,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendmediagroup", tg_doc: "https://core.telegram.org/bots/api#sendmediagroup",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1221,6 +1266,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendlocation", tg_doc: "https://core.telegram.org/bots/api#sendlocation",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1484,6 +1534,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendvenue", tg_doc: "https://core.telegram.org/bots/api#sendvenue",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1578,6 +1633,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendcontact", tg_doc: "https://core.telegram.org/bots/api#sendcontact",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1652,6 +1712,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendpoll", tg_doc: "https://core.telegram.org/bots/api#sendpoll",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1766,6 +1831,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#senddice", tg_doc: "https://core.telegram.org/bots/api#senddice",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -1822,6 +1892,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendchataction", tg_doc: "https://core.telegram.org/bots/api#sendchataction",
tg_category: "Available methods", tg_category: "Available methods",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the action will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -3637,6 +3712,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendsticker", tg_doc: "https://core.telegram.org/bots/api#sendsticker",
tg_category: "Stickers", tg_category: "Stickers",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("Recipient"), ty: RawTy("Recipient"),
@ -4393,6 +4473,11 @@ Schema(
tg_doc: "https://core.telegram.org/bots/api#sendgame", tg_doc: "https://core.telegram.org/bots/api#sendgame",
tg_category: "Games", tg_category: "Games",
params: [ params: [
Param(
name: "business_connection_id",
ty: Option(String),
descr: Doc(md: "Unique identifier of the business connection on behalf of which the message will be sent"),
),
Param( Param(
name: "chat_id", name: "chat_id",
ty: RawTy("ChatId"), ty: RawTy("ChatId"),

View file

@ -22,6 +22,8 @@ impl_payload! {
pub animation: InputFile, pub animation: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Duration of the animation in seconds /// Duration of the animation in seconds

View file

@ -25,6 +25,8 @@ impl_payload! {
pub audio: InputFile, pub audio: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Audio caption, 0-1024 characters after entities parsing /// Audio caption, 0-1024 characters after entities parsing

View file

@ -30,6 +30,8 @@ impl_payload! {
pub action: ChatAction, pub action: ChatAction,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the action will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread; supergroups only /// Unique identifier for the target message thread; supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
} }

View file

@ -19,6 +19,8 @@ impl_payload! {
pub first_name: String [into], pub first_name: String [into],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Contact's last name /// Contact's last name

View file

@ -15,6 +15,8 @@ impl_payload! {
pub chat_id: Recipient [into], pub chat_id: Recipient [into],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” /// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”

View file

@ -22,6 +22,8 @@ impl_payload! {
pub document: InputFile, pub document: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »] /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More info on Sending Files »]

View file

@ -17,6 +17,8 @@ impl_payload! {
pub game_short_name: String [into], pub game_short_name: String [into],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound. /// Sends the message [silently]. Users will receive a notification with no sound.

View file

@ -19,6 +19,8 @@ impl_payload! {
pub longitude: f64, pub longitude: f64,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// The radius of uncertainty for the location, measured in meters; 0-1500 /// The radius of uncertainty for the location, measured in meters; 0-1500

View file

@ -26,6 +26,8 @@ impl_payload! {
pub media: Vec<InputMedia> [collect], pub media: Vec<InputMedia> [collect],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound. /// Sends the message [silently]. Users will receive a notification with no sound.

View file

@ -20,6 +20,8 @@ impl_payload! {
pub text: String [into], pub text: String [into],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Mode for parsing entities in the message text. See [formatting options] for more details. /// Mode for parsing entities in the message text. See [formatting options] for more details.

View file

@ -22,6 +22,8 @@ impl_payload! {
pub photo: InputFile, pub photo: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Photo caption (may also be used when resending photos by _file\_id_), 0-1024 characters after entities parsing /// Photo caption (may also be used when resending photos by _file\_id_), 0-1024 characters after entities parsing

View file

@ -22,6 +22,8 @@ impl_payload! {
pub options: Vec<String> [collect], pub options: Vec<String> [collect],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// True, if the poll needs to be anonymous, defaults to True /// True, if the poll needs to be anonymous, defaults to True

View file

@ -6,7 +6,7 @@ use crate::types::{InputFile, Message, Recipient, ReplyMarkup, ReplyParameters,
impl_payload! { impl_payload! {
@[multipart = sticker] @[multipart = sticker]
/// Use this method to send static .WEBP or [animated] .TGS stickers. On success, the sent Message is returned. /// Use this method to send static .WEBP, .TGS or .WEBM stickers. On success, the sent Message is returned.
/// ///
/// [animated]: https://telegram.org/blog/animated-stickers /// [animated]: https://telegram.org/blog/animated-stickers
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
@ -20,6 +20,8 @@ impl_payload! {
pub sticker: InputFile, pub sticker: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Emoji associated with the sticker; only for just uploaded stickers /// Emoji associated with the sticker; only for just uploaded stickers

View file

@ -23,6 +23,8 @@ impl_payload! {
pub address: String [into], pub address: String [into],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Foursquare identifier of the venue /// Foursquare identifier of the venue

View file

@ -23,6 +23,8 @@ impl_payload! {
pub video: InputFile, pub video: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Duration of the video in seconds /// Duration of the video in seconds

View file

@ -21,6 +21,8 @@ impl_payload! {
pub video_note: InputFile, pub video_note: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Duration of the video in seconds /// Duration of the video in seconds

View file

@ -24,6 +24,8 @@ impl_payload! {
pub voice: InputFile, pub voice: InputFile,
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent
pub business_connection_id: String [into],
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId, pub message_thread_id: ThreadId,
/// Voice message caption, 0-1024 characters after entities parsing /// Voice message caption, 0-1024 characters after entities parsing