// @generated by `cargo run -p xtask -- generate`. DO NOT EDIT.
//! Generated Telegram Bot API types for the pinned compatibility baseline.
#![allow(
clippy::too_many_arguments,
unused_mut,
rustdoc::bare_urls,
rustdoc::invalid_html_tags
)]
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use super::{CollectFiles, InputFileUpload};
/// Number of entity definitions in the pinned upstream snapshot.
pub const API_ENTITY_COUNT: usize = 390;
/// Number of final Python field annotations mapped into generated Rust types.
pub const MAPPED_PYTHON_TYPE_ANNOTATION_COUNT: usize = 1896;
#[doc = "This object describes the types of gifts that can be gifted to a user or a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct AcceptedGiftTypes {
#[doc = "True, if unlimited regular gifts are accepted"]
pub unlimited_gifts: bool,
#[doc = "True, if limited regular gifts are accepted"]
pub limited_gifts: bool,
#[doc = "True, if unique gifts or gifts that can be upgraded to unique for free are accepted"]
pub unique_gifts: bool,
#[doc = "True, if a Telegram Premium subscription is accepted"]
pub premium_subscription: bool,
#[doc = "True, if transfers of unique gifts from channels are accepted"]
pub gifts_from_channels: bool,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for AcceptedGiftTypes {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.unlimited_gifts, output);
CollectFiles::collect_files(&self.limited_gifts, output);
CollectFiles::collect_files(&self.unique_gifts, output);
CollectFiles::collect_files(&self.premium_subscription, output);
CollectFiles::collect_files(&self.gifts_from_channels, output);
}
}
impl AcceptedGiftTypes {
pub fn new(
unlimited_gifts: bool,
limited_gifts: bool,
unique_gifts: bool,
premium_subscription: bool,
gifts_from_channels: bool,
) -> Self {
Self {
unlimited_gifts,
limited_gifts,
unique_gifts,
premium_subscription,
gifts_from_channels,
extra: BTreeMap::new(),
}
}
}
#[doc = "Contains information about the affiliate that received a commission via this transaction."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct AffiliateInfo {
#[doc = "The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users"]
pub commission_per_mille: i64,
#[doc = "Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds"]
pub amount: i64,
#[doc = "The bot or the user that received an affiliate commission if it was received by a bot or a user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub affiliate_user: Option<User>,
#[doc = "The chat that received an affiliate commission if it was received by a chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub affiliate_chat: Option<Box<Chat>>,
#[doc = "The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nanostar_amount: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for AffiliateInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.commission_per_mille, output);
CollectFiles::collect_files(&self.amount, output);
CollectFiles::collect_files(&self.affiliate_user, output);
CollectFiles::collect_files(&self.affiliate_chat, output);
CollectFiles::collect_files(&self.nanostar_amount, output);
}
}
impl AffiliateInfo {
pub fn new(commission_per_mille: i64, amount: i64) -> Self {
Self {
commission_per_mille,
amount,
affiliate_user: None,
affiliate_chat: None,
nanostar_amount: None,
extra: BTreeMap::new(),
}
}
pub fn affiliate_user(mut self, value: User) -> Self {
self.affiliate_user = Some(value);
self
}
pub fn affiliate_chat(mut self, value: Box<Chat>) -> Self {
self.affiliate_chat = Some(value);
self
}
pub fn nanostar_amount(mut self, value: i64) -> Self {
self.nanostar_amount = Some(value);
self
}
}
#[doc = "This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound)."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Animation {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Video width as defined by the sender"]
pub width: i64,
#[doc = "Video height as defined by the sender"]
pub height: i64,
#[doc = "Duration of the video in seconds as defined by the sender"]
pub duration: i64,
#[doc = "Animation thumbnail as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "Original animation filename as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Animation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.file_name, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl Animation {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
width: i64,
height: i64,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
duration,
thumbnail: None,
file_name: None,
mime_type: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn file_name(mut self, value: impl Into<String>) -> Self {
self.file_name = Some(value.into());
self
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents an audio file to be treated as music by the Telegram clients."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Audio {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Duration of the audio in seconds as defined by the sender"]
pub duration: i64,
#[doc = "Performer of the audio as defined by the sender or by audio tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub performer: Option<String>,
#[doc = "Title of the audio as defined by the sender or by audio tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Original filename as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[doc = "Thumbnail of the album cover to which the music file belongs"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Audio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.performer, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.file_name, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
CollectFiles::collect_files(&self.thumbnail, output);
}
}
impl Audio {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
duration,
performer: None,
title: None,
file_name: None,
mime_type: None,
file_size: None,
thumbnail: None,
extra: BTreeMap::new(),
}
}
pub fn performer(mut self, value: impl Into<String>) -> Self {
self.performer = Some(value.into());
self
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn file_name(mut self, value: impl Into<String>) -> Self {
self.file_name = Some(value.into());
self
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
}
#[doc = "This object describes the way a background is filled based on the selected colors. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundFill {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundFill {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl BackgroundFill {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for BackgroundFill {
fn default() -> Self {
Self::new()
}
}
#[doc = "The background is a freeform gradient that rotates after every message in the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundFillFreeformGradient {
#[doc = "Type of the background fill, always 'freeform_gradient'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format"]
pub colors: Vec<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundFillFreeformGradient {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.colors, output);
}
}
impl BackgroundFillFreeformGradient {
pub fn new(colors: Vec<i64>) -> Self {
Self {
kind: "freeform_gradient".to_owned(),
colors,
extra: BTreeMap::new(),
}
}
}
#[doc = "The background is a gradient fill."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundFillGradient {
#[doc = "Type of the background fill, always 'gradient'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Top color of the gradient in the RGB24 format"]
pub top_color: i64,
#[doc = "Bottom color of the gradient in the RGB24 format"]
pub bottom_color: i64,
#[doc = "Clockwise rotation angle of the background fill in degrees; 0-359"]
pub rotation_angle: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundFillGradient {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.top_color, output);
CollectFiles::collect_files(&self.bottom_color, output);
CollectFiles::collect_files(&self.rotation_angle, output);
}
}
impl BackgroundFillGradient {
pub fn new(top_color: i64, bottom_color: i64, rotation_angle: i64) -> Self {
Self {
kind: "gradient".to_owned(),
top_color,
bottom_color,
rotation_angle,
extra: BTreeMap::new(),
}
}
}
#[doc = "The background is filled using the selected color."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundFillSolid {
#[doc = "Type of the background fill, always 'solid'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The color of the background fill in the RGB24 format"]
pub color: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundFillSolid {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.color, output);
}
}
impl BackgroundFillSolid {
pub fn new(color: i64) -> Self {
Self {
kind: "solid".to_owned(),
color,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the type of a background. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundType {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundType {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl BackgroundType {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for BackgroundType {
fn default() -> Self {
Self::new()
}
}
#[doc = "The background is taken directly from a built-in chat theme."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundTypeChatTheme {
#[doc = "Type of the background, always 'chat_theme'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Name of the chat theme, which is usually an emoji"]
pub theme_name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundTypeChatTheme {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.theme_name, output);
}
}
impl BackgroundTypeChatTheme {
pub fn new(theme_name: impl Into<String>) -> Self {
Self {
kind: "chat_theme".to_owned(),
theme_name: theme_name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The background is automatically filled based on the selected colors."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundTypeFill {
#[doc = "Type of the background, always 'fill'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The background fill"]
pub fill: BackgroundFillUnion,
#[doc = "Dimming of the background in dark themes, as a percentage; 0-100"]
pub dark_theme_dimming: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundTypeFill {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.fill, output);
CollectFiles::collect_files(&self.dark_theme_dimming, output);
}
}
impl BackgroundTypeFill {
pub fn new(fill: impl Into<BackgroundFillUnion>, dark_theme_dimming: i64) -> Self {
Self {
kind: "fill".to_owned(),
fill: fill.into(),
dark_theme_dimming,
extra: BTreeMap::new(),
}
}
}
#[doc = "The background is a .PNG or .TGV (gzipped subset of SVG with MIME type 'application/x-tgwallpattern') pattern to be combined with the background fill chosen by the user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundTypePattern {
#[doc = "Type of the background, always 'pattern'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Document with the pattern"]
pub document: Document,
#[doc = "The background fill that is combined with the pattern"]
pub fill: BackgroundFillUnion,
#[doc = "Intensity of the pattern when it is shown above the filled background; 0-100"]
pub intensity: i64,
#[doc = "True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_inverted: Option<bool>,
#[doc = "True, if the background moves slightly when the device is tilted"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_moving: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundTypePattern {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.document, output);
CollectFiles::collect_files(&self.fill, output);
CollectFiles::collect_files(&self.intensity, output);
CollectFiles::collect_files(&self.is_inverted, output);
CollectFiles::collect_files(&self.is_moving, output);
}
}
impl BackgroundTypePattern {
pub fn new(document: Document, fill: impl Into<BackgroundFillUnion>, intensity: i64) -> Self {
Self {
kind: "pattern".to_owned(),
document,
fill: fill.into(),
intensity,
is_inverted: None,
is_moving: None,
extra: BTreeMap::new(),
}
}
pub fn is_inverted(mut self, value: bool) -> Self {
self.is_inverted = Some(value);
self
}
pub fn is_moving(mut self, value: bool) -> Self {
self.is_moving = Some(value);
self
}
}
#[doc = "The background is a wallpaper in the JPEG format."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BackgroundTypeWallpaper {
#[doc = "Type of the background, always 'wallpaper'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Document with the wallpaper"]
pub document: Document,
#[doc = "Dimming of the background in dark themes, as a percentage; 0-100"]
pub dark_theme_dimming: i64,
#[doc = "True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_blurred: Option<bool>,
#[doc = "True, if the background moves slightly when the device is tilted"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_moving: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BackgroundTypeWallpaper {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.document, output);
CollectFiles::collect_files(&self.dark_theme_dimming, output);
CollectFiles::collect_files(&self.is_blurred, output);
CollectFiles::collect_files(&self.is_moving, output);
}
}
impl BackgroundTypeWallpaper {
pub fn new(document: Document, dark_theme_dimming: i64) -> Self {
Self {
kind: "wallpaper".to_owned(),
document,
dark_theme_dimming,
is_blurred: None,
is_moving: None,
extra: BTreeMap::new(),
}
}
pub fn is_blurred(mut self, value: bool) -> Self {
self.is_blurred = Some(value);
self
}
pub fn is_moving(mut self, value: bool) -> Self {
self.is_moving = Some(value);
self
}
}
#[doc = "Describes the birthdate of a user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Birthdate {
#[doc = "Day of the user's birth; 1-31"]
pub day: i64,
#[doc = "Month of the user's birth; 1-12"]
pub month: i64,
#[doc = "Year of the user's birth"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub year: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Birthdate {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.day, output);
CollectFiles::collect_files(&self.month, output);
CollectFiles::collect_files(&self.year, output);
}
}
impl Birthdate {
pub fn new(day: i64, month: i64) -> Self {
Self {
day,
month,
year: None,
extra: BTreeMap::new(),
}
}
pub fn year(mut self, value: i64) -> Self {
self.year = Some(value);
self
}
}
#[doc = "This object describes the access settings of a bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotAccessSettings {
#[doc = "True, if only selected users can access the bot. The bot's owner can always access it."]
pub is_access_restricted: bool,
#[doc = "The list of other users who have access to the bot if the access is restricted"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub added_users: Option<Vec<User>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotAccessSettings {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.is_access_restricted, output);
CollectFiles::collect_files(&self.added_users, output);
}
}
impl BotAccessSettings {
pub fn new(is_access_restricted: bool) -> Self {
Self {
is_access_restricted,
added_users: None,
extra: BTreeMap::new(),
}
}
pub fn added_users(mut self, value: Vec<User>) -> Self {
self.added_users = Some(value);
self
}
}
#[doc = "This object represents a bot command."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommand {
#[doc = "Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores."]
pub command: String,
#[doc = "Description of the command; 1-256 characters"]
pub description: String,
#[doc = "True, if the command sends an ephemeral message, which can be seen only by the sender of the message and the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_ephemeral: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommand {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.command, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.is_ephemeral, output);
}
}
impl BotCommand {
pub fn new(command: impl Into<String>, description: impl Into<String>) -> Self {
Self {
command: command.into(),
description: description.into(),
is_ephemeral: None,
extra: BTreeMap::new(),
}
}
pub fn is_ephemeral(mut self, value: bool) -> Self {
self.is_ephemeral = Some(value);
self
}
}
#[doc = "This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScope {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScope {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl BotCommandScope {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for BotCommandScope {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents the scope of bot commands, covering all group and supergroup chat administrators."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeAllChatAdministrators {
#[doc = "Scope type, must be all_chat_administrators"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeAllChatAdministrators {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl BotCommandScopeAllChatAdministrators {
pub fn new(kind: impl Into<String>) -> Self {
Self {
kind: kind.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents the scope of bot commands, covering all group and supergroup chats."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeAllGroupChats {
#[doc = "Scope type, must be all_group_chats"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeAllGroupChats {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl BotCommandScopeAllGroupChats {
pub fn new() -> Self {
Self {
kind: "all_group_chats".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for BotCommandScopeAllGroupChats {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents the scope of bot commands, covering all private chats."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeAllPrivateChats {
#[doc = "Scope type, must be all_private_chats"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeAllPrivateChats {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl BotCommandScopeAllPrivateChats {
pub fn new() -> Self {
Self {
kind: "all_private_chats".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for BotCommandScopeAllPrivateChats {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents the scope of bot commands, covering a specific chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeChat {
#[doc = "Scope type, must be chat"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for the target chat or username of the target supergroup in the format @username. Channel direct messages chats and channel chats aren't supported."]
pub chat_id: super::ChatId,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeChat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.chat_id, output);
}
}
impl BotCommandScopeChat {
pub fn new(chat_id: impl Into<super::ChatId>) -> Self {
Self {
kind: "chat".to_owned(),
chat_id: chat_id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeChatAdministrators {
#[doc = "Scope type, must be chat_administrators"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for the target chat or username of the target supergroup in the format @username. Channel direct messages chats and channel chats aren't supported."]
pub chat_id: super::ChatId,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeChatAdministrators {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.chat_id, output);
}
}
impl BotCommandScopeChatAdministrators {
pub fn new(kind: impl Into<String>, chat_id: impl Into<super::ChatId>) -> Self {
Self {
kind: kind.into(),
chat_id: chat_id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents the scope of bot commands, covering a specific member of a group or supergroup chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeChatMember {
#[doc = "Scope type, must be chat_member"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for the target chat or username of the target supergroup in the format @username. Channel direct messages chats and channel chats aren't supported."]
pub chat_id: super::ChatId,
#[doc = "Unique identifier of the target user"]
pub user_id: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeChatMember {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.chat_id, output);
CollectFiles::collect_files(&self.user_id, output);
}
}
impl BotCommandScopeChatMember {
pub fn new(chat_id: impl Into<super::ChatId>, user_id: i64) -> Self {
Self {
kind: "chat_member".to_owned(),
chat_id: chat_id.into(),
user_id,
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotCommandScopeDefault {
#[doc = "Scope type, must be default"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotCommandScopeDefault {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl BotCommandScopeDefault {
pub fn new() -> Self {
Self {
kind: "default".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for BotCommandScopeDefault {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents the bot's description."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotDescription {
#[doc = "The bot's description"]
pub description: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotDescription {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.description, output);
}
}
impl BotDescription {
pub fn new(description: impl Into<String>) -> Self {
Self {
description: description.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents the bot's name."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotName {
#[doc = "The bot's name"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotName {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
}
}
impl BotName {
pub fn new(name: impl Into<String>) -> Self {
Self {
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents the bot's short description."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotShortDescription {
#[doc = "The bot's short description"]
pub short_description: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotShortDescription {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.short_description, output);
}
}
impl BotShortDescription {
pub fn new(short_description: impl Into<String>) -> Self {
Self {
short_description: short_description.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about changes to a user payment subscription toward the current bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BotSubscriptionUpdated {
#[doc = "User who subscribed for payments toward the bot"]
pub user: User,
#[doc = "Bot-specified invoice payload"]
pub invoice_payload: String,
#[doc = "The new state of the subscription. Currently, it can be one of 'canceled' if the user canceled the subscription, 'active' if the user re-enabled a previously canceled subscription, or 'failed' if payment for the subscription failed."]
pub state: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BotSubscriptionUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.state, output);
}
}
impl BotSubscriptionUpdated {
pub fn new(user: User, invoice_payload: impl Into<String>, state: impl Into<String>) -> Self {
Self {
user,
invoice_payload: invoice_payload.into(),
state: state.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents the rights of a business bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessBotRights {
#[doc = "True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_reply: Option<bool>,
#[doc = "True, if the bot can mark incoming private messages as read"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_read_messages: Option<bool>,
#[doc = "True, if the bot can delete messages sent by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_delete_sent_messages: Option<bool>,
#[doc = "True, if the bot can delete all private messages in managed chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_delete_all_messages: Option<bool>,
#[doc = "True, if the bot can edit the first and last name of the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_name: Option<bool>,
#[doc = "True, if the bot can edit the bio of the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_bio: Option<bool>,
#[doc = "True, if the bot can edit the profile photo of the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_profile_photo: Option<bool>,
#[doc = "True, if the bot can edit the username of the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_username: Option<bool>,
#[doc = "True, if the bot can change the privacy settings pertaining to gifts for the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_change_gift_settings: Option<bool>,
#[doc = "True, if the bot can view gifts and the amount of Telegram Stars owned by the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_view_gifts_and_stars: Option<bool>,
#[doc = "True, if the bot can convert regular gifts owned by the business account to Telegram Stars"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_convert_gifts_to_stars: Option<bool>,
#[doc = "True, if the bot can transfer and upgrade gifts owned by the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_transfer_and_upgrade_gifts: Option<bool>,
#[doc = "True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_transfer_stars: Option<bool>,
#[doc = "True, if the bot can post, edit and delete stories on behalf of the business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_stories: Option<bool>,
#[doc = "True, if the bot can delete messages sent by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_delete_outgoing_messages: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessBotRights {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.can_reply, output);
CollectFiles::collect_files(&self.can_read_messages, output);
CollectFiles::collect_files(&self.can_delete_sent_messages, output);
CollectFiles::collect_files(&self.can_delete_all_messages, output);
CollectFiles::collect_files(&self.can_edit_name, output);
CollectFiles::collect_files(&self.can_edit_bio, output);
CollectFiles::collect_files(&self.can_edit_profile_photo, output);
CollectFiles::collect_files(&self.can_edit_username, output);
CollectFiles::collect_files(&self.can_change_gift_settings, output);
CollectFiles::collect_files(&self.can_view_gifts_and_stars, output);
CollectFiles::collect_files(&self.can_convert_gifts_to_stars, output);
CollectFiles::collect_files(&self.can_transfer_and_upgrade_gifts, output);
CollectFiles::collect_files(&self.can_transfer_stars, output);
CollectFiles::collect_files(&self.can_manage_stories, output);
CollectFiles::collect_files(&self.can_delete_outgoing_messages, output);
}
}
impl BusinessBotRights {
pub fn new() -> Self {
Self {
can_reply: None,
can_read_messages: None,
can_delete_sent_messages: None,
can_delete_all_messages: None,
can_edit_name: None,
can_edit_bio: None,
can_edit_profile_photo: None,
can_edit_username: None,
can_change_gift_settings: None,
can_view_gifts_and_stars: None,
can_convert_gifts_to_stars: None,
can_transfer_and_upgrade_gifts: None,
can_transfer_stars: None,
can_manage_stories: None,
can_delete_outgoing_messages: None,
extra: BTreeMap::new(),
}
}
pub fn can_reply(mut self, value: bool) -> Self {
self.can_reply = Some(value);
self
}
pub fn can_read_messages(mut self, value: bool) -> Self {
self.can_read_messages = Some(value);
self
}
pub fn can_delete_sent_messages(mut self, value: bool) -> Self {
self.can_delete_sent_messages = Some(value);
self
}
pub fn can_delete_all_messages(mut self, value: bool) -> Self {
self.can_delete_all_messages = Some(value);
self
}
pub fn can_edit_name(mut self, value: bool) -> Self {
self.can_edit_name = Some(value);
self
}
pub fn can_edit_bio(mut self, value: bool) -> Self {
self.can_edit_bio = Some(value);
self
}
pub fn can_edit_profile_photo(mut self, value: bool) -> Self {
self.can_edit_profile_photo = Some(value);
self
}
pub fn can_edit_username(mut self, value: bool) -> Self {
self.can_edit_username = Some(value);
self
}
pub fn can_change_gift_settings(mut self, value: bool) -> Self {
self.can_change_gift_settings = Some(value);
self
}
pub fn can_view_gifts_and_stars(mut self, value: bool) -> Self {
self.can_view_gifts_and_stars = Some(value);
self
}
pub fn can_convert_gifts_to_stars(mut self, value: bool) -> Self {
self.can_convert_gifts_to_stars = Some(value);
self
}
pub fn can_transfer_and_upgrade_gifts(mut self, value: bool) -> Self {
self.can_transfer_and_upgrade_gifts = Some(value);
self
}
pub fn can_transfer_stars(mut self, value: bool) -> Self {
self.can_transfer_stars = Some(value);
self
}
pub fn can_manage_stories(mut self, value: bool) -> Self {
self.can_manage_stories = Some(value);
self
}
pub fn can_delete_outgoing_messages(mut self, value: bool) -> Self {
self.can_delete_outgoing_messages = Some(value);
self
}
}
impl Default for BusinessBotRights {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes the connection of the bot with a business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessConnection {
#[doc = "Unique identifier of the business connection"]
pub id: String,
#[doc = "Business account user that created the business connection"]
pub user: User,
#[doc = "Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."]
pub user_chat_id: i64,
#[doc = "Date the connection was established in Unix time"]
pub date: i64,
#[doc = "True, if the connection is active"]
pub is_enabled: bool,
#[doc = "Rights of the business bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rights: Option<BusinessBotRights>,
#[doc = "True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_reply: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessConnection {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.user_chat_id, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.is_enabled, output);
CollectFiles::collect_files(&self.rights, output);
CollectFiles::collect_files(&self.can_reply, output);
}
}
impl BusinessConnection {
pub fn new(
id: impl Into<String>,
user: User,
user_chat_id: i64,
date: i64,
is_enabled: bool,
) -> Self {
Self {
id: id.into(),
user,
user_chat_id,
date,
is_enabled,
rights: None,
can_reply: None,
extra: BTreeMap::new(),
}
}
pub fn rights(mut self, value: BusinessBotRights) -> Self {
self.rights = Some(value);
self
}
pub fn can_reply(mut self, value: bool) -> Self {
self.can_reply = Some(value);
self
}
}
#[doc = "Contains information about the start page settings of a Telegram Business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessIntro {
#[doc = "Title text of the business intro"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Message text of the business intro"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
#[doc = "Sticker of the business intro"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker: Option<Sticker>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessIntro {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.message, output);
CollectFiles::collect_files(&self.sticker, output);
}
}
impl BusinessIntro {
pub fn new() -> Self {
Self {
title: None,
message: None,
sticker: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn message(mut self, value: impl Into<String>) -> Self {
self.message = Some(value.into());
self
}
pub fn sticker(mut self, value: Sticker) -> Self {
self.sticker = Some(value);
self
}
}
impl Default for BusinessIntro {
fn default() -> Self {
Self::new()
}
}
#[doc = "Contains information about the location of a Telegram Business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessLocation {
#[doc = "Address of the business"]
pub address: String,
#[doc = "Location of the business"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessLocation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.address, output);
CollectFiles::collect_files(&self.location, output);
}
}
impl BusinessLocation {
pub fn new(address: impl Into<String>) -> Self {
Self {
address: address.into(),
location: None,
extra: BTreeMap::new(),
}
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
}
#[doc = "This object is received when messages are deleted from a connected business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessMessagesDeleted {
#[doc = "Unique identifier of the business connection"]
pub business_connection_id: String,
#[doc = "Information about a chat in the business account. The bot may not have access to the chat or the corresponding user."]
pub chat: Box<Chat>,
#[doc = "The list of identifiers of deleted messages in the chat of the business account"]
pub message_ids: Vec<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessMessagesDeleted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.business_connection_id, output);
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_ids, output);
}
}
impl BusinessMessagesDeleted {
pub fn new(
business_connection_id: impl Into<String>,
chat: Box<Chat>,
message_ids: Vec<i64>,
) -> Self {
Self {
business_connection_id: business_connection_id.into(),
chat,
message_ids,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes the opening hours of a business."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessOpeningHours {
#[doc = "Unique name of the time zone for which the opening hours are defined"]
pub time_zone_name: String,
#[doc = "List of time intervals describing business opening hours"]
pub opening_hours: Vec<BusinessOpeningHoursInterval>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessOpeningHours {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.time_zone_name, output);
CollectFiles::collect_files(&self.opening_hours, output);
}
}
impl BusinessOpeningHours {
pub fn new(
time_zone_name: impl Into<String>,
opening_hours: Vec<BusinessOpeningHoursInterval>,
) -> Self {
Self {
time_zone_name: time_zone_name.into(),
opening_hours,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes an interval of time during which a business is open."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BusinessOpeningHoursInterval {
#[doc = "The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60"]
pub opening_minute: i64,
#[doc = "The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60"]
pub closing_minute: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for BusinessOpeningHoursInterval {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.opening_minute, output);
CollectFiles::collect_files(&self.closing_minute, output);
}
}
impl BusinessOpeningHoursInterval {
pub fn new(opening_minute: i64, closing_minute: i64) -> Self {
Self {
opening_minute,
closing_minute,
extra: BTreeMap::new(),
}
}
}
#[doc = "A placeholder, currently holds no information. Use BotFather to set up your game."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CallbackGame {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for CallbackGame {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl CallbackGame {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for CallbackGame {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CallbackQuery {
#[doc = "Unique identifier for this query"]
pub id: String,
#[doc = "Sender"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games."]
pub chat_instance: String,
#[doc = "Message sent by the bot with the callback button that originated the query"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<MaybeInaccessibleMessageUnion>,
#[doc = "Identifier of the message sent via the bot in inline mode, that originated the query"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub inline_message_id: Option<String>,
#[doc = "Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
#[doc = "Short name of a Game to be returned, serves as the unique identifier for the game"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub game_short_name: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for CallbackQuery {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.chat_instance, output);
CollectFiles::collect_files(&self.message, output);
CollectFiles::collect_files(&self.inline_message_id, output);
CollectFiles::collect_files(&self.data, output);
CollectFiles::collect_files(&self.game_short_name, output);
}
}
impl CallbackQuery {
pub fn new(id: impl Into<String>, from_user: User, chat_instance: impl Into<String>) -> Self {
Self {
id: id.into(),
from_user,
chat_instance: chat_instance.into(),
message: None,
inline_message_id: None,
data: None,
game_short_name: None,
extra: BTreeMap::new(),
}
}
pub fn message(mut self, value: impl Into<MaybeInaccessibleMessageUnion>) -> Self {
self.message = Some(value.into());
self
}
pub fn inline_message_id(mut self, value: impl Into<String>) -> Self {
self.inline_message_id = Some(value.into());
self
}
pub fn data(mut self, value: impl Into<String>) -> Self {
self.data = Some(value.into());
self
}
pub fn game_short_name(mut self, value: impl Into<String>) -> Self {
self.game_short_name = Some(value.into());
self
}
}
#[doc = "This object represents a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Chat {
#[doc = "Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
pub id: i64,
#[doc = "Type of the chat, can be either 'private', 'group', 'supergroup' or 'channel'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Title, for supergroups, channels and group chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Username, for private chats, supergroups and channels if available"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[doc = "First name of the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[doc = "Last name of the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "True, if the supergroup chat is a forum (has topics enabled)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_forum: Option<bool>,
#[doc = "True, if the chat is the direct messages chat of a channel"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_direct_messages: Option<bool>,
#[doc = "Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub accent_color_id: Option<i64>,
#[doc = "If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub active_usernames: Option<Vec<String>>,
#[doc = "List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub available_reactions: Option<Vec<ReactionTypeUnion>>,
#[doc = "Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub background_custom_emoji_id: Option<String>,
#[doc = "Bio of the other party in a private chat. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bio: Option<String>,
#[doc = "For private chats, the date of birth of the user. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub birthdate: Option<Birthdate>,
#[doc = "For private chats with business accounts, the intro of the business. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_intro: Option<BusinessIntro>,
#[doc = "For private chats with business accounts, the location of the business. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_location: Option<BusinessLocation>,
#[doc = "For private chats with business accounts, the opening hours of the business. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_opening_hours: Option<BusinessOpeningHours>,
#[doc = "True, if the bot can change the group sticker set. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_set_sticker_set: Option<bool>,
#[doc = "For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_emoji_sticker_set_name: Option<String>,
#[doc = "Description, for groups, supergroups and channel chats. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji_status_custom_emoji_id: Option<String>,
#[doc = "Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji_status_expiration_date: Option<i64>,
#[doc = "True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_aggressive_anti_spam_enabled: Option<bool>,
#[doc = "True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_hidden_members: Option<bool>,
#[doc = "True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_private_forwards: Option<bool>,
#[doc = "True, if messages from the chat can't be forwarded to other chats. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_protected_content: Option<bool>,
#[doc = "True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_restricted_voice_and_video_messages: Option<bool>,
#[doc = "True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_visible_history: Option<bool>,
#[doc = "Primary invite link, for groups, supergroups and channel chats. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invite_link: Option<String>,
#[doc = "True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub join_by_request: Option<bool>,
#[doc = "True, if users need to join the supergroup before they can send messages. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub join_to_send_messages: Option<bool>,
#[doc = "Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub linked_chat_id: Option<i64>,
#[doc = "For supergroups, the location to which the supergroup is connected. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<ChatLocation>,
#[doc = "The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_auto_delete_time: Option<i64>,
#[doc = "Default chat member permissions, for groups and supergroups. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub permissions: Option<ChatPermissions>,
#[doc = "For private chats, the personal channel of the user. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub personal_chat: Option<Box<Chat>>,
#[doc = "Chat photo. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<ChatPhoto>,
#[doc = "The most recent pinned message (by sending date). Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pinned_message: Option<Box<Message>>,
#[doc = "Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub profile_accent_color_id: Option<i64>,
#[doc = "Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub profile_background_custom_emoji_id: Option<String>,
#[doc = "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub slow_mode_delay: Option<i64>,
#[doc = "For supergroups, name of group sticker set. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker_set_name: Option<String>,
#[doc = "For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unrestrict_boost_count: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Chat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.username, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.is_forum, output);
CollectFiles::collect_files(&self.is_direct_messages, output);
CollectFiles::collect_files(&self.accent_color_id, output);
CollectFiles::collect_files(&self.active_usernames, output);
CollectFiles::collect_files(&self.available_reactions, output);
CollectFiles::collect_files(&self.background_custom_emoji_id, output);
CollectFiles::collect_files(&self.bio, output);
CollectFiles::collect_files(&self.birthdate, output);
CollectFiles::collect_files(&self.business_intro, output);
CollectFiles::collect_files(&self.business_location, output);
CollectFiles::collect_files(&self.business_opening_hours, output);
CollectFiles::collect_files(&self.can_set_sticker_set, output);
CollectFiles::collect_files(&self.custom_emoji_sticker_set_name, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.emoji_status_custom_emoji_id, output);
CollectFiles::collect_files(&self.emoji_status_expiration_date, output);
CollectFiles::collect_files(&self.has_aggressive_anti_spam_enabled, output);
CollectFiles::collect_files(&self.has_hidden_members, output);
CollectFiles::collect_files(&self.has_private_forwards, output);
CollectFiles::collect_files(&self.has_protected_content, output);
CollectFiles::collect_files(&self.has_restricted_voice_and_video_messages, output);
CollectFiles::collect_files(&self.has_visible_history, output);
CollectFiles::collect_files(&self.invite_link, output);
CollectFiles::collect_files(&self.join_by_request, output);
CollectFiles::collect_files(&self.join_to_send_messages, output);
CollectFiles::collect_files(&self.linked_chat_id, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.message_auto_delete_time, output);
CollectFiles::collect_files(&self.permissions, output);
CollectFiles::collect_files(&self.personal_chat, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.pinned_message, output);
CollectFiles::collect_files(&self.profile_accent_color_id, output);
CollectFiles::collect_files(&self.profile_background_custom_emoji_id, output);
CollectFiles::collect_files(&self.slow_mode_delay, output);
CollectFiles::collect_files(&self.sticker_set_name, output);
CollectFiles::collect_files(&self.unrestrict_boost_count, output);
}
}
impl Chat {
pub fn new(id: i64, kind: impl Into<String>) -> Self {
Self {
id,
kind: kind.into(),
title: None,
username: None,
first_name: None,
last_name: None,
is_forum: None,
is_direct_messages: None,
accent_color_id: None,
active_usernames: None,
available_reactions: None,
background_custom_emoji_id: None,
bio: None,
birthdate: None,
business_intro: None,
business_location: None,
business_opening_hours: None,
can_set_sticker_set: None,
custom_emoji_sticker_set_name: None,
description: None,
emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: None,
has_aggressive_anti_spam_enabled: None,
has_hidden_members: None,
has_private_forwards: None,
has_protected_content: None,
has_restricted_voice_and_video_messages: None,
has_visible_history: None,
invite_link: None,
join_by_request: None,
join_to_send_messages: None,
linked_chat_id: None,
location: None,
message_auto_delete_time: None,
permissions: None,
personal_chat: None,
photo: None,
pinned_message: None,
profile_accent_color_id: None,
profile_background_custom_emoji_id: None,
slow_mode_delay: None,
sticker_set_name: None,
unrestrict_boost_count: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn username(mut self, value: impl Into<String>) -> Self {
self.username = Some(value.into());
self
}
pub fn first_name(mut self, value: impl Into<String>) -> Self {
self.first_name = Some(value.into());
self
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn is_forum(mut self, value: bool) -> Self {
self.is_forum = Some(value);
self
}
pub fn is_direct_messages(mut self, value: bool) -> Self {
self.is_direct_messages = Some(value);
self
}
pub fn accent_color_id(mut self, value: i64) -> Self {
self.accent_color_id = Some(value);
self
}
pub fn active_usernames(mut self, value: Vec<String>) -> Self {
self.active_usernames = Some(value);
self
}
pub fn available_reactions(mut self, value: Vec<ReactionTypeUnion>) -> Self {
self.available_reactions = Some(value);
self
}
pub fn background_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.background_custom_emoji_id = Some(value.into());
self
}
pub fn bio(mut self, value: impl Into<String>) -> Self {
self.bio = Some(value.into());
self
}
pub fn birthdate(mut self, value: Birthdate) -> Self {
self.birthdate = Some(value);
self
}
pub fn business_intro(mut self, value: BusinessIntro) -> Self {
self.business_intro = Some(value);
self
}
pub fn business_location(mut self, value: BusinessLocation) -> Self {
self.business_location = Some(value);
self
}
pub fn business_opening_hours(mut self, value: BusinessOpeningHours) -> Self {
self.business_opening_hours = Some(value);
self
}
pub fn can_set_sticker_set(mut self, value: bool) -> Self {
self.can_set_sticker_set = Some(value);
self
}
pub fn custom_emoji_sticker_set_name(mut self, value: impl Into<String>) -> Self {
self.custom_emoji_sticker_set_name = Some(value.into());
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn emoji_status_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.emoji_status_custom_emoji_id = Some(value.into());
self
}
pub fn emoji_status_expiration_date(mut self, value: i64) -> Self {
self.emoji_status_expiration_date = Some(value);
self
}
pub fn has_aggressive_anti_spam_enabled(mut self, value: bool) -> Self {
self.has_aggressive_anti_spam_enabled = Some(value);
self
}
pub fn has_hidden_members(mut self, value: bool) -> Self {
self.has_hidden_members = Some(value);
self
}
pub fn has_private_forwards(mut self, value: bool) -> Self {
self.has_private_forwards = Some(value);
self
}
pub fn has_protected_content(mut self, value: bool) -> Self {
self.has_protected_content = Some(value);
self
}
pub fn has_restricted_voice_and_video_messages(mut self, value: bool) -> Self {
self.has_restricted_voice_and_video_messages = Some(value);
self
}
pub fn has_visible_history(mut self, value: bool) -> Self {
self.has_visible_history = Some(value);
self
}
pub fn invite_link(mut self, value: impl Into<String>) -> Self {
self.invite_link = Some(value.into());
self
}
pub fn join_by_request(mut self, value: bool) -> Self {
self.join_by_request = Some(value);
self
}
pub fn join_to_send_messages(mut self, value: bool) -> Self {
self.join_to_send_messages = Some(value);
self
}
pub fn linked_chat_id(mut self, value: i64) -> Self {
self.linked_chat_id = Some(value);
self
}
pub fn location(mut self, value: ChatLocation) -> Self {
self.location = Some(value);
self
}
pub fn message_auto_delete_time(mut self, value: i64) -> Self {
self.message_auto_delete_time = Some(value);
self
}
pub fn permissions(mut self, value: ChatPermissions) -> Self {
self.permissions = Some(value);
self
}
pub fn personal_chat(mut self, value: Box<Chat>) -> Self {
self.personal_chat = Some(value);
self
}
pub fn photo(mut self, value: ChatPhoto) -> Self {
self.photo = Some(value);
self
}
pub fn pinned_message(mut self, value: Box<Message>) -> Self {
self.pinned_message = Some(value);
self
}
pub fn profile_accent_color_id(mut self, value: i64) -> Self {
self.profile_accent_color_id = Some(value);
self
}
pub fn profile_background_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.profile_background_custom_emoji_id = Some(value.into());
self
}
pub fn slow_mode_delay(mut self, value: i64) -> Self {
self.slow_mode_delay = Some(value);
self
}
pub fn sticker_set_name(mut self, value: impl Into<String>) -> Self {
self.sticker_set_name = Some(value.into());
self
}
pub fn unrestrict_boost_count(mut self, value: i64) -> Self {
self.unrestrict_boost_count = Some(value);
self
}
}
#[doc = "Represents the rights of an administrator in a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatAdministratorRights {
#[doc = "True, if the user's presence in the chat is hidden"]
pub is_anonymous: bool,
#[doc = "True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege."]
pub can_manage_chat: bool,
#[doc = "True, if the administrator can delete messages of other users"]
pub can_delete_messages: bool,
#[doc = "True, if the administrator can manage video chats"]
pub can_manage_video_chats: bool,
#[doc = "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics"]
pub can_restrict_members: bool,
#[doc = "True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)"]
pub can_promote_members: bool,
#[doc = "True, if the user is allowed to change the chat title, photo and other settings"]
pub can_change_info: bool,
#[doc = "True, if the user is allowed to invite new users to the chat"]
pub can_invite_users: bool,
#[doc = "True, if the administrator can post stories to the chat"]
pub can_post_stories: bool,
#[doc = "True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"]
pub can_edit_stories: bool,
#[doc = "True, if the administrator can delete stories posted by other users"]
pub can_delete_stories: bool,
#[doc = "True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_post_messages: Option<bool>,
#[doc = "True, if the administrator can edit messages of other users and can pin messages; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_messages: Option<bool>,
#[doc = "True, if the user is allowed to pin messages; for groups and supergroups only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_pin_messages: Option<bool>,
#[doc = "True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_topics: Option<bool>,
#[doc = "True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_direct_messages: Option<bool>,
#[doc = "True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_tags: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatAdministratorRights {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.is_anonymous, output);
CollectFiles::collect_files(&self.can_manage_chat, output);
CollectFiles::collect_files(&self.can_delete_messages, output);
CollectFiles::collect_files(&self.can_manage_video_chats, output);
CollectFiles::collect_files(&self.can_restrict_members, output);
CollectFiles::collect_files(&self.can_promote_members, output);
CollectFiles::collect_files(&self.can_change_info, output);
CollectFiles::collect_files(&self.can_invite_users, output);
CollectFiles::collect_files(&self.can_post_stories, output);
CollectFiles::collect_files(&self.can_edit_stories, output);
CollectFiles::collect_files(&self.can_delete_stories, output);
CollectFiles::collect_files(&self.can_post_messages, output);
CollectFiles::collect_files(&self.can_edit_messages, output);
CollectFiles::collect_files(&self.can_pin_messages, output);
CollectFiles::collect_files(&self.can_manage_topics, output);
CollectFiles::collect_files(&self.can_manage_direct_messages, output);
CollectFiles::collect_files(&self.can_manage_tags, output);
}
}
impl ChatAdministratorRights {
pub fn new(
is_anonymous: bool,
can_manage_chat: bool,
can_delete_messages: bool,
can_manage_video_chats: bool,
can_restrict_members: bool,
can_promote_members: bool,
can_change_info: bool,
can_invite_users: bool,
can_post_stories: bool,
can_edit_stories: bool,
can_delete_stories: bool,
) -> Self {
Self {
is_anonymous,
can_manage_chat,
can_delete_messages,
can_manage_video_chats,
can_restrict_members,
can_promote_members,
can_change_info,
can_invite_users,
can_post_stories,
can_edit_stories,
can_delete_stories,
can_post_messages: None,
can_edit_messages: None,
can_pin_messages: None,
can_manage_topics: None,
can_manage_direct_messages: None,
can_manage_tags: None,
extra: BTreeMap::new(),
}
}
pub fn can_post_messages(mut self, value: bool) -> Self {
self.can_post_messages = Some(value);
self
}
pub fn can_edit_messages(mut self, value: bool) -> Self {
self.can_edit_messages = Some(value);
self
}
pub fn can_pin_messages(mut self, value: bool) -> Self {
self.can_pin_messages = Some(value);
self
}
pub fn can_manage_topics(mut self, value: bool) -> Self {
self.can_manage_topics = Some(value);
self
}
pub fn can_manage_direct_messages(mut self, value: bool) -> Self {
self.can_manage_direct_messages = Some(value);
self
}
pub fn can_manage_tags(mut self, value: bool) -> Self {
self.can_manage_tags = Some(value);
self
}
}
#[doc = "This object represents a chat background."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBackground {
#[doc = "Type of the background"]
#[serde(rename = "type")]
pub kind: BackgroundTypeUnion,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBackground {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl ChatBackground {
pub fn new(kind: impl Into<BackgroundTypeUnion>) -> Self {
Self {
kind: kind.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about a chat boost."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoost {
#[doc = "Unique identifier of the boost"]
pub boost_id: String,
#[doc = "Point in time (Unix timestamp) when the chat was boosted"]
pub add_date: i64,
#[doc = "Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged"]
pub expiration_date: i64,
#[doc = "Source of the added boost"]
pub source: ChatBoostSourceUnion,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoost {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.boost_id, output);
CollectFiles::collect_files(&self.add_date, output);
CollectFiles::collect_files(&self.expiration_date, output);
CollectFiles::collect_files(&self.source, output);
}
}
impl ChatBoost {
pub fn new(
boost_id: impl Into<String>,
add_date: i64,
expiration_date: i64,
source: impl Into<ChatBoostSourceUnion>,
) -> Self {
Self {
boost_id: boost_id.into(),
add_date,
expiration_date,
source: source.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a service message about a user boosting a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostAdded {
#[doc = "Number of boosts added by the user"]
pub boost_count: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostAdded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.boost_count, output);
}
}
impl ChatBoostAdded {
pub fn new(boost_count: i64) -> Self {
Self {
boost_count,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a boost removed from a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostRemoved {
#[doc = "Chat which was boosted"]
pub chat: Box<Chat>,
#[doc = "Unique identifier of the boost"]
pub boost_id: String,
#[doc = "Point in time (Unix timestamp) when the boost was removed"]
pub remove_date: i64,
#[doc = "Source of the removed boost"]
pub source: ChatBoostSourceUnion,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostRemoved {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.boost_id, output);
CollectFiles::collect_files(&self.remove_date, output);
CollectFiles::collect_files(&self.source, output);
}
}
impl ChatBoostRemoved {
pub fn new(
chat: Box<Chat>,
boost_id: impl Into<String>,
remove_date: i64,
source: impl Into<ChatBoostSourceUnion>,
) -> Self {
Self {
chat,
boost_id: boost_id.into(),
remove_date,
source: source.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the source of a chat boost. It can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostSource {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostSource {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl ChatBoostSource {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for ChatBoostSource {
fn default() -> Self {
Self::new()
}
}
#[doc = "The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostSourceGiftCode {
#[doc = "Source of the boost, always 'gift_code'"]
pub source: String,
#[doc = "User for which the gift code was created"]
pub user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostSourceGiftCode {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl ChatBoostSourceGiftCode {
pub fn new(user: User) -> Self {
Self {
source: "gift_code".to_owned(),
user,
extra: BTreeMap::new(),
}
}
}
#[doc = "The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostSourceGiveaway {
#[doc = "Source of the boost, always 'giveaway'"]
pub source: String,
#[doc = "Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet."]
pub giveaway_message_id: i64,
#[doc = "User that won the prize in the giveaway if any; for Telegram Premium giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
#[doc = "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
#[doc = "True, if the giveaway was completed, but there was no user to win the prize"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_unclaimed: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostSourceGiveaway {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.giveaway_message_id, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.prize_star_count, output);
CollectFiles::collect_files(&self.is_unclaimed, output);
}
}
impl ChatBoostSourceGiveaway {
pub fn new(giveaway_message_id: i64) -> Self {
Self {
source: "giveaway".to_owned(),
giveaway_message_id,
user: None,
prize_star_count: None,
is_unclaimed: None,
extra: BTreeMap::new(),
}
}
pub fn user(mut self, value: User) -> Self {
self.user = Some(value);
self
}
pub fn prize_star_count(mut self, value: i64) -> Self {
self.prize_star_count = Some(value);
self
}
pub fn is_unclaimed(mut self, value: bool) -> Self {
self.is_unclaimed = Some(value);
self
}
}
#[doc = "The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostSourcePremium {
#[doc = "Source of the boost, always 'premium'"]
pub source: String,
#[doc = "User that boosted the chat"]
pub user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostSourcePremium {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl ChatBoostSourcePremium {
pub fn new(user: User) -> Self {
Self {
source: "premium".to_owned(),
user,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a boost added to a chat or changed."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatBoostUpdated {
#[doc = "Chat which was boosted"]
pub chat: Box<Chat>,
#[doc = "Information about the chat boost"]
pub boost: ChatBoost,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatBoostUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.boost, output);
}
}
impl ChatBoostUpdated {
pub fn new(chat: Box<Chat>, boost: ChatBoost) -> Self {
Self {
chat,
boost,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains full information about a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatFullInfo {
#[doc = "Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
pub id: i64,
#[doc = "Type of the chat, can be either 'private', 'group', 'supergroup' or 'channel'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details."]
pub accent_color_id: i64,
#[doc = "The maximum number of reactions that can be set on a message in the chat"]
pub max_reaction_count: i64,
#[doc = "Information about types of gifts that are accepted by the chat or by the corresponding user for private chats"]
pub accepted_gift_types: AcceptedGiftTypes,
#[doc = "Title, for supergroups, channels and group chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Username, for private chats, supergroups and channels if available"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[doc = "First name of the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[doc = "Last name of the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "True, if the supergroup chat is a forum (has topics enabled)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_forum: Option<bool>,
#[doc = "True, if the chat is the direct messages chat of a channel"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_direct_messages: Option<bool>,
#[doc = "Chat photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<ChatPhoto>,
#[doc = "If non-empty, the list of all active chat usernames; for private chats, supergroups and channels"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub active_usernames: Option<Vec<String>>,
#[doc = "For private chats, the date of birth of the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub birthdate: Option<Birthdate>,
#[doc = "For private chats with business accounts, the intro of the business"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_intro: Option<BusinessIntro>,
#[doc = "For private chats with business accounts, the location of the business"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_location: Option<BusinessLocation>,
#[doc = "For private chats with business accounts, the opening hours of the business"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_opening_hours: Option<BusinessOpeningHours>,
#[doc = "For private chats, the personal channel of the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub personal_chat: Option<Box<Chat>>,
#[doc = "Information about the corresponding channel chat; for direct messages chats only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parent_chat: Option<Box<Chat>>,
#[doc = "List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub available_reactions: Option<Vec<ReactionTypeUnion>>,
#[doc = "Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub background_custom_emoji_id: Option<String>,
#[doc = "Identifier of the accent color for the chat's profile background. See profile accent colors for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub profile_accent_color_id: Option<i64>,
#[doc = "Custom emoji identifier of the emoji chosen by the chat for its profile background"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub profile_background_custom_emoji_id: Option<String>,
#[doc = "Custom emoji identifier of the emoji status of the chat or the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji_status_custom_emoji_id: Option<String>,
#[doc = "Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji_status_expiration_date: Option<i64>,
#[doc = "Bio of the other party in a private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bio: Option<String>,
#[doc = "True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_private_forwards: Option<bool>,
#[doc = "True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_restricted_voice_and_video_messages: Option<bool>,
#[doc = "True, if users need to join the supergroup before they can send messages"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub join_to_send_messages: Option<bool>,
#[doc = "True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub join_by_request: Option<bool>,
#[doc = "Description, for groups, supergroups and channel chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Primary invite link, for groups, supergroups and channel chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invite_link: Option<String>,
#[doc = "The most recent pinned message (by sending date)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pinned_message: Option<Box<Message>>,
#[doc = "Default chat member permissions, for groups and supergroups"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub permissions: Option<ChatPermissions>,
#[doc = "True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_paid_media: Option<bool>,
#[doc = "For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub slow_mode_delay: Option<i64>,
#[doc = "For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unrestrict_boost_count: Option<i64>,
#[doc = "The time after which all messages sent to the chat will be automatically deleted; in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_auto_delete_time: Option<i64>,
#[doc = "True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_aggressive_anti_spam_enabled: Option<bool>,
#[doc = "True, if non-administrators can only get the list of bots and administrators in the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_hidden_members: Option<bool>,
#[doc = "True, if messages from the chat can't be forwarded to other chats"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_protected_content: Option<bool>,
#[doc = "True, if new chat members will have access to old messages; available only to chat administrators"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_visible_history: Option<bool>,
#[doc = "For supergroups, name of the group sticker set"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker_set_name: Option<String>,
#[doc = "True, if the bot can change the group sticker set"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_set_sticker_set: Option<bool>,
#[doc = "For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_emoji_sticker_set_name: Option<String>,
#[doc = "Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub linked_chat_id: Option<i64>,
#[doc = "For supergroups, the location to which the supergroup is connected"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<ChatLocation>,
#[doc = "For private chats, the rating of the user if any"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rating: Option<UserRating>,
#[doc = "For private chats, the first audio added to the profile of the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub first_profile_audio: Option<Audio>,
#[doc = "The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unique_gift_colors: Option<UniqueGiftColors>,
#[doc = "The number of Telegram Stars a general user has to pay to send a message to the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_message_star_count: Option<i64>,
#[doc = "The bot that processes join request queries in the chat. The field is only available to chat administrators."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guard_bot: Option<User>,
#[doc = "The Community to which the chat belongs"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub community: Option<Community>,
#[doc = "True, if gifts can be sent to the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_gift: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatFullInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.accent_color_id, output);
CollectFiles::collect_files(&self.max_reaction_count, output);
CollectFiles::collect_files(&self.accepted_gift_types, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.username, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.is_forum, output);
CollectFiles::collect_files(&self.is_direct_messages, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.active_usernames, output);
CollectFiles::collect_files(&self.birthdate, output);
CollectFiles::collect_files(&self.business_intro, output);
CollectFiles::collect_files(&self.business_location, output);
CollectFiles::collect_files(&self.business_opening_hours, output);
CollectFiles::collect_files(&self.personal_chat, output);
CollectFiles::collect_files(&self.parent_chat, output);
CollectFiles::collect_files(&self.available_reactions, output);
CollectFiles::collect_files(&self.background_custom_emoji_id, output);
CollectFiles::collect_files(&self.profile_accent_color_id, output);
CollectFiles::collect_files(&self.profile_background_custom_emoji_id, output);
CollectFiles::collect_files(&self.emoji_status_custom_emoji_id, output);
CollectFiles::collect_files(&self.emoji_status_expiration_date, output);
CollectFiles::collect_files(&self.bio, output);
CollectFiles::collect_files(&self.has_private_forwards, output);
CollectFiles::collect_files(&self.has_restricted_voice_and_video_messages, output);
CollectFiles::collect_files(&self.join_to_send_messages, output);
CollectFiles::collect_files(&self.join_by_request, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.invite_link, output);
CollectFiles::collect_files(&self.pinned_message, output);
CollectFiles::collect_files(&self.permissions, output);
CollectFiles::collect_files(&self.can_send_paid_media, output);
CollectFiles::collect_files(&self.slow_mode_delay, output);
CollectFiles::collect_files(&self.unrestrict_boost_count, output);
CollectFiles::collect_files(&self.message_auto_delete_time, output);
CollectFiles::collect_files(&self.has_aggressive_anti_spam_enabled, output);
CollectFiles::collect_files(&self.has_hidden_members, output);
CollectFiles::collect_files(&self.has_protected_content, output);
CollectFiles::collect_files(&self.has_visible_history, output);
CollectFiles::collect_files(&self.sticker_set_name, output);
CollectFiles::collect_files(&self.can_set_sticker_set, output);
CollectFiles::collect_files(&self.custom_emoji_sticker_set_name, output);
CollectFiles::collect_files(&self.linked_chat_id, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.rating, output);
CollectFiles::collect_files(&self.first_profile_audio, output);
CollectFiles::collect_files(&self.unique_gift_colors, output);
CollectFiles::collect_files(&self.paid_message_star_count, output);
CollectFiles::collect_files(&self.guard_bot, output);
CollectFiles::collect_files(&self.community, output);
CollectFiles::collect_files(&self.can_send_gift, output);
}
}
impl ChatFullInfo {
pub fn new(
id: i64,
kind: impl Into<String>,
accent_color_id: i64,
max_reaction_count: i64,
accepted_gift_types: AcceptedGiftTypes,
) -> Self {
Self {
id,
kind: kind.into(),
accent_color_id,
max_reaction_count,
accepted_gift_types,
title: None,
username: None,
first_name: None,
last_name: None,
is_forum: None,
is_direct_messages: None,
photo: None,
active_usernames: None,
birthdate: None,
business_intro: None,
business_location: None,
business_opening_hours: None,
personal_chat: None,
parent_chat: None,
available_reactions: None,
background_custom_emoji_id: None,
profile_accent_color_id: None,
profile_background_custom_emoji_id: None,
emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: None,
bio: None,
has_private_forwards: None,
has_restricted_voice_and_video_messages: None,
join_to_send_messages: None,
join_by_request: None,
description: None,
invite_link: None,
pinned_message: None,
permissions: None,
can_send_paid_media: None,
slow_mode_delay: None,
unrestrict_boost_count: None,
message_auto_delete_time: None,
has_aggressive_anti_spam_enabled: None,
has_hidden_members: None,
has_protected_content: None,
has_visible_history: None,
sticker_set_name: None,
can_set_sticker_set: None,
custom_emoji_sticker_set_name: None,
linked_chat_id: None,
location: None,
rating: None,
first_profile_audio: None,
unique_gift_colors: None,
paid_message_star_count: None,
guard_bot: None,
community: None,
can_send_gift: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn username(mut self, value: impl Into<String>) -> Self {
self.username = Some(value.into());
self
}
pub fn first_name(mut self, value: impl Into<String>) -> Self {
self.first_name = Some(value.into());
self
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn is_forum(mut self, value: bool) -> Self {
self.is_forum = Some(value);
self
}
pub fn is_direct_messages(mut self, value: bool) -> Self {
self.is_direct_messages = Some(value);
self
}
pub fn photo(mut self, value: ChatPhoto) -> Self {
self.photo = Some(value);
self
}
pub fn active_usernames(mut self, value: Vec<String>) -> Self {
self.active_usernames = Some(value);
self
}
pub fn birthdate(mut self, value: Birthdate) -> Self {
self.birthdate = Some(value);
self
}
pub fn business_intro(mut self, value: BusinessIntro) -> Self {
self.business_intro = Some(value);
self
}
pub fn business_location(mut self, value: BusinessLocation) -> Self {
self.business_location = Some(value);
self
}
pub fn business_opening_hours(mut self, value: BusinessOpeningHours) -> Self {
self.business_opening_hours = Some(value);
self
}
pub fn personal_chat(mut self, value: Box<Chat>) -> Self {
self.personal_chat = Some(value);
self
}
pub fn parent_chat(mut self, value: Box<Chat>) -> Self {
self.parent_chat = Some(value);
self
}
pub fn available_reactions(mut self, value: Vec<ReactionTypeUnion>) -> Self {
self.available_reactions = Some(value);
self
}
pub fn background_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.background_custom_emoji_id = Some(value.into());
self
}
pub fn profile_accent_color_id(mut self, value: i64) -> Self {
self.profile_accent_color_id = Some(value);
self
}
pub fn profile_background_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.profile_background_custom_emoji_id = Some(value.into());
self
}
pub fn emoji_status_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.emoji_status_custom_emoji_id = Some(value.into());
self
}
pub fn emoji_status_expiration_date(mut self, value: i64) -> Self {
self.emoji_status_expiration_date = Some(value);
self
}
pub fn bio(mut self, value: impl Into<String>) -> Self {
self.bio = Some(value.into());
self
}
pub fn has_private_forwards(mut self, value: bool) -> Self {
self.has_private_forwards = Some(value);
self
}
pub fn has_restricted_voice_and_video_messages(mut self, value: bool) -> Self {
self.has_restricted_voice_and_video_messages = Some(value);
self
}
pub fn join_to_send_messages(mut self, value: bool) -> Self {
self.join_to_send_messages = Some(value);
self
}
pub fn join_by_request(mut self, value: bool) -> Self {
self.join_by_request = Some(value);
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn invite_link(mut self, value: impl Into<String>) -> Self {
self.invite_link = Some(value.into());
self
}
pub fn pinned_message(mut self, value: Box<Message>) -> Self {
self.pinned_message = Some(value);
self
}
pub fn permissions(mut self, value: ChatPermissions) -> Self {
self.permissions = Some(value);
self
}
pub fn can_send_paid_media(mut self, value: bool) -> Self {
self.can_send_paid_media = Some(value);
self
}
pub fn slow_mode_delay(mut self, value: i64) -> Self {
self.slow_mode_delay = Some(value);
self
}
pub fn unrestrict_boost_count(mut self, value: i64) -> Self {
self.unrestrict_boost_count = Some(value);
self
}
pub fn message_auto_delete_time(mut self, value: i64) -> Self {
self.message_auto_delete_time = Some(value);
self
}
pub fn has_aggressive_anti_spam_enabled(mut self, value: bool) -> Self {
self.has_aggressive_anti_spam_enabled = Some(value);
self
}
pub fn has_hidden_members(mut self, value: bool) -> Self {
self.has_hidden_members = Some(value);
self
}
pub fn has_protected_content(mut self, value: bool) -> Self {
self.has_protected_content = Some(value);
self
}
pub fn has_visible_history(mut self, value: bool) -> Self {
self.has_visible_history = Some(value);
self
}
pub fn sticker_set_name(mut self, value: impl Into<String>) -> Self {
self.sticker_set_name = Some(value.into());
self
}
pub fn can_set_sticker_set(mut self, value: bool) -> Self {
self.can_set_sticker_set = Some(value);
self
}
pub fn custom_emoji_sticker_set_name(mut self, value: impl Into<String>) -> Self {
self.custom_emoji_sticker_set_name = Some(value.into());
self
}
pub fn linked_chat_id(mut self, value: i64) -> Self {
self.linked_chat_id = Some(value);
self
}
pub fn location(mut self, value: ChatLocation) -> Self {
self.location = Some(value);
self
}
pub fn rating(mut self, value: UserRating) -> Self {
self.rating = Some(value);
self
}
pub fn first_profile_audio(mut self, value: Audio) -> Self {
self.first_profile_audio = Some(value);
self
}
pub fn unique_gift_colors(mut self, value: UniqueGiftColors) -> Self {
self.unique_gift_colors = Some(value);
self
}
pub fn paid_message_star_count(mut self, value: i64) -> Self {
self.paid_message_star_count = Some(value);
self
}
pub fn guard_bot(mut self, value: User) -> Self {
self.guard_bot = Some(value);
self
}
pub fn community(mut self, value: Community) -> Self {
self.community = Some(value);
self
}
pub fn can_send_gift(mut self, value: bool) -> Self {
self.can_send_gift = Some(value);
self
}
}
#[doc = "Represents an invite link for a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatInviteLink {
#[doc = "The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with '…'."]
pub invite_link: String,
#[doc = "Creator of the link"]
pub creator: User,
#[doc = "True, if users joining the chat via the link need to be approved by chat administrators"]
pub creates_join_request: bool,
#[doc = "True, if the link is primary"]
pub is_primary: bool,
#[doc = "True, if the link is revoked"]
pub is_revoked: bool,
#[doc = "Invite link name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "Point in time (Unix timestamp) when the link will expire or has been expired"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub expire_date: Option<i64>,
#[doc = "The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub member_limit: Option<i64>,
#[doc = "Number of pending join requests created using this link"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pending_join_request_count: Option<i64>,
#[doc = "The number of seconds the subscription will be active for before the next payment"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_period: Option<i64>,
#[doc = "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_price: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatInviteLink {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.invite_link, output);
CollectFiles::collect_files(&self.creator, output);
CollectFiles::collect_files(&self.creates_join_request, output);
CollectFiles::collect_files(&self.is_primary, output);
CollectFiles::collect_files(&self.is_revoked, output);
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.expire_date, output);
CollectFiles::collect_files(&self.member_limit, output);
CollectFiles::collect_files(&self.pending_join_request_count, output);
CollectFiles::collect_files(&self.subscription_period, output);
CollectFiles::collect_files(&self.subscription_price, output);
}
}
impl ChatInviteLink {
pub fn new(
invite_link: impl Into<String>,
creator: User,
creates_join_request: bool,
is_primary: bool,
is_revoked: bool,
) -> Self {
Self {
invite_link: invite_link.into(),
creator,
creates_join_request,
is_primary,
is_revoked,
name: None,
expire_date: None,
member_limit: None,
pending_join_request_count: None,
subscription_period: None,
subscription_price: None,
extra: BTreeMap::new(),
}
}
pub fn name(mut self, value: impl Into<String>) -> Self {
self.name = Some(value.into());
self
}
pub fn expire_date(mut self, value: i64) -> Self {
self.expire_date = Some(value);
self
}
pub fn member_limit(mut self, value: i64) -> Self {
self.member_limit = Some(value);
self
}
pub fn pending_join_request_count(mut self, value: i64) -> Self {
self.pending_join_request_count = Some(value);
self
}
pub fn subscription_period(mut self, value: i64) -> Self {
self.subscription_period = Some(value);
self
}
pub fn subscription_price(mut self, value: i64) -> Self {
self.subscription_price = Some(value);
self
}
}
#[doc = "Represents a join request sent to a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatJoinRequest {
#[doc = "Chat to which the request was sent"]
pub chat: Box<Chat>,
#[doc = "User that sent the join request"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user."]
pub user_chat_id: i64,
#[doc = "Date the request was sent in Unix time"]
pub date: i64,
#[doc = "Bio of the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bio: Option<String>,
#[doc = "Chat invite link that was used by the user to send the join request"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invite_link: Option<ChatInviteLink>,
#[doc = "Identifier of the join request query; for bots assigned to process join requests only. If present, then the bot must call sendChatJoinRequestWebApp or directly call answerChatJoinRequestQuery within 10 seconds."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub query_id: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatJoinRequest {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.user_chat_id, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.bio, output);
CollectFiles::collect_files(&self.invite_link, output);
CollectFiles::collect_files(&self.query_id, output);
}
}
impl ChatJoinRequest {
pub fn new(chat: Box<Chat>, from_user: User, user_chat_id: i64, date: i64) -> Self {
Self {
chat,
from_user,
user_chat_id,
date,
bio: None,
invite_link: None,
query_id: None,
extra: BTreeMap::new(),
}
}
pub fn bio(mut self, value: impl Into<String>) -> Self {
self.bio = Some(value.into());
self
}
pub fn invite_link(mut self, value: ChatInviteLink) -> Self {
self.invite_link = Some(value);
self
}
pub fn query_id(mut self, value: impl Into<String>) -> Self {
self.query_id = Some(value.into());
self
}
}
#[doc = "Represents a location to which a chat is connected."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatLocation {
#[doc = "The location to which the supergroup is connected. Can't be a live location."]
pub location: Location,
#[doc = "Location address; 1-64 characters, as defined by the chat owner"]
pub address: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatLocation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.address, output);
}
}
impl ChatLocation {
pub fn new(location: Location, address: impl Into<String>) -> Self {
Self {
location,
address: address.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMember {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMember {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl ChatMember {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for ChatMember {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents a chat member that has some additional privileges."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberAdministrator {
#[doc = "The member's status in the chat, always 'administrator'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "True, if the bot is allowed to edit administrator privileges of that user"]
pub can_be_edited: bool,
#[doc = "True, if the user's presence in the chat is hidden"]
pub is_anonymous: bool,
#[doc = "True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege."]
pub can_manage_chat: bool,
#[doc = "True, if the administrator can delete messages of other users"]
pub can_delete_messages: bool,
#[doc = "True, if the administrator can manage video chats"]
pub can_manage_video_chats: bool,
#[doc = "True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics"]
pub can_restrict_members: bool,
#[doc = "True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)"]
pub can_promote_members: bool,
#[doc = "True, if the user is allowed to change the chat title, photo and other settings"]
pub can_change_info: bool,
#[doc = "True, if the user is allowed to invite new users to the chat"]
pub can_invite_users: bool,
#[doc = "True, if the administrator can post stories to the chat"]
pub can_post_stories: bool,
#[doc = "True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"]
pub can_edit_stories: bool,
#[doc = "True, if the administrator can delete stories posted by other users"]
pub can_delete_stories: bool,
#[doc = "True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_post_messages: Option<bool>,
#[doc = "True, if the administrator can edit messages of other users and can pin messages; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_messages: Option<bool>,
#[doc = "True, if the user is allowed to pin messages; for groups and supergroups only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_pin_messages: Option<bool>,
#[doc = "True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_topics: Option<bool>,
#[doc = "True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_direct_messages: Option<bool>,
#[doc = "True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_tags: Option<bool>,
#[doc = "Custom title for this user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_title: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberAdministrator {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.can_be_edited, output);
CollectFiles::collect_files(&self.is_anonymous, output);
CollectFiles::collect_files(&self.can_manage_chat, output);
CollectFiles::collect_files(&self.can_delete_messages, output);
CollectFiles::collect_files(&self.can_manage_video_chats, output);
CollectFiles::collect_files(&self.can_restrict_members, output);
CollectFiles::collect_files(&self.can_promote_members, output);
CollectFiles::collect_files(&self.can_change_info, output);
CollectFiles::collect_files(&self.can_invite_users, output);
CollectFiles::collect_files(&self.can_post_stories, output);
CollectFiles::collect_files(&self.can_edit_stories, output);
CollectFiles::collect_files(&self.can_delete_stories, output);
CollectFiles::collect_files(&self.can_post_messages, output);
CollectFiles::collect_files(&self.can_edit_messages, output);
CollectFiles::collect_files(&self.can_pin_messages, output);
CollectFiles::collect_files(&self.can_manage_topics, output);
CollectFiles::collect_files(&self.can_manage_direct_messages, output);
CollectFiles::collect_files(&self.can_manage_tags, output);
CollectFiles::collect_files(&self.custom_title, output);
}
}
impl ChatMemberAdministrator {
pub fn new(
user: User,
can_be_edited: bool,
is_anonymous: bool,
can_manage_chat: bool,
can_delete_messages: bool,
can_manage_video_chats: bool,
can_restrict_members: bool,
can_promote_members: bool,
can_change_info: bool,
can_invite_users: bool,
can_post_stories: bool,
can_edit_stories: bool,
can_delete_stories: bool,
) -> Self {
Self {
status: "administrator".to_owned(),
user,
can_be_edited,
is_anonymous,
can_manage_chat,
can_delete_messages,
can_manage_video_chats,
can_restrict_members,
can_promote_members,
can_change_info,
can_invite_users,
can_post_stories,
can_edit_stories,
can_delete_stories,
can_post_messages: None,
can_edit_messages: None,
can_pin_messages: None,
can_manage_topics: None,
can_manage_direct_messages: None,
can_manage_tags: None,
custom_title: None,
extra: BTreeMap::new(),
}
}
pub fn can_post_messages(mut self, value: bool) -> Self {
self.can_post_messages = Some(value);
self
}
pub fn can_edit_messages(mut self, value: bool) -> Self {
self.can_edit_messages = Some(value);
self
}
pub fn can_pin_messages(mut self, value: bool) -> Self {
self.can_pin_messages = Some(value);
self
}
pub fn can_manage_topics(mut self, value: bool) -> Self {
self.can_manage_topics = Some(value);
self
}
pub fn can_manage_direct_messages(mut self, value: bool) -> Self {
self.can_manage_direct_messages = Some(value);
self
}
pub fn can_manage_tags(mut self, value: bool) -> Self {
self.can_manage_tags = Some(value);
self
}
pub fn custom_title(mut self, value: impl Into<String>) -> Self {
self.custom_title = Some(value.into());
self
}
}
#[doc = "Represents a chat member that was banned in the chat and can't return to the chat or view chat messages."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberBanned {
#[doc = "The member's status in the chat, always 'kicked'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever."]
pub until_date: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberBanned {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.until_date, output);
}
}
impl ChatMemberBanned {
pub fn new(user: User, until_date: i64) -> Self {
Self {
status: "kicked".to_owned(),
user,
until_date,
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents a chat member that isn't currently a member of the chat, but may join it themselves."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberLeft {
#[doc = "The member's status in the chat, always 'left'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberLeft {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl ChatMemberLeft {
pub fn new(user: User) -> Self {
Self {
status: "left".to_owned(),
user,
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents a chat member that has no additional privileges or restrictions."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberMember {
#[doc = "The member's status in the chat, always 'member'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "Tag of the member"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tag: Option<String>,
#[doc = "Date when the user's subscription will expire; Unix time"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub until_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberMember {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.tag, output);
CollectFiles::collect_files(&self.until_date, output);
}
}
impl ChatMemberMember {
pub fn new(user: User) -> Self {
Self {
status: "member".to_owned(),
user,
tag: None,
until_date: None,
extra: BTreeMap::new(),
}
}
pub fn tag(mut self, value: impl Into<String>) -> Self {
self.tag = Some(value.into());
self
}
pub fn until_date(mut self, value: i64) -> Self {
self.until_date = Some(value);
self
}
}
#[doc = "Represents a chat member that owns the chat and has all administrator privileges."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberOwner {
#[doc = "The member's status in the chat, always 'creator'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "True, if the user's presence in the chat is hidden"]
pub is_anonymous: bool,
#[doc = "Custom title for this user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_title: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberOwner {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.is_anonymous, output);
CollectFiles::collect_files(&self.custom_title, output);
}
}
impl ChatMemberOwner {
pub fn new(user: User, is_anonymous: bool) -> Self {
Self {
status: "creator".to_owned(),
user,
is_anonymous,
custom_title: None,
extra: BTreeMap::new(),
}
}
pub fn custom_title(mut self, value: impl Into<String>) -> Self {
self.custom_title = Some(value.into());
self
}
}
#[doc = "Represents a chat member that is under certain restrictions in the chat. Supergroups only."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberRestricted {
#[doc = "The member's status in the chat, always 'restricted'"]
pub status: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "True, if the user is a member of the chat at the moment of the request"]
pub is_member: bool,
#[doc = "True, if the user is allowed to send text messages, rich messages, contacts, giveaways, giveaway winners, invoices, locations and venues"]
pub can_send_messages: bool,
#[doc = "True, if the user is allowed to send audios"]
pub can_send_audios: bool,
#[doc = "True, if the user is allowed to send documents"]
pub can_send_documents: bool,
#[doc = "True, if the user is allowed to send photos"]
pub can_send_photos: bool,
#[doc = "True, if the user is allowed to send videos"]
pub can_send_videos: bool,
#[doc = "True, if the user is allowed to send video notes"]
pub can_send_video_notes: bool,
#[doc = "True, if the user is allowed to send voice notes"]
pub can_send_voice_notes: bool,
#[doc = "True, if the user is allowed to send polls and checklists"]
pub can_send_polls: bool,
#[doc = "True, if the user is allowed to send animations, games, stickers and use inline bots"]
pub can_send_other_messages: bool,
#[doc = "True, if the user is allowed to add web page previews to their messages"]
pub can_add_web_page_previews: bool,
#[doc = "True, if the user is allowed to react to messages"]
pub can_react_to_messages: bool,
#[doc = "True, if the user is allowed to edit their own tag"]
pub can_edit_tag: bool,
#[doc = "True, if the user is allowed to change the chat title, photo and other settings"]
pub can_change_info: bool,
#[doc = "True, if the user is allowed to invite new users to the chat"]
pub can_invite_users: bool,
#[doc = "True, if the user is allowed to pin messages"]
pub can_pin_messages: bool,
#[doc = "True, if the user is allowed to create forum topics"]
pub can_manage_topics: bool,
#[doc = "Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever."]
pub until_date: i64,
#[doc = "Tag of the member"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tag: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberRestricted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.status, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.is_member, output);
CollectFiles::collect_files(&self.can_send_messages, output);
CollectFiles::collect_files(&self.can_send_audios, output);
CollectFiles::collect_files(&self.can_send_documents, output);
CollectFiles::collect_files(&self.can_send_photos, output);
CollectFiles::collect_files(&self.can_send_videos, output);
CollectFiles::collect_files(&self.can_send_video_notes, output);
CollectFiles::collect_files(&self.can_send_voice_notes, output);
CollectFiles::collect_files(&self.can_send_polls, output);
CollectFiles::collect_files(&self.can_send_other_messages, output);
CollectFiles::collect_files(&self.can_add_web_page_previews, output);
CollectFiles::collect_files(&self.can_react_to_messages, output);
CollectFiles::collect_files(&self.can_edit_tag, output);
CollectFiles::collect_files(&self.can_change_info, output);
CollectFiles::collect_files(&self.can_invite_users, output);
CollectFiles::collect_files(&self.can_pin_messages, output);
CollectFiles::collect_files(&self.can_manage_topics, output);
CollectFiles::collect_files(&self.until_date, output);
CollectFiles::collect_files(&self.tag, output);
}
}
impl ChatMemberRestricted {
pub fn new(
user: User,
is_member: bool,
can_send_messages: bool,
can_send_audios: bool,
can_send_documents: bool,
can_send_photos: bool,
can_send_videos: bool,
can_send_video_notes: bool,
can_send_voice_notes: bool,
can_send_polls: bool,
can_send_other_messages: bool,
can_add_web_page_previews: bool,
can_react_to_messages: bool,
can_edit_tag: bool,
can_change_info: bool,
can_invite_users: bool,
can_pin_messages: bool,
can_manage_topics: bool,
until_date: i64,
) -> Self {
Self {
status: "restricted".to_owned(),
user,
is_member,
can_send_messages,
can_send_audios,
can_send_documents,
can_send_photos,
can_send_videos,
can_send_video_notes,
can_send_voice_notes,
can_send_polls,
can_send_other_messages,
can_add_web_page_previews,
can_react_to_messages,
can_edit_tag,
can_change_info,
can_invite_users,
can_pin_messages,
can_manage_topics,
until_date,
tag: None,
extra: BTreeMap::new(),
}
}
pub fn tag(mut self, value: impl Into<String>) -> Self {
self.tag = Some(value.into());
self
}
}
#[doc = "This object represents changes in the status of a chat member."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatMemberUpdated {
#[doc = "Chat the user belongs to"]
pub chat: Box<Chat>,
#[doc = "Performer of the action, which resulted in the change"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Date the change was done in Unix time"]
pub date: i64,
#[doc = "Previous information about the chat member"]
pub old_chat_member: ChatMemberUnion,
#[doc = "New information about the chat member"]
pub new_chat_member: ChatMemberUnion,
#[doc = "Chat invite link, which was used by the user to join the chat; for joining by invite link events only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invite_link: Option<ChatInviteLink>,
#[doc = "True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub via_join_request: Option<bool>,
#[doc = "True, if the user joined the chat via a chat folder invite link"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub via_chat_folder_invite_link: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatMemberUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.old_chat_member, output);
CollectFiles::collect_files(&self.new_chat_member, output);
CollectFiles::collect_files(&self.invite_link, output);
CollectFiles::collect_files(&self.via_join_request, output);
CollectFiles::collect_files(&self.via_chat_folder_invite_link, output);
}
}
impl ChatMemberUpdated {
pub fn new(
chat: Box<Chat>,
from_user: User,
date: i64,
old_chat_member: impl Into<ChatMemberUnion>,
new_chat_member: impl Into<ChatMemberUnion>,
) -> Self {
Self {
chat,
from_user,
date,
old_chat_member: old_chat_member.into(),
new_chat_member: new_chat_member.into(),
invite_link: None,
via_join_request: None,
via_chat_folder_invite_link: None,
extra: BTreeMap::new(),
}
}
pub fn invite_link(mut self, value: ChatInviteLink) -> Self {
self.invite_link = Some(value);
self
}
pub fn via_join_request(mut self, value: bool) -> Self {
self.via_join_request = Some(value);
self
}
pub fn via_chat_folder_invite_link(mut self, value: bool) -> Self {
self.via_chat_folder_invite_link = Some(value);
self
}
}
#[doc = "Describes a service message about an ownership change in the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatOwnerChanged {
#[doc = "The new owner of the chat"]
pub new_owner: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatOwnerChanged {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.new_owner, output);
}
}
impl ChatOwnerChanged {
pub fn new(new_owner: User) -> Self {
Self {
new_owner,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about the chat owner leaving the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatOwnerLeft {
#[doc = "The user who will become the new owner of the chat if the previous owner does not return to the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub new_owner: Option<User>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatOwnerLeft {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.new_owner, output);
}
}
impl ChatOwnerLeft {
pub fn new() -> Self {
Self {
new_owner: None,
extra: BTreeMap::new(),
}
}
pub fn new_owner(mut self, value: User) -> Self {
self.new_owner = Some(value);
self
}
}
impl Default for ChatOwnerLeft {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes actions that a non-administrator user is allowed to take in a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatPermissions {
#[doc = "True, if the user is allowed to send text messages, rich messages, contacts, giveaways, giveaway winners, invoices, locations and venues"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_messages: Option<bool>,
#[doc = "True, if the user is allowed to send audios"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_audios: Option<bool>,
#[doc = "True, if the user is allowed to send documents"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_documents: Option<bool>,
#[doc = "True, if the user is allowed to send photos"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_photos: Option<bool>,
#[doc = "True, if the user is allowed to send videos"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_videos: Option<bool>,
#[doc = "True, if the user is allowed to send video notes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_video_notes: Option<bool>,
#[doc = "True, if the user is allowed to send voice notes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_voice_notes: Option<bool>,
#[doc = "True, if the user is allowed to send polls and checklists"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_polls: Option<bool>,
#[doc = "True, if the user is allowed to send animations, games, stickers and use inline bots"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_send_other_messages: Option<bool>,
#[doc = "True, if the user is allowed to add web page previews to their messages"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_add_web_page_previews: Option<bool>,
#[doc = "True, if the user is allowed to react to messages. If omitted, defaults to the value of can_send_messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_react_to_messages: Option<bool>,
#[doc = "True, if the user is allowed to edit their own tag. If omitted, defaults to the value of can_pin_messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_edit_tag: Option<bool>,
#[doc = "True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_change_info: Option<bool>,
#[doc = "True, if the user is allowed to invite new users to the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_invite_users: Option<bool>,
#[doc = "True, if the user is allowed to pin messages. Ignored in public supergroups."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_pin_messages: Option<bool>,
#[doc = "True, if the user is allowed to create forum topics. If omitted, defaults to the value of can_pin_messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_topics: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatPermissions {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.can_send_messages, output);
CollectFiles::collect_files(&self.can_send_audios, output);
CollectFiles::collect_files(&self.can_send_documents, output);
CollectFiles::collect_files(&self.can_send_photos, output);
CollectFiles::collect_files(&self.can_send_videos, output);
CollectFiles::collect_files(&self.can_send_video_notes, output);
CollectFiles::collect_files(&self.can_send_voice_notes, output);
CollectFiles::collect_files(&self.can_send_polls, output);
CollectFiles::collect_files(&self.can_send_other_messages, output);
CollectFiles::collect_files(&self.can_add_web_page_previews, output);
CollectFiles::collect_files(&self.can_react_to_messages, output);
CollectFiles::collect_files(&self.can_edit_tag, output);
CollectFiles::collect_files(&self.can_change_info, output);
CollectFiles::collect_files(&self.can_invite_users, output);
CollectFiles::collect_files(&self.can_pin_messages, output);
CollectFiles::collect_files(&self.can_manage_topics, output);
}
}
impl ChatPermissions {
pub fn new() -> Self {
Self {
can_send_messages: None,
can_send_audios: None,
can_send_documents: None,
can_send_photos: None,
can_send_videos: None,
can_send_video_notes: None,
can_send_voice_notes: None,
can_send_polls: None,
can_send_other_messages: None,
can_add_web_page_previews: None,
can_react_to_messages: None,
can_edit_tag: None,
can_change_info: None,
can_invite_users: None,
can_pin_messages: None,
can_manage_topics: None,
extra: BTreeMap::new(),
}
}
pub fn can_send_messages(mut self, value: bool) -> Self {
self.can_send_messages = Some(value);
self
}
pub fn can_send_audios(mut self, value: bool) -> Self {
self.can_send_audios = Some(value);
self
}
pub fn can_send_documents(mut self, value: bool) -> Self {
self.can_send_documents = Some(value);
self
}
pub fn can_send_photos(mut self, value: bool) -> Self {
self.can_send_photos = Some(value);
self
}
pub fn can_send_videos(mut self, value: bool) -> Self {
self.can_send_videos = Some(value);
self
}
pub fn can_send_video_notes(mut self, value: bool) -> Self {
self.can_send_video_notes = Some(value);
self
}
pub fn can_send_voice_notes(mut self, value: bool) -> Self {
self.can_send_voice_notes = Some(value);
self
}
pub fn can_send_polls(mut self, value: bool) -> Self {
self.can_send_polls = Some(value);
self
}
pub fn can_send_other_messages(mut self, value: bool) -> Self {
self.can_send_other_messages = Some(value);
self
}
pub fn can_add_web_page_previews(mut self, value: bool) -> Self {
self.can_add_web_page_previews = Some(value);
self
}
pub fn can_react_to_messages(mut self, value: bool) -> Self {
self.can_react_to_messages = Some(value);
self
}
pub fn can_edit_tag(mut self, value: bool) -> Self {
self.can_edit_tag = Some(value);
self
}
pub fn can_change_info(mut self, value: bool) -> Self {
self.can_change_info = Some(value);
self
}
pub fn can_invite_users(mut self, value: bool) -> Self {
self.can_invite_users = Some(value);
self
}
pub fn can_pin_messages(mut self, value: bool) -> Self {
self.can_pin_messages = Some(value);
self
}
pub fn can_manage_topics(mut self, value: bool) -> Self {
self.can_manage_topics = Some(value);
self
}
}
impl Default for ChatPermissions {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a chat photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatPhoto {
#[doc = "File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed."]
pub small_file_id: String,
#[doc = "Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub small_file_unique_id: String,
#[doc = "File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed."]
pub big_file_id: String,
#[doc = "Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub big_file_unique_id: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.small_file_id, output);
CollectFiles::collect_files(&self.small_file_unique_id, output);
CollectFiles::collect_files(&self.big_file_id, output);
CollectFiles::collect_files(&self.big_file_unique_id, output);
}
}
impl ChatPhoto {
pub fn new(
small_file_id: impl Into<String>,
small_file_unique_id: impl Into<String>,
big_file_id: impl Into<String>,
big_file_unique_id: impl Into<String>,
) -> Self {
Self {
small_file_id: small_file_id.into(),
small_file_unique_id: small_file_unique_id.into(),
big_file_id: big_file_id.into(),
big_file_unique_id: big_file_unique_id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChatShared {
#[doc = "Identifier of the request"]
pub request_id: i64,
#[doc = "Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means."]
pub chat_id: i64,
#[doc = "Title of the chat, if the title was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Username of the chat, if the username was requested by the bot and available"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[doc = "Available sizes of the chat photo, if the photo was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChatShared {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.chat_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.username, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl ChatShared {
pub fn new(request_id: i64, chat_id: i64) -> Self {
Self {
request_id,
chat_id,
title: None,
username: None,
photo: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn username(mut self, value: impl Into<String>) -> Self {
self.username = Some(value.into());
self
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
}
#[doc = "Describes a checklist."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Checklist {
#[doc = "Title of the checklist"]
pub title: String,
#[doc = "List of tasks in the checklist"]
pub tasks: Vec<ChecklistTask>,
#[doc = "Special entities that appear in the checklist title"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title_entities: Option<Vec<MessageEntity>>,
#[doc = "True, if users other than the creator of the list can add tasks to the list"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub others_can_add_tasks: Option<bool>,
#[doc = "True, if users other than the creator of the list can mark tasks as done or not done"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub others_can_mark_tasks_as_done: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Checklist {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.tasks, output);
CollectFiles::collect_files(&self.title_entities, output);
CollectFiles::collect_files(&self.others_can_add_tasks, output);
CollectFiles::collect_files(&self.others_can_mark_tasks_as_done, output);
}
}
impl Checklist {
pub fn new(title: impl Into<String>, tasks: Vec<ChecklistTask>) -> Self {
Self {
title: title.into(),
tasks,
title_entities: None,
others_can_add_tasks: None,
others_can_mark_tasks_as_done: None,
extra: BTreeMap::new(),
}
}
pub fn title_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.title_entities = Some(value);
self
}
pub fn others_can_add_tasks(mut self, value: bool) -> Self {
self.others_can_add_tasks = Some(value);
self
}
pub fn others_can_mark_tasks_as_done(mut self, value: bool) -> Self {
self.others_can_mark_tasks_as_done = Some(value);
self
}
}
#[doc = "Describes a task in a checklist."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChecklistTask {
#[doc = "Unique identifier of the task"]
pub id: i64,
#[doc = "Text of the task"]
pub text: String,
#[doc = "Special entities that appear in the task text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_entities: Option<Vec<MessageEntity>>,
#[doc = "User that completed the task; omitted if the task wasn't completed by a user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub completed_by_user: Option<User>,
#[doc = "Chat that completed the task; omitted if the task wasn't completed by a chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub completed_by_chat: Option<Box<Chat>>,
#[doc = "Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub completion_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChecklistTask {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.text_entities, output);
CollectFiles::collect_files(&self.completed_by_user, output);
CollectFiles::collect_files(&self.completed_by_chat, output);
CollectFiles::collect_files(&self.completion_date, output);
}
}
impl ChecklistTask {
pub fn new(id: i64, text: impl Into<String>) -> Self {
Self {
id,
text: text.into(),
text_entities: None,
completed_by_user: None,
completed_by_chat: None,
completion_date: None,
extra: BTreeMap::new(),
}
}
pub fn text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.text_entities = Some(value);
self
}
pub fn completed_by_user(mut self, value: User) -> Self {
self.completed_by_user = Some(value);
self
}
pub fn completed_by_chat(mut self, value: Box<Chat>) -> Self {
self.completed_by_chat = Some(value);
self
}
pub fn completion_date(mut self, value: i64) -> Self {
self.completion_date = Some(value);
self
}
}
#[doc = "Describes a service message about tasks added to a checklist."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChecklistTasksAdded {
#[doc = "List of tasks added to the checklist"]
pub tasks: Vec<ChecklistTask>,
#[doc = "Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist_message: Option<Box<Message>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChecklistTasksAdded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.tasks, output);
CollectFiles::collect_files(&self.checklist_message, output);
}
}
impl ChecklistTasksAdded {
pub fn new(tasks: Vec<ChecklistTask>) -> Self {
Self {
tasks,
checklist_message: None,
extra: BTreeMap::new(),
}
}
pub fn checklist_message(mut self, value: Box<Message>) -> Self {
self.checklist_message = Some(value);
self
}
}
#[doc = "Describes a service message about checklist tasks marked as done or not done."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChecklistTasksDone {
#[doc = "Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist_message: Option<Box<Message>>,
#[doc = "Identifiers of the tasks that were marked as done"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub marked_as_done_task_ids: Option<Vec<i64>>,
#[doc = "Identifiers of the tasks that were marked as not done"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub marked_as_not_done_task_ids: Option<Vec<i64>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChecklistTasksDone {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.checklist_message, output);
CollectFiles::collect_files(&self.marked_as_done_task_ids, output);
CollectFiles::collect_files(&self.marked_as_not_done_task_ids, output);
}
}
impl ChecklistTasksDone {
pub fn new() -> Self {
Self {
checklist_message: None,
marked_as_done_task_ids: None,
marked_as_not_done_task_ids: None,
extra: BTreeMap::new(),
}
}
pub fn checklist_message(mut self, value: Box<Message>) -> Self {
self.checklist_message = Some(value);
self
}
pub fn marked_as_done_task_ids(mut self, value: Vec<i64>) -> Self {
self.marked_as_done_task_ids = Some(value);
self
}
pub fn marked_as_not_done_task_ids(mut self, value: Vec<i64>) -> Self {
self.marked_as_not_done_task_ids = Some(value);
self
}
}
impl Default for ChecklistTasksDone {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents a result of an inline query that was chosen by the user and sent to their chat partner."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ChosenInlineResult {
#[doc = "The unique identifier for the result that was chosen"]
pub result_id: String,
#[doc = "The user that chose the result"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "The query that was used to obtain the result"]
pub query: String,
#[doc = "Sender location, only for bots that require user location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[doc = "Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub inline_message_id: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ChosenInlineResult {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.result_id, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.query, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.inline_message_id, output);
}
}
impl ChosenInlineResult {
pub fn new(result_id: impl Into<String>, from_user: User, query: impl Into<String>) -> Self {
Self {
result_id: result_id.into(),
from_user,
query: query.into(),
location: None,
inline_message_id: None,
extra: BTreeMap::new(),
}
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
pub fn inline_message_id(mut self, value: impl Into<String>) -> Self {
self.inline_message_id = Some(value.into());
self
}
}
#[doc = "Represents a community (a group of chats)."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Community {
#[doc = "Unique identifier for this community. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
pub id: i64,
#[doc = "Name of the community"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Community {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl Community {
pub fn new(id: i64, name: impl Into<String>) -> Self {
Self {
id,
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a chat being added to a community."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CommunityChatAdded {
#[doc = "The new community to which the chat belongs"]
pub community: Community,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for CommunityChatAdded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.community, output);
}
}
impl CommunityChatAdded {
pub fn new(community: Community) -> Self {
Self {
community,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a chat being removed from a community. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CommunityChatRemoved {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for CommunityChatRemoved {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl CommunityChatRemoved {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for CommunityChatRemoved {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a phone contact."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Contact {
#[doc = "Contact's phone number"]
pub phone_number: String,
#[doc = "Contact's first name"]
pub first_name: String,
#[doc = "Contact's last name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_id: Option<i64>,
#[doc = "Additional data about the contact in the form of a vCard"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vcard: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Contact {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.phone_number, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.user_id, output);
CollectFiles::collect_files(&self.vcard, output);
}
}
impl Contact {
pub fn new(phone_number: impl Into<String>, first_name: impl Into<String>) -> Self {
Self {
phone_number: phone_number.into(),
first_name: first_name.into(),
last_name: None,
user_id: None,
vcard: None,
extra: BTreeMap::new(),
}
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn user_id(mut self, value: i64) -> Self {
self.user_id = Some(value);
self
}
pub fn vcard(mut self, value: impl Into<String>) -> Self {
self.vcard = Some(value.into());
self
}
}
#[doc = "This object represents an inline keyboard button that copies specified text to the clipboard."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CopyTextButton {
#[doc = "The text to be copied to the clipboard; 1-256 characters"]
pub text: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for CopyTextButton {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
}
}
impl CopyTextButton {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents an animated emoji that displays a random value."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Dice {
#[doc = "Emoji on which the dice throw animation is based"]
pub emoji: String,
#[doc = "Value of the dice, 1-6 for '', '' and '' base emoji, 1-5 for '' and '' base emoji, 1-64 for '' base emoji"]
pub value: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Dice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.emoji, output);
CollectFiles::collect_files(&self.value, output);
}
}
impl Dice {
pub fn new(emoji: impl Into<String>, value: i64) -> Self {
Self {
emoji: emoji.into(),
value,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a change in the price of direct messages sent to a channel chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct DirectMessagePriceChanged {
#[doc = "True, if direct messages are enabled for the channel chat; False otherwise"]
pub are_direct_messages_enabled: bool,
#[doc = "The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub direct_message_star_count: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for DirectMessagePriceChanged {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.are_direct_messages_enabled, output);
CollectFiles::collect_files(&self.direct_message_star_count, output);
}
}
impl DirectMessagePriceChanged {
pub fn new(are_direct_messages_enabled: bool) -> Self {
Self {
are_direct_messages_enabled,
direct_message_star_count: None,
extra: BTreeMap::new(),
}
}
pub fn direct_message_star_count(mut self, value: i64) -> Self {
self.direct_message_star_count = Some(value);
self
}
}
#[doc = "Describes a topic of a direct messages chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct DirectMessagesTopic {
#[doc = "Unique identifier of the topic. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."]
pub topic_id: i64,
#[doc = "Information about the user that created the topic. Currently, it is always present."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for DirectMessagesTopic {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.topic_id, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl DirectMessagesTopic {
pub fn new(topic_id: i64) -> Self {
Self {
topic_id,
user: None,
extra: BTreeMap::new(),
}
}
pub fn user(mut self, value: User) -> Self {
self.user = Some(value);
self
}
}
#[doc = "This object represents a general file (as opposed to photos, voice messages and audio files)."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Document {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Document thumbnail as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "Original filename as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Document {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.file_name, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl Document {
pub fn new(file_id: impl Into<String>, file_unique_id: impl Into<String>) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
thumbnail: None,
file_name: None,
mime_type: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn file_name(mut self, value: impl Into<String>) -> Self {
self.file_name = Some(value.into());
self
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct EncryptedCredentials {
#[doc = "Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication"]
pub data: String,
#[doc = "Base64-encoded data hash for data authentication"]
pub hash: String,
#[doc = "Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption"]
pub secret: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for EncryptedCredentials {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.data, output);
CollectFiles::collect_files(&self.hash, output);
CollectFiles::collect_files(&self.secret, output);
}
}
impl EncryptedCredentials {
pub fn new(
data: impl Into<String>,
hash: impl Into<String>,
secret: impl Into<String>,
) -> Self {
Self {
data: data.into(),
hash: hash.into(),
secret: secret.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes documents or other Telegram Passport elements shared with the bot by the user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct EncryptedPassportElement {
#[doc = "Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration', 'phone_number', 'email'."]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded element hash for using in PassportElementErrorUnspecified"]
pub hash: String,
#[doc = "Base64-encoded encrypted Telegram Passport element data provided by the user; available only for 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and 'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data: Option<String>,
#[doc = "User's verified phone number; available only for 'phone_number' type"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
#[doc = "User's verified email address; available only for 'email' type"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[doc = "Array of encrypted files with documents provided by the user; available only for 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub files: Option<Vec<PassportFile>>,
#[doc = "Encrypted file with the front side of the document, provided by the user; available only for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub front_side: Option<PassportFile>,
#[doc = "Encrypted file with the reverse side of the document, provided by the user; available only for 'driver_license' and 'identity_card'. The file can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reverse_side: Option<PassportFile>,
#[doc = "Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selfie: Option<PassportFile>,
#[doc = "Array of encrypted files with translated versions of documents provided by the user; available if requested for 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub translation: Option<Vec<PassportFile>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for EncryptedPassportElement {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.hash, output);
CollectFiles::collect_files(&self.data, output);
CollectFiles::collect_files(&self.phone_number, output);
CollectFiles::collect_files(&self.email, output);
CollectFiles::collect_files(&self.files, output);
CollectFiles::collect_files(&self.front_side, output);
CollectFiles::collect_files(&self.reverse_side, output);
CollectFiles::collect_files(&self.selfie, output);
CollectFiles::collect_files(&self.translation, output);
}
}
impl EncryptedPassportElement {
pub fn new(kind: impl Into<String>, hash: impl Into<String>) -> Self {
Self {
kind: kind.into(),
hash: hash.into(),
data: None,
phone_number: None,
email: None,
files: None,
front_side: None,
reverse_side: None,
selfie: None,
translation: None,
extra: BTreeMap::new(),
}
}
pub fn data(mut self, value: impl Into<String>) -> Self {
self.data = Some(value.into());
self
}
pub fn phone_number(mut self, value: impl Into<String>) -> Self {
self.phone_number = Some(value.into());
self
}
pub fn email(mut self, value: impl Into<String>) -> Self {
self.email = Some(value.into());
self
}
pub fn files(mut self, value: Vec<PassportFile>) -> Self {
self.files = Some(value);
self
}
pub fn front_side(mut self, value: PassportFile) -> Self {
self.front_side = Some(value);
self
}
pub fn reverse_side(mut self, value: PassportFile) -> Self {
self.reverse_side = Some(value);
self
}
pub fn selfie(mut self, value: PassportFile) -> Self {
self.selfie = Some(value);
self
}
pub fn translation(mut self, value: Vec<PassportFile>) -> Self {
self.translation = Some(value);
self
}
}
#[doc = "This object contains information about a message that is being replied to, which may come from another chat or forum topic."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ExternalReplyInfo {
#[doc = "Origin of the message replied to by the given message"]
pub origin: MessageOriginUnion,
#[doc = "Chat the original message belongs to. Available only if the chat is a supergroup or a channel."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat: Option<Box<Chat>>,
#[doc = "Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_id: Option<i64>,
#[doc = "Options used for link preview generation for the original message, if it is a text message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub link_preview_options: Option<LinkPreviewOptions>,
#[doc = "Message is an animation, information about the animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub animation: Option<Animation>,
#[doc = "Message is an audio file, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio: Option<Audio>,
#[doc = "Message is a general file, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub document: Option<Document>,
#[doc = "Message is a live photo, information about the live photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_photo: Option<LivePhoto>,
#[doc = "Message contains paid media; information about the paid media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_media: Option<PaidMediaInfo>,
#[doc = "Message is a photo, available sizes of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[doc = "Message is a sticker, information about the sticker"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker: Option<Sticker>,
#[doc = "Message is a forwarded story"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub story: Option<Story>,
#[doc = "Message is a video, information about the video"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video: Option<Video>,
#[doc = "Message is a video note, information about the video message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_note: Option<VideoNote>,
#[doc = "Message is a voice message, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub voice: Option<Voice>,
#[doc = "True, if the message media is covered by a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_media_spoiler: Option<bool>,
#[doc = "Message is a checklist"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist: Option<Checklist>,
#[doc = "Message is a shared contact, information about the contact"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub contact: Option<Contact>,
#[doc = "Message is a dice with random value"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dice: Option<Dice>,
#[doc = "Message is a game, information about the game."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub game: Option<Game>,
#[doc = "Message is a scheduled giveaway, information about the giveaway"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway: Option<Giveaway>,
#[doc = "A giveaway with public winners was completed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway_winners: Option<GiveawayWinners>,
#[doc = "Message is an invoice for a payment, information about the invoice."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invoice: Option<Invoice>,
#[doc = "Message is a shared location, information about the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[doc = "Message is a native poll, information about the poll"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll: Option<Poll>,
#[doc = "Message is a venue, information about the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub venue: Option<Venue>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ExternalReplyInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.origin, output);
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.link_preview_options, output);
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.audio, output);
CollectFiles::collect_files(&self.document, output);
CollectFiles::collect_files(&self.live_photo, output);
CollectFiles::collect_files(&self.paid_media, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.story, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.video_note, output);
CollectFiles::collect_files(&self.voice, output);
CollectFiles::collect_files(&self.has_media_spoiler, output);
CollectFiles::collect_files(&self.checklist, output);
CollectFiles::collect_files(&self.contact, output);
CollectFiles::collect_files(&self.dice, output);
CollectFiles::collect_files(&self.game, output);
CollectFiles::collect_files(&self.giveaway, output);
CollectFiles::collect_files(&self.giveaway_winners, output);
CollectFiles::collect_files(&self.invoice, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.poll, output);
CollectFiles::collect_files(&self.venue, output);
}
}
impl ExternalReplyInfo {
pub fn new(origin: impl Into<MessageOriginUnion>) -> Self {
Self {
origin: origin.into(),
chat: None,
message_id: None,
link_preview_options: None,
animation: None,
audio: None,
document: None,
live_photo: None,
paid_media: None,
photo: None,
sticker: None,
story: None,
video: None,
video_note: None,
voice: None,
has_media_spoiler: None,
checklist: None,
contact: None,
dice: None,
game: None,
giveaway: None,
giveaway_winners: None,
invoice: None,
location: None,
poll: None,
venue: None,
extra: BTreeMap::new(),
}
}
pub fn chat(mut self, value: Box<Chat>) -> Self {
self.chat = Some(value);
self
}
pub fn message_id(mut self, value: i64) -> Self {
self.message_id = Some(value);
self
}
pub fn link_preview_options(mut self, value: LinkPreviewOptions) -> Self {
self.link_preview_options = Some(value);
self
}
pub fn animation(mut self, value: Animation) -> Self {
self.animation = Some(value);
self
}
pub fn audio(mut self, value: Audio) -> Self {
self.audio = Some(value);
self
}
pub fn document(mut self, value: Document) -> Self {
self.document = Some(value);
self
}
pub fn live_photo(mut self, value: LivePhoto) -> Self {
self.live_photo = Some(value);
self
}
pub fn paid_media(mut self, value: PaidMediaInfo) -> Self {
self.paid_media = Some(value);
self
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
pub fn sticker(mut self, value: Sticker) -> Self {
self.sticker = Some(value);
self
}
pub fn story(mut self, value: Story) -> Self {
self.story = Some(value);
self
}
pub fn video(mut self, value: Video) -> Self {
self.video = Some(value);
self
}
pub fn video_note(mut self, value: VideoNote) -> Self {
self.video_note = Some(value);
self
}
pub fn voice(mut self, value: Voice) -> Self {
self.voice = Some(value);
self
}
pub fn has_media_spoiler(mut self, value: bool) -> Self {
self.has_media_spoiler = Some(value);
self
}
pub fn checklist(mut self, value: Checklist) -> Self {
self.checklist = Some(value);
self
}
pub fn contact(mut self, value: Contact) -> Self {
self.contact = Some(value);
self
}
pub fn dice(mut self, value: Dice) -> Self {
self.dice = Some(value);
self
}
pub fn game(mut self, value: Game) -> Self {
self.game = Some(value);
self
}
pub fn giveaway(mut self, value: Giveaway) -> Self {
self.giveaway = Some(value);
self
}
pub fn giveaway_winners(mut self, value: GiveawayWinners) -> Self {
self.giveaway_winners = Some(value);
self
}
pub fn invoice(mut self, value: Invoice) -> Self {
self.invoice = Some(value);
self
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
pub fn poll(mut self, value: Poll) -> Self {
self.poll = Some(value);
self
}
pub fn venue(mut self, value: Venue) -> Self {
self.venue = Some(value);
self
}
}
#[doc = "This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct File {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[doc = "File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_path: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for File {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.file_size, output);
CollectFiles::collect_files(&self.file_path, output);
}
}
impl File {
pub fn new(file_id: impl Into<String>, file_unique_id: impl Into<String>) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
file_size: None,
file_path: None,
extra: BTreeMap::new(),
}
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
pub fn file_path(mut self, value: impl Into<String>) -> Self {
self.file_path = Some(value.into());
self
}
}
#[doc = "Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a user account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForceReply {
#[doc = "Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'"]
pub force_reply: bool,
#[doc = "The placeholder to be shown in the input field when the reply is active; 1-64 characters"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_field_placeholder: Option<String>,
#[doc = "Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selective: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForceReply {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.force_reply, output);
CollectFiles::collect_files(&self.input_field_placeholder, output);
CollectFiles::collect_files(&self.selective, output);
}
}
impl ForceReply {
pub fn new() -> Self {
Self {
force_reply: true,
input_field_placeholder: None,
selective: None,
extra: BTreeMap::new(),
}
}
pub fn input_field_placeholder(mut self, value: impl Into<String>) -> Self {
self.input_field_placeholder = Some(value.into());
self
}
pub fn selective(mut self, value: bool) -> Self {
self.selective = Some(value);
self
}
}
impl Default for ForceReply {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a forum topic."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForumTopic {
#[doc = "Unique identifier of the forum topic"]
pub message_thread_id: i64,
#[doc = "Name of the topic"]
pub name: String,
#[doc = "Color of the topic icon in RGB format"]
pub icon_color: i64,
#[doc = "Unique identifier of the custom emoji shown as the topic icon"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
#[doc = "True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_name_implicit: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForumTopic {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_thread_id, output);
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.icon_color, output);
CollectFiles::collect_files(&self.icon_custom_emoji_id, output);
CollectFiles::collect_files(&self.is_name_implicit, output);
}
}
impl ForumTopic {
pub fn new(message_thread_id: i64, name: impl Into<String>, icon_color: i64) -> Self {
Self {
message_thread_id,
name: name.into(),
icon_color,
icon_custom_emoji_id: None,
is_name_implicit: None,
extra: BTreeMap::new(),
}
}
pub fn icon_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.icon_custom_emoji_id = Some(value.into());
self
}
pub fn is_name_implicit(mut self, value: bool) -> Self {
self.is_name_implicit = Some(value);
self
}
}
#[doc = "This object represents a service message about a forum topic closed in the chat. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForumTopicClosed {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForumTopicClosed {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl ForumTopicClosed {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for ForumTopicClosed {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a service message about a new forum topic created in the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForumTopicCreated {
#[doc = "Name of the topic"]
pub name: String,
#[doc = "Color of the topic icon in RGB format"]
pub icon_color: i64,
#[doc = "Unique identifier of the custom emoji shown as the topic icon"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
#[doc = "True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_name_implicit: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForumTopicCreated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.icon_color, output);
CollectFiles::collect_files(&self.icon_custom_emoji_id, output);
CollectFiles::collect_files(&self.is_name_implicit, output);
}
}
impl ForumTopicCreated {
pub fn new(name: impl Into<String>, icon_color: i64) -> Self {
Self {
name: name.into(),
icon_color,
icon_custom_emoji_id: None,
is_name_implicit: None,
extra: BTreeMap::new(),
}
}
pub fn icon_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.icon_custom_emoji_id = Some(value.into());
self
}
pub fn is_name_implicit(mut self, value: bool) -> Self {
self.is_name_implicit = Some(value);
self
}
}
#[doc = "This object represents a service message about an edited forum topic."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForumTopicEdited {
#[doc = "New name of the topic, if it was edited"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForumTopicEdited {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.icon_custom_emoji_id, output);
}
}
impl ForumTopicEdited {
pub fn new() -> Self {
Self {
name: None,
icon_custom_emoji_id: None,
extra: BTreeMap::new(),
}
}
pub fn name(mut self, value: impl Into<String>) -> Self {
self.name = Some(value.into());
self
}
pub fn icon_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.icon_custom_emoji_id = Some(value.into());
self
}
}
impl Default for ForumTopicEdited {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a service message about a forum topic reopened in the chat. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ForumTopicReopened {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ForumTopicReopened {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl ForumTopicReopened {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for ForumTopicReopened {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Game {
#[doc = "Title of the game"]
pub title: String,
#[doc = "Description of the game"]
pub description: String,
#[doc = "Photo that will be displayed in the game message in chats"]
pub photo: Vec<PhotoSize>,
#[doc = "Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[doc = "Special entities that appear in text, such as usernames, URLs, bot commands, etc."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_entities: Option<Vec<MessageEntity>>,
#[doc = "Animation that will be displayed in the game message in chats. Upload via BotFather."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub animation: Option<Animation>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Game {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.text_entities, output);
CollectFiles::collect_files(&self.animation, output);
}
}
impl Game {
pub fn new(
title: impl Into<String>,
description: impl Into<String>,
photo: Vec<PhotoSize>,
) -> Self {
Self {
title: title.into(),
description: description.into(),
photo,
text: None,
text_entities: None,
animation: None,
extra: BTreeMap::new(),
}
}
pub fn text(mut self, value: impl Into<String>) -> Self {
self.text = Some(value.into());
self
}
pub fn text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.text_entities = Some(value);
self
}
pub fn animation(mut self, value: Animation) -> Self {
self.animation = Some(value);
self
}
}
#[doc = "This object represents one row of the high scores table for a game."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GameHighScore {
#[doc = "Position in high score table for the game"]
pub position: i64,
#[doc = "User"]
pub user: User,
#[doc = "Score"]
pub score: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GameHighScore {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.position, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.score, output);
}
}
impl GameHighScore {
pub fn new(position: i64, user: User, score: i64) -> Self {
Self {
position,
user,
score,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a service message about General forum topic hidden in the chat. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GeneralForumTopicHidden {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GeneralForumTopicHidden {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl GeneralForumTopicHidden {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for GeneralForumTopicHidden {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a service message about General forum topic unhidden in the chat. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GeneralForumTopicUnhidden {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GeneralForumTopicUnhidden {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl GeneralForumTopicUnhidden {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for GeneralForumTopicUnhidden {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a gift that can be sent by the bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Gift {
#[doc = "Unique identifier of the gift"]
pub id: String,
#[doc = "The sticker that represents the gift"]
pub sticker: Sticker,
#[doc = "The number of Telegram Stars that must be paid to send the sticker"]
pub star_count: i64,
#[doc = "The number of Telegram Stars that must be paid to upgrade the gift to a unique one"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub upgrade_star_count: Option<i64>,
#[doc = "True, if the gift can only be purchased by Telegram Premium subscribers"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_premium: Option<bool>,
#[doc = "True, if the gift can be used (after being upgraded) to customize a user's appearance"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_colors: Option<bool>,
#[doc = "The total number of gifts of this type that can be sent by all users; for limited gifts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub total_count: Option<i64>,
#[doc = "The number of remaining gifts of this type that can be sent by all users; for limited gifts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub remaining_count: Option<i64>,
#[doc = "The total number of gifts of this type that can be sent by the bot; for limited gifts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub personal_total_count: Option<i64>,
#[doc = "The number of remaining gifts of this type that can be sent by the bot; for limited gifts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub personal_remaining_count: Option<i64>,
#[doc = "Background of the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub background: Option<GiftBackground>,
#[doc = "The total number of different unique gifts that can be obtained by upgrading the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unique_gift_variant_count: Option<i64>,
#[doc = "Information about the chat that published the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub publisher_chat: Option<Box<Chat>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Gift {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.star_count, output);
CollectFiles::collect_files(&self.upgrade_star_count, output);
CollectFiles::collect_files(&self.is_premium, output);
CollectFiles::collect_files(&self.has_colors, output);
CollectFiles::collect_files(&self.total_count, output);
CollectFiles::collect_files(&self.remaining_count, output);
CollectFiles::collect_files(&self.personal_total_count, output);
CollectFiles::collect_files(&self.personal_remaining_count, output);
CollectFiles::collect_files(&self.background, output);
CollectFiles::collect_files(&self.unique_gift_variant_count, output);
CollectFiles::collect_files(&self.publisher_chat, output);
}
}
impl Gift {
pub fn new(id: impl Into<String>, sticker: Sticker, star_count: i64) -> Self {
Self {
id: id.into(),
sticker,
star_count,
upgrade_star_count: None,
is_premium: None,
has_colors: None,
total_count: None,
remaining_count: None,
personal_total_count: None,
personal_remaining_count: None,
background: None,
unique_gift_variant_count: None,
publisher_chat: None,
extra: BTreeMap::new(),
}
}
pub fn upgrade_star_count(mut self, value: i64) -> Self {
self.upgrade_star_count = Some(value);
self
}
pub fn is_premium(mut self, value: bool) -> Self {
self.is_premium = Some(value);
self
}
pub fn has_colors(mut self, value: bool) -> Self {
self.has_colors = Some(value);
self
}
pub fn total_count(mut self, value: i64) -> Self {
self.total_count = Some(value);
self
}
pub fn remaining_count(mut self, value: i64) -> Self {
self.remaining_count = Some(value);
self
}
pub fn personal_total_count(mut self, value: i64) -> Self {
self.personal_total_count = Some(value);
self
}
pub fn personal_remaining_count(mut self, value: i64) -> Self {
self.personal_remaining_count = Some(value);
self
}
pub fn background(mut self, value: GiftBackground) -> Self {
self.background = Some(value);
self
}
pub fn unique_gift_variant_count(mut self, value: i64) -> Self {
self.unique_gift_variant_count = Some(value);
self
}
pub fn publisher_chat(mut self, value: Box<Chat>) -> Self {
self.publisher_chat = Some(value);
self
}
}
#[doc = "This object describes the background of a gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GiftBackground {
#[doc = "Center color of the background in RGB format"]
pub center_color: i64,
#[doc = "Edge color of the background in RGB format"]
pub edge_color: i64,
#[doc = "Text color of the background in RGB format"]
pub text_color: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GiftBackground {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.center_color, output);
CollectFiles::collect_files(&self.edge_color, output);
CollectFiles::collect_files(&self.text_color, output);
}
}
impl GiftBackground {
pub fn new(center_color: i64, edge_color: i64, text_color: i64) -> Self {
Self {
center_color,
edge_color,
text_color,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a regular gift that was sent or received."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GiftInfo {
#[doc = "Information about the gift"]
pub gift: Gift,
#[doc = "Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub owned_gift_id: Option<String>,
#[doc = "Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub convert_star_count: Option<i64>,
#[doc = "Number of Telegram Stars that were prepaid for the ability to upgrade the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prepaid_upgrade_star_count: Option<i64>,
#[doc = "True, if the gift's upgrade was purchased after the gift was sent"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_upgrade_separate: Option<bool>,
#[doc = "True, if the gift can be upgraded to a unique gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_be_upgraded: Option<bool>,
#[doc = "Text of the message that was added to the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[doc = "Special entities that appear in the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub entities: Option<Vec<MessageEntity>>,
#[doc = "True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_private: Option<bool>,
#[doc = "Unique number reserved for this gift when upgraded. See the number field in UniqueGift."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unique_gift_number: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GiftInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.owned_gift_id, output);
CollectFiles::collect_files(&self.convert_star_count, output);
CollectFiles::collect_files(&self.prepaid_upgrade_star_count, output);
CollectFiles::collect_files(&self.is_upgrade_separate, output);
CollectFiles::collect_files(&self.can_be_upgraded, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.entities, output);
CollectFiles::collect_files(&self.is_private, output);
CollectFiles::collect_files(&self.unique_gift_number, output);
}
}
impl GiftInfo {
pub fn new(gift: Gift) -> Self {
Self {
gift,
owned_gift_id: None,
convert_star_count: None,
prepaid_upgrade_star_count: None,
is_upgrade_separate: None,
can_be_upgraded: None,
text: None,
entities: None,
is_private: None,
unique_gift_number: None,
extra: BTreeMap::new(),
}
}
pub fn owned_gift_id(mut self, value: impl Into<String>) -> Self {
self.owned_gift_id = Some(value.into());
self
}
pub fn convert_star_count(mut self, value: i64) -> Self {
self.convert_star_count = Some(value);
self
}
pub fn prepaid_upgrade_star_count(mut self, value: i64) -> Self {
self.prepaid_upgrade_star_count = Some(value);
self
}
pub fn is_upgrade_separate(mut self, value: bool) -> Self {
self.is_upgrade_separate = Some(value);
self
}
pub fn can_be_upgraded(mut self, value: bool) -> Self {
self.can_be_upgraded = Some(value);
self
}
pub fn text(mut self, value: impl Into<String>) -> Self {
self.text = Some(value.into());
self
}
pub fn entities(mut self, value: Vec<MessageEntity>) -> Self {
self.entities = Some(value);
self
}
pub fn is_private(mut self, value: bool) -> Self {
self.is_private = Some(value);
self
}
pub fn unique_gift_number(mut self, value: i64) -> Self {
self.unique_gift_number = Some(value);
self
}
}
#[doc = "This object represent a list of gifts."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Gifts {
#[doc = "The list of gifts"]
pub gifts: Vec<Gift>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Gifts {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.gifts, output);
}
}
impl Gifts {
pub fn new(gifts: Vec<Gift>) -> Self {
Self {
gifts,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a message about a scheduled giveaway."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Giveaway {
#[doc = "The list of chats which the user must join to participate in the giveaway"]
pub chats: Vec<Chat>,
#[doc = "Point in time (Unix timestamp) when winners of the giveaway will be selected"]
pub winners_selection_date: i64,
#[doc = "The number of users which are supposed to be selected as winners of the giveaway"]
pub winner_count: i64,
#[doc = "True, if only users who join the chats after the giveaway started should be eligible to win"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub only_new_members: Option<bool>,
#[doc = "True, if the list of giveaway winners will be visible to everyone"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_public_winners: Option<bool>,
#[doc = "Description of additional giveaway prize"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_description: Option<String>,
#[doc = "A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub country_codes: Option<Vec<String>>,
#[doc = "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
#[doc = "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub premium_subscription_month_count: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Giveaway {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chats, output);
CollectFiles::collect_files(&self.winners_selection_date, output);
CollectFiles::collect_files(&self.winner_count, output);
CollectFiles::collect_files(&self.only_new_members, output);
CollectFiles::collect_files(&self.has_public_winners, output);
CollectFiles::collect_files(&self.prize_description, output);
CollectFiles::collect_files(&self.country_codes, output);
CollectFiles::collect_files(&self.prize_star_count, output);
CollectFiles::collect_files(&self.premium_subscription_month_count, output);
}
}
impl Giveaway {
pub fn new(chats: Vec<Chat>, winners_selection_date: i64, winner_count: i64) -> Self {
Self {
chats,
winners_selection_date,
winner_count,
only_new_members: None,
has_public_winners: None,
prize_description: None,
country_codes: None,
prize_star_count: None,
premium_subscription_month_count: None,
extra: BTreeMap::new(),
}
}
pub fn only_new_members(mut self, value: bool) -> Self {
self.only_new_members = Some(value);
self
}
pub fn has_public_winners(mut self, value: bool) -> Self {
self.has_public_winners = Some(value);
self
}
pub fn prize_description(mut self, value: impl Into<String>) -> Self {
self.prize_description = Some(value.into());
self
}
pub fn country_codes(mut self, value: Vec<String>) -> Self {
self.country_codes = Some(value);
self
}
pub fn prize_star_count(mut self, value: i64) -> Self {
self.prize_star_count = Some(value);
self
}
pub fn premium_subscription_month_count(mut self, value: i64) -> Self {
self.premium_subscription_month_count = Some(value);
self
}
}
#[doc = "This object represents a service message about the completion of a giveaway without public winners."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GiveawayCompleted {
#[doc = "Number of winners in the giveaway"]
pub winner_count: i64,
#[doc = "Number of undistributed prizes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unclaimed_prize_count: Option<i64>,
#[doc = "Message with the giveaway that was completed, if it wasn't deleted"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway_message: Option<Box<Message>>,
#[doc = "True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_star_giveaway: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GiveawayCompleted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.winner_count, output);
CollectFiles::collect_files(&self.unclaimed_prize_count, output);
CollectFiles::collect_files(&self.giveaway_message, output);
CollectFiles::collect_files(&self.is_star_giveaway, output);
}
}
impl GiveawayCompleted {
pub fn new(winner_count: i64) -> Self {
Self {
winner_count,
unclaimed_prize_count: None,
giveaway_message: None,
is_star_giveaway: None,
extra: BTreeMap::new(),
}
}
pub fn unclaimed_prize_count(mut self, value: i64) -> Self {
self.unclaimed_prize_count = Some(value);
self
}
pub fn giveaway_message(mut self, value: Box<Message>) -> Self {
self.giveaway_message = Some(value);
self
}
pub fn is_star_giveaway(mut self, value: bool) -> Self {
self.is_star_giveaway = Some(value);
self
}
}
#[doc = "This object represents a service message about the creation of a scheduled giveaway."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GiveawayCreated {
#[doc = "The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GiveawayCreated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.prize_star_count, output);
}
}
impl GiveawayCreated {
pub fn new() -> Self {
Self {
prize_star_count: None,
extra: BTreeMap::new(),
}
}
pub fn prize_star_count(mut self, value: i64) -> Self {
self.prize_star_count = Some(value);
self
}
}
impl Default for GiveawayCreated {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a message about the completion of a giveaway with public winners."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct GiveawayWinners {
#[doc = "The chat that created the giveaway"]
pub chat: Box<Chat>,
#[doc = "Identifier of the message with the giveaway in the chat"]
pub giveaway_message_id: i64,
#[doc = "Point in time (Unix timestamp) when winners of the giveaway were selected"]
pub winners_selection_date: i64,
#[doc = "Total number of winners in the giveaway"]
pub winner_count: i64,
#[doc = "List of up to 100 winners of the giveaway"]
pub winners: Vec<User>,
#[doc = "The number of other chats the user had to join in order to be eligible for the giveaway"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub additional_chat_count: Option<i64>,
#[doc = "The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_star_count: Option<i64>,
#[doc = "The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub premium_subscription_month_count: Option<i64>,
#[doc = "Number of undistributed prizes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unclaimed_prize_count: Option<i64>,
#[doc = "True, if only users who had joined the chats after the giveaway started were eligible to win"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub only_new_members: Option<bool>,
#[doc = "True, if the giveaway was canceled because the payment for it was refunded"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub was_refunded: Option<bool>,
#[doc = "Description of additional giveaway prize"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prize_description: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for GiveawayWinners {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.giveaway_message_id, output);
CollectFiles::collect_files(&self.winners_selection_date, output);
CollectFiles::collect_files(&self.winner_count, output);
CollectFiles::collect_files(&self.winners, output);
CollectFiles::collect_files(&self.additional_chat_count, output);
CollectFiles::collect_files(&self.prize_star_count, output);
CollectFiles::collect_files(&self.premium_subscription_month_count, output);
CollectFiles::collect_files(&self.unclaimed_prize_count, output);
CollectFiles::collect_files(&self.only_new_members, output);
CollectFiles::collect_files(&self.was_refunded, output);
CollectFiles::collect_files(&self.prize_description, output);
}
}
impl GiveawayWinners {
pub fn new(
chat: Box<Chat>,
giveaway_message_id: i64,
winners_selection_date: i64,
winner_count: i64,
winners: Vec<User>,
) -> Self {
Self {
chat,
giveaway_message_id,
winners_selection_date,
winner_count,
winners,
additional_chat_count: None,
prize_star_count: None,
premium_subscription_month_count: None,
unclaimed_prize_count: None,
only_new_members: None,
was_refunded: None,
prize_description: None,
extra: BTreeMap::new(),
}
}
pub fn additional_chat_count(mut self, value: i64) -> Self {
self.additional_chat_count = Some(value);
self
}
pub fn prize_star_count(mut self, value: i64) -> Self {
self.prize_star_count = Some(value);
self
}
pub fn premium_subscription_month_count(mut self, value: i64) -> Self {
self.premium_subscription_month_count = Some(value);
self
}
pub fn unclaimed_prize_count(mut self, value: i64) -> Self {
self.unclaimed_prize_count = Some(value);
self
}
pub fn only_new_members(mut self, value: bool) -> Self {
self.only_new_members = Some(value);
self
}
pub fn was_refunded(mut self, value: bool) -> Self {
self.was_refunded = Some(value);
self
}
pub fn prize_description(mut self, value: impl Into<String>) -> Self {
self.prize_description = Some(value.into());
self
}
}
#[doc = "This object describes a message that was deleted or is otherwise inaccessible to the bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InaccessibleMessage {
#[doc = "Chat the message belonged to"]
pub chat: Box<Chat>,
#[doc = "Unique message identifier inside the chat"]
pub message_id: i64,
#[doc = "Always 0. The field can be used to differentiate regular and inaccessible messages."]
pub date: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InaccessibleMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.date, output);
}
}
impl InaccessibleMessage {
pub fn new(chat: Box<Chat>, message_id: i64) -> Self {
Self {
chat,
message_id,
date: 0,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineKeyboardButton {
#[doc = "Label text on the button"]
pub text: String,
#[doc = "Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
#[doc = "Style of the button. Must be one of 'danger' (red), 'success' (green) or 'primary' (blue). If omitted, then an app-specific style is used."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub style: Option<String>,
#[doc = "HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[doc = "Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub callback_data: Option<String>,
#[doc = "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a business account."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub web_app: Option<WebAppInfo>,
#[doc = "An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub login_url: Option<LoginUrl>,
#[doc = "If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a business account."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub switch_inline_query: Option<String>,
#[doc = "If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub switch_inline_query_current_chat: Option<String>,
#[doc = "If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a business account."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub switch_inline_query_chosen_chat: Option<SwitchInlineQueryChosenChat>,
#[doc = "Description of the button that copies the specified text to the clipboard"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub copy_text: Option<CopyTextButton>,
#[doc = "Description of the game that will be launched when the user presses the button."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub callback_game: Option<CallbackGame>,
#[doc = "Specify True, to send a Pay button. Substrings '' and 'XTR' in the buttons's text will be replaced with a Telegram Star icon."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pay: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineKeyboardButton {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.icon_custom_emoji_id, output);
CollectFiles::collect_files(&self.style, output);
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.callback_data, output);
CollectFiles::collect_files(&self.web_app, output);
CollectFiles::collect_files(&self.login_url, output);
CollectFiles::collect_files(&self.switch_inline_query, output);
CollectFiles::collect_files(&self.switch_inline_query_current_chat, output);
CollectFiles::collect_files(&self.switch_inline_query_chosen_chat, output);
CollectFiles::collect_files(&self.copy_text, output);
CollectFiles::collect_files(&self.callback_game, output);
CollectFiles::collect_files(&self.pay, output);
}
}
impl InlineKeyboardButton {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
icon_custom_emoji_id: None,
style: None,
url: None,
callback_data: None,
web_app: None,
login_url: None,
switch_inline_query: None,
switch_inline_query_current_chat: None,
switch_inline_query_chosen_chat: None,
copy_text: None,
callback_game: None,
pay: None,
extra: BTreeMap::new(),
}
}
pub fn icon_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.icon_custom_emoji_id = Some(value.into());
self
}
pub fn style(mut self, value: impl Into<String>) -> Self {
self.style = Some(value.into());
self
}
pub fn url(mut self, value: impl Into<String>) -> Self {
self.url = Some(value.into());
self
}
pub fn callback_data(mut self, value: impl Into<String>) -> Self {
self.callback_data = Some(value.into());
self
}
pub fn web_app(mut self, value: WebAppInfo) -> Self {
self.web_app = Some(value);
self
}
pub fn login_url(mut self, value: LoginUrl) -> Self {
self.login_url = Some(value);
self
}
pub fn switch_inline_query(mut self, value: impl Into<String>) -> Self {
self.switch_inline_query = Some(value.into());
self
}
pub fn switch_inline_query_current_chat(mut self, value: impl Into<String>) -> Self {
self.switch_inline_query_current_chat = Some(value.into());
self
}
pub fn switch_inline_query_chosen_chat(mut self, value: SwitchInlineQueryChosenChat) -> Self {
self.switch_inline_query_chosen_chat = Some(value);
self
}
pub fn copy_text(mut self, value: CopyTextButton) -> Self {
self.copy_text = Some(value);
self
}
pub fn callback_game(mut self, value: CallbackGame) -> Self {
self.callback_game = Some(value);
self
}
pub fn pay(mut self, value: bool) -> Self {
self.pay = Some(value);
self
}
}
#[doc = "This object represents an inline keyboard that appears right next to the message it belongs to."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineKeyboardMarkup {
#[doc = "Array of button rows, each represented by an Array of InlineKeyboardButton objects"]
pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineKeyboardMarkup {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.inline_keyboard, output);
}
}
impl InlineKeyboardMarkup {
pub fn new(inline_keyboard: Vec<Vec<InlineKeyboardButton>>) -> Self {
Self {
inline_keyboard,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQuery {
#[doc = "Unique identifier for this query"]
pub id: String,
#[doc = "Sender"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Text of the query (up to 256 characters)"]
pub query: String,
#[doc = "Offset of the results to be returned, can be controlled by the bot"]
pub offset: String,
#[doc = "Type of the chat from which the inline query was sent. Can be either 'sender' for a private chat with the inline query sender, 'private', 'group', 'supergroup', or 'channel'. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_type: Option<String>,
#[doc = "Sender location, only for bots that request user location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQuery {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.query, output);
CollectFiles::collect_files(&self.offset, output);
CollectFiles::collect_files(&self.chat_type, output);
CollectFiles::collect_files(&self.location, output);
}
}
impl InlineQuery {
pub fn new(
id: impl Into<String>,
from_user: User,
query: impl Into<String>,
offset: impl Into<String>,
) -> Self {
Self {
id: id.into(),
from_user,
query: query.into(),
offset: offset.into(),
chat_type: None,
location: None,
extra: BTreeMap::new(),
}
}
pub fn chat_type(mut self, value: impl Into<String>) -> Self {
self.chat_type = Some(value.into());
self
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
}
#[doc = "This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResult {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResult {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InlineQueryResult {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InlineQueryResult {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents a link to an article or web page."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultArticle {
#[doc = "Type of the result, must be article"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 Bytes"]
pub id: String,
#[doc = "Title of the result"]
pub title: String,
#[doc = "Content of the message to be sent"]
pub input_message_content: InputMessageContentUnion,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "URL of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Url of the thumbnail for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
#[doc = "Thumbnail width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_width: Option<i64>,
#[doc = "Thumbnail height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_height: Option<i64>,
#[doc = "Pass True if you don't want the URL to be shown in the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub hide_url: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultArticle {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.input_message_content, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.thumbnail_width, output);
CollectFiles::collect_files(&self.thumbnail_height, output);
CollectFiles::collect_files(&self.hide_url, output);
}
}
impl InlineQueryResultArticle {
pub fn new(
id: impl Into<String>,
title: impl Into<String>,
input_message_content: impl Into<InputMessageContentUnion>,
) -> Self {
Self {
kind: "article".to_owned(),
id: id.into(),
title: title.into(),
input_message_content: input_message_content.into(),
reply_markup: None,
url: None,
description: None,
thumbnail_url: None,
thumbnail_width: None,
thumbnail_height: None,
hide_url: None,
extra: BTreeMap::new(),
}
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn url(mut self, value: impl Into<String>) -> Self {
self.url = Some(value.into());
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn thumbnail_url(mut self, value: impl Into<String>) -> Self {
self.thumbnail_url = Some(value.into());
self
}
pub fn thumbnail_width(mut self, value: i64) -> Self {
self.thumbnail_width = Some(value);
self
}
pub fn thumbnail_height(mut self, value: i64) -> Self {
self.thumbnail_height = Some(value);
self
}
pub fn hide_url(mut self, value: bool) -> Self {
self.hide_url = Some(value);
self
}
}
#[doc = "Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultAudio {
#[doc = "Type of the result, must be audio"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL for the audio file"]
pub audio_url: String,
#[doc = "Title"]
pub title: String,
#[doc = "Caption, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the audio caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Performer"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub performer: Option<String>,
#[doc = "Audio duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio_duration: Option<i64>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the audio"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultAudio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.audio_url, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.performer, output);
CollectFiles::collect_files(&self.audio_duration, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultAudio {
pub fn new(
id: impl Into<String>,
audio_url: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
kind: "audio".to_owned(),
id: id.into(),
audio_url: audio_url.into(),
title: title.into(),
caption: None,
parse_mode: None,
caption_entities: None,
performer: None,
audio_duration: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn performer(mut self, value: impl Into<String>) -> Self {
self.performer = Some(value.into());
self
}
pub fn audio_duration(mut self, value: i64) -> Self {
self.audio_duration = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedAudio {
#[doc = "Type of the result, must be audio"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier for the audio file"]
pub audio_file_id: String,
#[doc = "Caption, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the audio caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the audio"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedAudio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.audio_file_id, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedAudio {
pub fn new(id: impl Into<String>, audio_file_id: impl Into<String>) -> Self {
Self {
kind: "audio".to_owned(),
id: id.into(),
audio_file_id: audio_file_id.into(),
caption: None,
parse_mode: None,
caption_entities: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedDocument {
#[doc = "Type of the result, must be document"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "Title for the result"]
pub title: String,
#[doc = "A valid file identifier for the file"]
pub document_file_id: String,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Caption of the document to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the document caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedDocument {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.document_file_id, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedDocument {
pub fn new(
id: impl Into<String>,
title: impl Into<String>,
document_file_id: impl Into<String>,
) -> Self {
Self {
kind: "document".to_owned(),
id: id.into(),
title: title.into(),
document_file_id: document_file_id.into(),
description: None,
caption: None,
parse_mode: None,
caption_entities: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedGif {
#[doc = "Type of the result, must be gif"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier for the GIF file"]
pub gif_file_id: String,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Caption of the GIF file to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the GIF animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedGif {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.gif_file_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedGif {
pub fn new(id: impl Into<String>, gif_file_id: impl Into<String>) -> Self {
Self {
kind: "gif".to_owned(),
id: id.into(),
gif_file_id: gif_file_id.into(),
title: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedMpeg4Gif {
#[doc = "Type of the result, must be mpeg4_gif"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier for the MPEG4 file"]
pub mpeg4_file_id: String,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the video animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedMpeg4Gif {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.mpeg4_file_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedMpeg4Gif {
pub fn new(id: impl Into<String>, mpeg4_file_id: impl Into<String>) -> Self {
Self {
kind: "mpeg4_gif".to_owned(),
id: id.into(),
mpeg4_file_id: mpeg4_file_id.into(),
title: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedPhoto {
#[doc = "Type of the result, must be photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier of the photo"]
pub photo_file_id: String,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Caption of the photo to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the photo caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.photo_file_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedPhoto {
pub fn new(id: impl Into<String>, photo_file_id: impl Into<String>) -> Self {
Self {
kind: "photo".to_owned(),
id: id.into(),
photo_file_id: photo_file_id.into(),
title: None,
description: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedSticker {
#[doc = "Type of the result, must be sticker"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier of the sticker"]
pub sticker_file_id: String,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the sticker"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedSticker {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.sticker_file_id, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedSticker {
pub fn new(id: impl Into<String>, sticker_file_id: impl Into<String>) -> Self {
Self {
kind: "sticker".to_owned(),
id: id.into(),
sticker_file_id: sticker_file_id.into(),
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedVideo {
#[doc = "Type of the result, must be video"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier for the video file"]
pub video_file_id: String,
#[doc = "Title for the result"]
pub title: String,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Caption of the video to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the video caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the video"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.video_file_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedVideo {
pub fn new(
id: impl Into<String>,
video_file_id: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
kind: "video".to_owned(),
id: id.into(),
video_file_id: video_file_id.into(),
title: title.into(),
description: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultCachedVoice {
#[doc = "Type of the result, must be voice"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid file identifier for the voice message"]
pub voice_file_id: String,
#[doc = "Voice message title"]
pub title: String,
#[doc = "Caption, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the voice message caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the voice message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultCachedVoice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.voice_file_id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultCachedVoice {
pub fn new(
id: impl Into<String>,
voice_file_id: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
kind: "voice".to_owned(),
id: id.into(),
voice_file_id: voice_file_id.into(),
title: title.into(),
caption: None,
parse_mode: None,
caption_entities: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultContact {
#[doc = "Type of the result, must be contact"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 Bytes"]
pub id: String,
#[doc = "Contact's phone number"]
pub phone_number: String,
#[doc = "Contact's first name"]
pub first_name: String,
#[doc = "Contact's last name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "Additional data about the contact in the form of a vCard, 0-2048 bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vcard: Option<String>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the contact"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[doc = "Url of the thumbnail for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
#[doc = "Thumbnail width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_width: Option<i64>,
#[doc = "Thumbnail height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_height: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultContact {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.phone_number, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.vcard, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.thumbnail_width, output);
CollectFiles::collect_files(&self.thumbnail_height, output);
}
}
impl InlineQueryResultContact {
pub fn new(
id: impl Into<String>,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> Self {
Self {
kind: "contact".to_owned(),
id: id.into(),
phone_number: phone_number.into(),
first_name: first_name.into(),
last_name: None,
vcard: None,
reply_markup: None,
input_message_content: None,
thumbnail_url: None,
thumbnail_width: None,
thumbnail_height: None,
extra: BTreeMap::new(),
}
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn vcard(mut self, value: impl Into<String>) -> Self {
self.vcard = Some(value.into());
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
pub fn thumbnail_url(mut self, value: impl Into<String>) -> Self {
self.thumbnail_url = Some(value.into());
self
}
pub fn thumbnail_width(mut self, value: i64) -> Self {
self.thumbnail_width = Some(value);
self
}
pub fn thumbnail_height(mut self, value: i64) -> Self {
self.thumbnail_height = Some(value);
self
}
}
#[doc = "Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultDocument {
#[doc = "Type of the result, must be document"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "Title for the result"]
pub title: String,
#[doc = "A valid URL for the file"]
pub document_url: String,
#[doc = "MIME type of the content of the file, either 'application/pdf' or 'application/zip'"]
pub mime_type: String,
#[doc = "Caption of the document to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the document caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[doc = "URL of the thumbnail (JPEG only) for the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
#[doc = "Thumbnail width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_width: Option<i64>,
#[doc = "Thumbnail height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_height: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultDocument {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.document_url, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.thumbnail_width, output);
CollectFiles::collect_files(&self.thumbnail_height, output);
}
}
impl InlineQueryResultDocument {
pub fn new(
id: impl Into<String>,
title: impl Into<String>,
document_url: impl Into<String>,
mime_type: impl Into<String>,
) -> Self {
Self {
kind: "document".to_owned(),
id: id.into(),
title: title.into(),
document_url: document_url.into(),
mime_type: mime_type.into(),
caption: None,
parse_mode: None,
caption_entities: None,
description: None,
reply_markup: None,
input_message_content: None,
thumbnail_url: None,
thumbnail_width: None,
thumbnail_height: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
pub fn thumbnail_url(mut self, value: impl Into<String>) -> Self {
self.thumbnail_url = Some(value.into());
self
}
pub fn thumbnail_width(mut self, value: i64) -> Self {
self.thumbnail_width = Some(value);
self
}
pub fn thumbnail_height(mut self, value: i64) -> Self {
self.thumbnail_height = Some(value);
self
}
}
#[doc = "Represents a Game."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultGame {
#[doc = "Type of the result, must be game"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "Short name of the game"]
pub game_short_name: String,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultGame {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.game_short_name, output);
CollectFiles::collect_files(&self.reply_markup, output);
}
}
impl InlineQueryResultGame {
pub fn new(id: impl Into<String>, game_short_name: impl Into<String>) -> Self {
Self {
kind: "game".to_owned(),
id: id.into(),
game_short_name: game_short_name.into(),
reply_markup: None,
extra: BTreeMap::new(),
}
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
}
#[doc = "Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultGif {
#[doc = "Type of the result, must be gif"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL for the GIF file"]
pub gif_url: String,
#[doc = "URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"]
pub thumbnail_url: String,
#[doc = "Width of the GIF"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gif_width: Option<i64>,
#[doc = "Height of the GIF"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gif_height: Option<i64>,
#[doc = "Duration of the GIF in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gif_duration: Option<i64>,
#[doc = "MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_mime_type: Option<String>,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Caption of the GIF file to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the GIF animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultGif {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.gif_url, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.gif_width, output);
CollectFiles::collect_files(&self.gif_height, output);
CollectFiles::collect_files(&self.gif_duration, output);
CollectFiles::collect_files(&self.thumbnail_mime_type, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultGif {
pub fn new(
id: impl Into<String>,
gif_url: impl Into<String>,
thumbnail_url: impl Into<String>,
) -> Self {
Self {
kind: "gif".to_owned(),
id: id.into(),
gif_url: gif_url.into(),
thumbnail_url: thumbnail_url.into(),
gif_width: None,
gif_height: None,
gif_duration: None,
thumbnail_mime_type: None,
title: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn gif_width(mut self, value: i64) -> Self {
self.gif_width = Some(value);
self
}
pub fn gif_height(mut self, value: i64) -> Self {
self.gif_height = Some(value);
self
}
pub fn gif_duration(mut self, value: i64) -> Self {
self.gif_duration = Some(value);
self
}
pub fn thumbnail_mime_type(mut self, value: impl Into<String>) -> Self {
self.thumbnail_mime_type = Some(value.into());
self
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultLocation {
#[doc = "Type of the result, must be location"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 Bytes"]
pub id: String,
#[doc = "Location latitude in degrees"]
pub latitude: f64,
#[doc = "Location longitude in degrees"]
pub longitude: f64,
#[doc = "Location title"]
pub title: String,
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub horizontal_accuracy: Option<f64>,
#[doc = "Period in seconds during which the location can be updated, must be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_period: Option<i64>,
#[doc = "For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub heading: Option<i64>,
#[doc = "For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub proximity_alert_radius: Option<i64>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[doc = "Url of the thumbnail for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
#[doc = "Thumbnail width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_width: Option<i64>,
#[doc = "Thumbnail height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_height: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultLocation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.horizontal_accuracy, output);
CollectFiles::collect_files(&self.live_period, output);
CollectFiles::collect_files(&self.heading, output);
CollectFiles::collect_files(&self.proximity_alert_radius, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.thumbnail_width, output);
CollectFiles::collect_files(&self.thumbnail_height, output);
}
}
impl InlineQueryResultLocation {
pub fn new(
id: impl Into<String>,
latitude: f64,
longitude: f64,
title: impl Into<String>,
) -> Self {
Self {
kind: "location".to_owned(),
id: id.into(),
latitude,
longitude,
title: title.into(),
horizontal_accuracy: None,
live_period: None,
heading: None,
proximity_alert_radius: None,
reply_markup: None,
input_message_content: None,
thumbnail_url: None,
thumbnail_width: None,
thumbnail_height: None,
extra: BTreeMap::new(),
}
}
pub fn horizontal_accuracy(mut self, value: f64) -> Self {
self.horizontal_accuracy = Some(value);
self
}
pub fn live_period(mut self, value: i64) -> Self {
self.live_period = Some(value);
self
}
pub fn heading(mut self, value: i64) -> Self {
self.heading = Some(value);
self
}
pub fn proximity_alert_radius(mut self, value: i64) -> Self {
self.proximity_alert_radius = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
pub fn thumbnail_url(mut self, value: impl Into<String>) -> Self {
self.thumbnail_url = Some(value.into());
self
}
pub fn thumbnail_width(mut self, value: i64) -> Self {
self.thumbnail_width = Some(value);
self
}
pub fn thumbnail_height(mut self, value: i64) -> Self {
self.thumbnail_height = Some(value);
self
}
}
#[doc = "Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultMpeg4Gif {
#[doc = "Type of the result, must be mpeg4_gif"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL for the MPEG4 file"]
pub mpeg4_url: String,
#[doc = "URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"]
pub thumbnail_url: String,
#[doc = "Video width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mpeg4_width: Option<i64>,
#[doc = "Video height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mpeg4_height: Option<i64>,
#[doc = "Video duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mpeg4_duration: Option<i64>,
#[doc = "MIME type of the thumbnail, must be one of 'image/jpeg', 'image/gif', or 'video/mp4'. Defaults to 'image/jpeg'."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_mime_type: Option<String>,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the video animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultMpeg4Gif {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.mpeg4_url, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.mpeg4_width, output);
CollectFiles::collect_files(&self.mpeg4_height, output);
CollectFiles::collect_files(&self.mpeg4_duration, output);
CollectFiles::collect_files(&self.thumbnail_mime_type, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultMpeg4Gif {
pub fn new(
id: impl Into<String>,
mpeg4_url: impl Into<String>,
thumbnail_url: impl Into<String>,
) -> Self {
Self {
kind: "mpeg4_gif".to_owned(),
id: id.into(),
mpeg4_url: mpeg4_url.into(),
thumbnail_url: thumbnail_url.into(),
mpeg4_width: None,
mpeg4_height: None,
mpeg4_duration: None,
thumbnail_mime_type: None,
title: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn mpeg4_width(mut self, value: i64) -> Self {
self.mpeg4_width = Some(value);
self
}
pub fn mpeg4_height(mut self, value: i64) -> Self {
self.mpeg4_height = Some(value);
self
}
pub fn mpeg4_duration(mut self, value: i64) -> Self {
self.mpeg4_duration = Some(value);
self
}
pub fn thumbnail_mime_type(mut self, value: impl Into<String>) -> Self {
self.thumbnail_mime_type = Some(value.into());
self
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultPhoto {
#[doc = "Type of the result, must be photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB."]
pub photo_url: String,
#[doc = "URL of the thumbnail for the photo"]
pub thumbnail_url: String,
#[doc = "Width of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_width: Option<i64>,
#[doc = "Height of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_height: Option<i64>,
#[doc = "Title for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Caption of the photo to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the photo caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.photo_url, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.photo_width, output);
CollectFiles::collect_files(&self.photo_height, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultPhoto {
pub fn new(
id: impl Into<String>,
photo_url: impl Into<String>,
thumbnail_url: impl Into<String>,
) -> Self {
Self {
kind: "photo".to_owned(),
id: id.into(),
photo_url: photo_url.into(),
thumbnail_url: thumbnail_url.into(),
photo_width: None,
photo_height: None,
title: None,
description: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn photo_width(mut self, value: i64) -> Self {
self.photo_width = Some(value);
self
}
pub fn photo_height(mut self, value: i64) -> Self {
self.photo_height = Some(value);
self
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultVenue {
#[doc = "Type of the result, must be venue"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 Bytes"]
pub id: String,
#[doc = "Latitude of the venue location in degrees"]
pub latitude: f64,
#[doc = "Longitude of the venue location in degrees"]
pub longitude: f64,
#[doc = "Title of the venue"]
pub title: String,
#[doc = "Address of the venue"]
pub address: String,
#[doc = "Foursquare identifier of the venue if known"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<String>,
#[doc = "Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<String>,
#[doc = "Google Places identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_id: Option<String>,
#[doc = "Google Places type of the venue. (See supported types.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_type: Option<String>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[doc = "Url of the thumbnail for the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_url: Option<String>,
#[doc = "Thumbnail width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_width: Option<i64>,
#[doc = "Thumbnail height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail_height: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultVenue {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.address, output);
CollectFiles::collect_files(&self.foursquare_id, output);
CollectFiles::collect_files(&self.foursquare_type, output);
CollectFiles::collect_files(&self.google_place_id, output);
CollectFiles::collect_files(&self.google_place_type, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.thumbnail_width, output);
CollectFiles::collect_files(&self.thumbnail_height, output);
}
}
impl InlineQueryResultVenue {
pub fn new(
id: impl Into<String>,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> Self {
Self {
kind: "venue".to_owned(),
id: id.into(),
latitude,
longitude,
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
reply_markup: None,
input_message_content: None,
thumbnail_url: None,
thumbnail_width: None,
thumbnail_height: None,
extra: BTreeMap::new(),
}
}
pub fn foursquare_id(mut self, value: impl Into<String>) -> Self {
self.foursquare_id = Some(value.into());
self
}
pub fn foursquare_type(mut self, value: impl Into<String>) -> Self {
self.foursquare_type = Some(value.into());
self
}
pub fn google_place_id(mut self, value: impl Into<String>) -> Self {
self.google_place_id = Some(value.into());
self
}
pub fn google_place_type(mut self, value: impl Into<String>) -> Self {
self.google_place_type = Some(value.into());
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
pub fn thumbnail_url(mut self, value: impl Into<String>) -> Self {
self.thumbnail_url = Some(value.into());
self
}
pub fn thumbnail_width(mut self, value: i64) -> Self {
self.thumbnail_width = Some(value);
self
}
pub fn thumbnail_height(mut self, value: i64) -> Self {
self.thumbnail_height = Some(value);
self
}
}
#[doc = "Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultVideo {
#[doc = "Type of the result, must be video"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL for the embedded video player or video file"]
pub video_url: String,
#[doc = "MIME type of the content of the video URL, 'text/html' or 'video/mp4'"]
pub mime_type: String,
#[doc = "URL of the thumbnail (JPEG only) for the video"]
pub thumbnail_url: String,
#[doc = "Title for the result"]
pub title: String,
#[doc = "Caption of the video to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the video caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Video width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_width: Option<i64>,
#[doc = "Video height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_height: Option<i64>,
#[doc = "Video duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_duration: Option<i64>,
#[doc = "Short description of the result"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video)."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.video_url, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.thumbnail_url, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.video_width, output);
CollectFiles::collect_files(&self.video_height, output);
CollectFiles::collect_files(&self.video_duration, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultVideo {
pub fn new(
id: impl Into<String>,
video_url: impl Into<String>,
mime_type: impl Into<String>,
thumbnail_url: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
kind: "video".to_owned(),
id: id.into(),
video_url: video_url.into(),
mime_type: mime_type.into(),
thumbnail_url: thumbnail_url.into(),
title: title.into(),
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
video_width: None,
video_height: None,
video_duration: None,
description: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn video_width(mut self, value: i64) -> Self {
self.video_width = Some(value);
self
}
pub fn video_height(mut self, value: i64) -> Self {
self.video_height = Some(value);
self
}
pub fn video_duration(mut self, value: i64) -> Self {
self.video_duration = Some(value);
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultVoice {
#[doc = "Type of the result, must be voice"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier for this result, 1-64 bytes"]
pub id: String,
#[doc = "A valid URL for the voice recording"]
pub voice_url: String,
#[doc = "Recording title"]
pub title: String,
#[doc = "Caption, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the voice message caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Recording duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub voice_duration: Option<i64>,
#[doc = "Inline keyboard attached to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Content of the message to be sent instead of the voice recording"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_message_content: Option<InputMessageContentUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultVoice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.voice_url, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.voice_duration, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.input_message_content, output);
}
}
impl InlineQueryResultVoice {
pub fn new(
id: impl Into<String>,
voice_url: impl Into<String>,
title: impl Into<String>,
) -> Self {
Self {
kind: "voice".to_owned(),
id: id.into(),
voice_url: voice_url.into(),
title: title.into(),
caption: None,
parse_mode: None,
caption_entities: None,
voice_duration: None,
reply_markup: None,
input_message_content: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn voice_duration(mut self, value: i64) -> Self {
self.voice_duration = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn input_message_content(mut self, value: impl Into<InputMessageContentUnion>) -> Self {
self.input_message_content = Some(value.into());
self
}
}
#[doc = "This object represents a button to be shown above inline query results. You must use exactly one of the optional fields."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InlineQueryResultsButton {
#[doc = "Label text on the button"]
pub text: String,
#[doc = "Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub web_app: Option<WebAppInfo>,
#[doc = "Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub start_parameter: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InlineQueryResultsButton {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.web_app, output);
CollectFiles::collect_files(&self.start_parameter, output);
}
}
impl InlineQueryResultsButton {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
web_app: None,
start_parameter: None,
extra: BTreeMap::new(),
}
}
pub fn web_app(mut self, value: WebAppInfo) -> Self {
self.web_app = Some(value);
self
}
pub fn start_parameter(mut self, value: impl Into<String>) -> Self {
self.start_parameter = Some(value.into());
self
}
}
#[doc = "Describes a checklist to create."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputChecklist {
#[doc = "Title of the checklist; 1-255 characters after entities parsing"]
pub title: String,
#[doc = "List of 1-30 tasks in the checklist"]
pub tasks: Vec<InputChecklistTask>,
#[doc = "Mode for parsing entities in the title. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if other users can add tasks to the checklist"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub others_can_add_tasks: Option<bool>,
#[doc = "Pass True if other users can mark tasks as done or not done in the checklist"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub others_can_mark_tasks_as_done: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputChecklist {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.tasks, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.title_entities, output);
CollectFiles::collect_files(&self.others_can_add_tasks, output);
CollectFiles::collect_files(&self.others_can_mark_tasks_as_done, output);
}
}
impl InputChecklist {
pub fn new(title: impl Into<String>, tasks: Vec<InputChecklistTask>) -> Self {
Self {
title: title.into(),
tasks,
parse_mode: None,
title_entities: None,
others_can_add_tasks: None,
others_can_mark_tasks_as_done: None,
extra: BTreeMap::new(),
}
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn title_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.title_entities = Some(value);
self
}
pub fn others_can_add_tasks(mut self, value: bool) -> Self {
self.others_can_add_tasks = Some(value);
self
}
pub fn others_can_mark_tasks_as_done(mut self, value: bool) -> Self {
self.others_can_mark_tasks_as_done = Some(value);
self
}
}
#[doc = "Describes a task to add to a checklist."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputChecklistTask {
#[doc = "Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist"]
pub id: i64,
#[doc = "Text of the task; 1-100 characters after entities parsing"]
pub text: String,
#[doc = "Mode for parsing entities in the text. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_entities: Option<Vec<MessageEntity>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputChecklistTask {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.text_entities, output);
}
}
impl InputChecklistTask {
pub fn new(id: i64, text: impl Into<String>) -> Self {
Self {
id,
text: text.into(),
parse_mode: None,
text_entities: None,
extra: BTreeMap::new(),
}
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.text_entities = Some(value);
self
}
}
#[doc = "Represents the content of a contact message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputContactMessageContent {
#[doc = "Contact's phone number"]
pub phone_number: String,
#[doc = "Contact's first name"]
pub first_name: String,
#[doc = "Contact's last name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "Additional data about the contact in the form of a vCard, 0-2048 bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vcard: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputContactMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.phone_number, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.vcard, output);
}
}
impl InputContactMessageContent {
pub fn new(phone_number: impl Into<String>, first_name: impl Into<String>) -> Self {
Self {
phone_number: phone_number.into(),
first_name: first_name.into(),
last_name: None,
vcard: None,
extra: BTreeMap::new(),
}
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn vcard(mut self, value: impl Into<String>) -> Self {
self.vcard = Some(value.into());
self
}
}
#[doc = "Represents the content of an invoice message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputInvoiceMessageContent {
#[doc = "Product name, 1-32 characters"]
pub title: String,
#[doc = "Product description, 1-255 characters"]
pub description: String,
#[doc = "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."]
pub payload: String,
#[doc = "Three-letter ISO 4217 currency code, see more on currencies. Pass 'XTR' for payments in Telegram Stars."]
pub currency: String,
#[doc = "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."]
pub prices: Vec<LabeledPrice>,
#[doc = "Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub provider_token: Option<String>,
#[doc = "The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_tip_amount: Option<i64>,
#[doc = "A JSON-serialized Array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_tip_amounts: Option<Vec<i64>>,
#[doc = "A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub provider_data: Option<String>,
#[doc = "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_url: Option<String>,
#[doc = "Photo size in bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_size: Option<i64>,
#[doc = "Photo width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_width: Option<i64>,
#[doc = "Photo height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo_height: Option<i64>,
#[doc = "Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub need_name: Option<bool>,
#[doc = "Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub need_phone_number: Option<bool>,
#[doc = "Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub need_email: Option<bool>,
#[doc = "Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub need_shipping_address: Option<bool>,
#[doc = "Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub send_phone_number_to_provider: Option<bool>,
#[doc = "Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub send_email_to_provider: Option<bool>,
#[doc = "Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_flexible: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputInvoiceMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.payload, output);
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.prices, output);
CollectFiles::collect_files(&self.provider_token, output);
CollectFiles::collect_files(&self.max_tip_amount, output);
CollectFiles::collect_files(&self.suggested_tip_amounts, output);
CollectFiles::collect_files(&self.provider_data, output);
CollectFiles::collect_files(&self.photo_url, output);
CollectFiles::collect_files(&self.photo_size, output);
CollectFiles::collect_files(&self.photo_width, output);
CollectFiles::collect_files(&self.photo_height, output);
CollectFiles::collect_files(&self.need_name, output);
CollectFiles::collect_files(&self.need_phone_number, output);
CollectFiles::collect_files(&self.need_email, output);
CollectFiles::collect_files(&self.need_shipping_address, output);
CollectFiles::collect_files(&self.send_phone_number_to_provider, output);
CollectFiles::collect_files(&self.send_email_to_provider, output);
CollectFiles::collect_files(&self.is_flexible, output);
}
}
impl InputInvoiceMessageContent {
pub fn new(
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<LabeledPrice>,
) -> Self {
Self {
title: title.into(),
description: description.into(),
payload: payload.into(),
currency: currency.into(),
prices,
provider_token: None,
max_tip_amount: None,
suggested_tip_amounts: None,
provider_data: None,
photo_url: None,
photo_size: None,
photo_width: None,
photo_height: None,
need_name: None,
need_phone_number: None,
need_email: None,
need_shipping_address: None,
send_phone_number_to_provider: None,
send_email_to_provider: None,
is_flexible: None,
extra: BTreeMap::new(),
}
}
pub fn provider_token(mut self, value: impl Into<String>) -> Self {
self.provider_token = Some(value.into());
self
}
pub fn max_tip_amount(mut self, value: i64) -> Self {
self.max_tip_amount = Some(value);
self
}
pub fn suggested_tip_amounts(mut self, value: Vec<i64>) -> Self {
self.suggested_tip_amounts = Some(value);
self
}
pub fn provider_data(mut self, value: impl Into<String>) -> Self {
self.provider_data = Some(value.into());
self
}
pub fn photo_url(mut self, value: impl Into<String>) -> Self {
self.photo_url = Some(value.into());
self
}
pub fn photo_size(mut self, value: i64) -> Self {
self.photo_size = Some(value);
self
}
pub fn photo_width(mut self, value: i64) -> Self {
self.photo_width = Some(value);
self
}
pub fn photo_height(mut self, value: i64) -> Self {
self.photo_height = Some(value);
self
}
pub fn need_name(mut self, value: bool) -> Self {
self.need_name = Some(value);
self
}
pub fn need_phone_number(mut self, value: bool) -> Self {
self.need_phone_number = Some(value);
self
}
pub fn need_email(mut self, value: bool) -> Self {
self.need_email = Some(value);
self
}
pub fn need_shipping_address(mut self, value: bool) -> Self {
self.need_shipping_address = Some(value);
self
}
pub fn send_phone_number_to_provider(mut self, value: bool) -> Self {
self.send_phone_number_to_provider = Some(value);
self
}
pub fn send_email_to_provider(mut self, value: bool) -> Self {
self.send_email_to_provider = Some(value);
self
}
pub fn is_flexible(mut self, value: bool) -> Self {
self.is_flexible = Some(value);
self
}
}
#[doc = "Represents the content of a location message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputLocationMessageContent {
#[doc = "Latitude of the location in degrees"]
pub latitude: f64,
#[doc = "Longitude of the location in degrees"]
pub longitude: f64,
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub horizontal_accuracy: Option<f64>,
#[doc = "Period in seconds during which the location can be updated, must be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_period: Option<i64>,
#[doc = "For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub heading: Option<i64>,
#[doc = "For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub proximity_alert_radius: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputLocationMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.horizontal_accuracy, output);
CollectFiles::collect_files(&self.live_period, output);
CollectFiles::collect_files(&self.heading, output);
CollectFiles::collect_files(&self.proximity_alert_radius, output);
}
}
impl InputLocationMessageContent {
pub fn new(latitude: f64, longitude: f64) -> Self {
Self {
latitude,
longitude,
horizontal_accuracy: None,
live_period: None,
heading: None,
proximity_alert_radius: None,
extra: BTreeMap::new(),
}
}
pub fn horizontal_accuracy(mut self, value: f64) -> Self {
self.horizontal_accuracy = Some(value);
self
}
pub fn live_period(mut self, value: i64) -> Self {
self.live_period = Some(value);
self
}
pub fn heading(mut self, value: i64) -> Self {
self.heading = Some(value);
self
}
pub fn proximity_alert_radius(mut self, value: i64) -> Self {
self.proximity_alert_radius = Some(value);
self
}
}
#[doc = "This object represents the content of a media message to be sent. It should be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMedia {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMedia {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputMedia {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaAnimation {
#[doc = "Type of the media, must be animation"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "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 information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<super::InputFile>,
#[doc = "Caption of the animation to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the animation caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Animation width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[doc = "Animation height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[doc = "Animation duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[doc = "Pass True if the animation needs to be covered with a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaAnimation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.has_spoiler, output);
}
}
impl InputMediaAnimation {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "animation".to_owned(),
media: media.into(),
thumbnail: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
width: None,
height: None,
duration: None,
has_spoiler: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: impl Into<super::InputFile>) -> Self {
self.thumbnail = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn width(mut self, value: i64) -> Self {
self.width = Some(value);
self
}
pub fn height(mut self, value: i64) -> Self {
self.height = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
}
#[doc = "Represents an audio file to be treated as music to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaAudio {
#[doc = "Type of the media, must be audio"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "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 information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<super::InputFile>,
#[doc = "Caption of the audio to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the audio caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Duration of the audio in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[doc = "Performer of the audio"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub performer: Option<String>,
#[doc = "Title of the audio"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaAudio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.performer, output);
CollectFiles::collect_files(&self.title, output);
}
}
impl InputMediaAudio {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "audio".to_owned(),
media: media.into(),
thumbnail: None,
caption: None,
parse_mode: None,
caption_entities: None,
duration: None,
performer: None,
title: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: impl Into<super::InputFile>) -> Self {
self.thumbnail = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
pub fn performer(mut self, value: impl Into<String>) -> Self {
self.performer = Some(value.into());
self
}
pub fn title(mut self, value: impl Into<String>) -> Self {
self.title = Some(value.into());
self
}
}
#[doc = "Represents a general file to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaDocument {
#[doc = "Type of the media, must be document"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "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 information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<super::InputFile>,
#[doc = "Caption of the document to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the document caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub disable_content_type_detection: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaDocument {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.disable_content_type_detection, output);
}
}
impl InputMediaDocument {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "document".to_owned(),
media: media.into(),
thumbnail: None,
caption: None,
parse_mode: None,
caption_entities: None,
disable_content_type_detection: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: impl Into<super::InputFile>) -> Self {
self.thumbnail = Some(value.into());
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn disable_content_type_detection(mut self, value: bool) -> Self {
self.disable_content_type_detection = Some(value);
self
}
}
#[doc = "Represents an HTTP link to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaLink {
#[doc = "Type of the media, must be link"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "HTTP URL of the link"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaLink {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.url, output);
}
}
impl InputMediaLink {
pub fn new(url: impl Into<String>) -> Self {
Self {
kind: "link".to_owned(),
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents a live photo to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaLivePhoto {
#[doc = "Type of the media, must be live_photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Video of the live photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files. Sending live photos by a URL is currently unsupported."]
pub media: String,
#[doc = "The static photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files. Sending live photos by a URL is currently unsupported."]
pub photo: String,
#[doc = "Caption of the live photo to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the live photo caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Pass True if the live photo needs to be covered with a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaLivePhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.has_spoiler, output);
}
}
impl InputMediaLivePhoto {
pub fn new(media: impl Into<String>, photo: impl Into<String>) -> Self {
Self {
kind: "live_photo".to_owned(),
media: media.into(),
photo: photo.into(),
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
has_spoiler: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
}
#[doc = "Represents a location to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaLocation {
#[doc = "Type of the media, must be location"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Latitude of the location"]
pub latitude: f64,
#[doc = "Longitude of the location"]
pub longitude: f64,
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub horizontal_accuracy: Option<f64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaLocation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.horizontal_accuracy, output);
}
}
impl InputMediaLocation {
pub fn new(latitude: f64, longitude: f64) -> Self {
Self {
kind: "location".to_owned(),
latitude,
longitude,
horizontal_accuracy: None,
extra: BTreeMap::new(),
}
}
pub fn horizontal_accuracy(mut self, value: f64) -> Self {
self.horizontal_accuracy = Some(value);
self
}
}
#[doc = "Represents a photo to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaPhoto {
#[doc = "Type of the media, must be photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "Caption of the photo to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the photo caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Pass True if the photo needs to be covered with a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.has_spoiler, output);
}
}
impl InputMediaPhoto {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "photo".to_owned(),
media: media.into(),
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
has_spoiler: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
}
#[doc = "Represents a sticker file to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaSticker {
#[doc = "Type of the media, must be sticker"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a .WEBP sticker from the Internet, or pass 'attach://<file_attach_name>' to upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: String,
#[doc = "Emoji associated with the sticker; only for just uploaded stickers"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaSticker {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.emoji, output);
}
}
impl InputMediaSticker {
pub fn new(media: impl Into<String>) -> Self {
Self {
kind: "sticker".to_owned(),
media: media.into(),
emoji: None,
extra: BTreeMap::new(),
}
}
pub fn emoji(mut self, value: impl Into<String>) -> Self {
self.emoji = Some(value.into());
self
}
}
#[doc = "Represents a venue to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaVenue {
#[doc = "Type of the media, must be venue"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Latitude of the location"]
pub latitude: f64,
#[doc = "Longitude of the location"]
pub longitude: f64,
#[doc = "Name of the venue"]
pub title: String,
#[doc = "Address of the venue"]
pub address: String,
#[doc = "Foursquare identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<String>,
#[doc = "Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<String>,
#[doc = "Google Places identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_id: Option<String>,
#[doc = "Google Places type of the venue. (See supported types.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_type: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaVenue {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.address, output);
CollectFiles::collect_files(&self.foursquare_id, output);
CollectFiles::collect_files(&self.foursquare_type, output);
CollectFiles::collect_files(&self.google_place_id, output);
CollectFiles::collect_files(&self.google_place_type, output);
}
}
impl InputMediaVenue {
pub fn new(
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> Self {
Self {
kind: "venue".to_owned(),
latitude,
longitude,
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
extra: BTreeMap::new(),
}
}
pub fn foursquare_id(mut self, value: impl Into<String>) -> Self {
self.foursquare_id = Some(value.into());
self
}
pub fn foursquare_type(mut self, value: impl Into<String>) -> Self {
self.foursquare_type = Some(value.into());
self
}
pub fn google_place_id(mut self, value: impl Into<String>) -> Self {
self.google_place_id = Some(value.into());
self
}
pub fn google_place_type(mut self, value: impl Into<String>) -> Self {
self.google_place_type = Some(value.into());
self
}
}
#[doc = "Represents a video to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaVideo {
#[doc = "Type of the media, must be video"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "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 information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<super::InputFile>,
#[doc = "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cover: Option<super::InputFile>,
#[doc = "Start timestamp for the video in the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub start_timestamp: Option<i64>,
#[doc = "Caption of the video to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the video caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Pass True if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "Video width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[doc = "Video height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[doc = "Video duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[doc = "Pass True if the uploaded video is suitable for streaming"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_streaming: Option<bool>,
#[doc = "Pass True if the video needs to be covered with a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.cover, output);
CollectFiles::collect_files(&self.start_timestamp, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.supports_streaming, output);
CollectFiles::collect_files(&self.has_spoiler, output);
}
}
impl InputMediaVideo {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "video".to_owned(),
media: media.into(),
thumbnail: None,
cover: None,
start_timestamp: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
width: None,
height: None,
duration: None,
supports_streaming: None,
has_spoiler: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: impl Into<super::InputFile>) -> Self {
self.thumbnail = Some(value.into());
self
}
pub fn cover(mut self, value: impl Into<super::InputFile>) -> Self {
self.cover = Some(value.into());
self
}
pub fn start_timestamp(mut self, value: i64) -> Self {
self.start_timestamp = Some(value);
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn width(mut self, value: i64) -> Self {
self.width = Some(value);
self
}
pub fn height(mut self, value: i64) -> Self {
self.height = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
pub fn supports_streaming(mut self, value: bool) -> Self {
self.supports_streaming = Some(value);
self
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
}
#[doc = "Represents a voice message file to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMediaVoiceNote {
#[doc = "Type of the media, must be voice_note"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \"attach://<file_attach_name>\" to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: String,
#[doc = "Caption of the voice message to be sent, 0-1024 characters after entities parsing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "Mode for parsing entities in the voice message caption. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "Duration of the voice message in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMediaVoiceNote {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.duration, output);
}
}
impl InputMediaVoiceNote {
pub fn new(media: impl Into<String>) -> Self {
Self {
kind: "voice_note".to_owned(),
media: media.into(),
caption: None,
parse_mode: None,
caption_entities: None,
duration: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
}
#[doc = "This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following types:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputMessageContent {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputMessageContent {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputMessageContent {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputMessageContent {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object describes the paid media to be sent. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPaidMedia {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPaidMedia {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputPaidMedia {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputPaidMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "The paid media to send is a live photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPaidMediaLivePhoto {
#[doc = "Type of the media, must be live_photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Video of the live photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files. Sending live photos by a URL is currently unsupported."]
pub media: String,
#[doc = "The static photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files. Sending live photos by a URL is currently unsupported."]
pub photo: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPaidMediaLivePhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl InputPaidMediaLivePhoto {
pub fn new(media: impl Into<String>, photo: impl Into<String>) -> Self {
Self {
kind: "live_photo".to_owned(),
media: media.into(),
photo: photo.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media to send is a photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPaidMediaPhoto {
#[doc = "Type of the media, must be photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPaidMediaPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
}
}
impl InputPaidMediaPhoto {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "photo".to_owned(),
media: media.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media to send is a video."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPaidMediaVideo {
#[doc = "Type of the media, must be video"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
pub media: super::InputFile,
#[doc = "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 information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<super::InputFile>,
#[doc = "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cover: Option<super::InputFile>,
#[doc = "Start timestamp for the video in the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub start_timestamp: Option<i64>,
#[doc = "Video width"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[doc = "Video height"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[doc = "Video duration in seconds"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[doc = "Pass True if the uploaded video is suitable for streaming"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_streaming: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPaidMediaVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.cover, output);
CollectFiles::collect_files(&self.start_timestamp, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.supports_streaming, output);
}
}
impl InputPaidMediaVideo {
pub fn new(media: impl Into<super::InputFile>) -> Self {
Self {
kind: "video".to_owned(),
media: media.into(),
thumbnail: None,
cover: None,
start_timestamp: None,
width: None,
height: None,
duration: None,
supports_streaming: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: impl Into<super::InputFile>) -> Self {
self.thumbnail = Some(value.into());
self
}
pub fn cover(mut self, value: impl Into<super::InputFile>) -> Self {
self.cover = Some(value.into());
self
}
pub fn start_timestamp(mut self, value: i64) -> Self {
self.start_timestamp = Some(value);
self
}
pub fn width(mut self, value: i64) -> Self {
self.width = Some(value);
self
}
pub fn height(mut self, value: i64) -> Self {
self.height = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
pub fn supports_streaming(mut self, value: bool) -> Self {
self.supports_streaming = Some(value);
self
}
}
#[doc = "This object represents the content of a poll description or a quiz explanation to be sent. It should be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPollMedia {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPollMedia {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputPollMedia {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputPollMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains information about one answer option in a poll to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPollOption {
#[doc = "Option text, 1-100 characters"]
pub text: String,
#[doc = "Mode for parsing entities in the text. See formatting options for more details. Currently, only custom emoji entities are allowed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_parse_mode: Option<String>,
#[doc = "A JSON-serialized list of special entities that appear in the poll option text. It can be specified instead of text_parse_mode."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_entities: Option<Vec<MessageEntity>>,
#[doc = "Media added to the poll option"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub media: Option<InputPollOptionMediaUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPollOption {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.text_parse_mode, output);
CollectFiles::collect_files(&self.text_entities, output);
CollectFiles::collect_files(&self.media, output);
}
}
impl InputPollOption {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
text_parse_mode: None,
text_entities: None,
media: None,
extra: BTreeMap::new(),
}
}
pub fn text_parse_mode(mut self, value: impl Into<String>) -> Self {
self.text_parse_mode = Some(value.into());
self
}
pub fn text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.text_entities = Some(value);
self
}
pub fn media(mut self, value: impl Into<InputPollOptionMediaUnion>) -> Self {
self.media = Some(value.into());
self
}
}
#[doc = "This object represents the content of a poll option to be sent. It should be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputPollOptionMedia {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputPollOptionMedia {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputPollOptionMedia {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputPollOptionMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object describes a profile photo to set. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputProfilePhoto {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputProfilePhoto {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputProfilePhoto {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputProfilePhoto {
fn default() -> Self {
Self::new()
}
}
#[doc = "An animated profile photo in the MPEG4 format."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputProfilePhotoAnimated {
#[doc = "Type of the profile photo, must be animated"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files"]
pub animation: super::InputFile,
#[doc = "Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub main_frame_timestamp: Option<f64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputProfilePhotoAnimated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.main_frame_timestamp, output);
}
}
impl InputProfilePhotoAnimated {
pub fn new(animation: impl Into<super::InputFile>) -> Self {
Self {
kind: "animated".to_owned(),
animation: animation.into(),
main_frame_timestamp: None,
extra: BTreeMap::new(),
}
}
pub fn main_frame_timestamp(mut self, value: f64) -> Self {
self.main_frame_timestamp = Some(value);
self
}
}
#[doc = "A static profile photo in the .JPG format."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputProfilePhotoStatic {
#[doc = "Type of the profile photo, must be static"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files"]
pub photo: super::InputFile,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputProfilePhotoStatic {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl InputProfilePhotoStatic {
pub fn new(photo: impl Into<super::InputFile>) -> Self {
Self {
kind: "static".to_owned(),
photo: photo.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a block in a rich formatted message to be sent. Currently, it can be any of the following types:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlock {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlock {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputRichBlock {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputRichBlock {
fn default() -> Self {
Self::new()
}
}
#[doc = "A block with an anchor, corresponding to the HTML tag <a> with the attribute name."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockAnchor {
#[doc = "Type of the block, always 'anchor'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The name of the anchor"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockAnchor {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl InputRichBlockAnchor {
pub fn new(name: impl Into<String>) -> Self {
Self {
kind: "anchor".to_owned(),
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with an animation, corresponding to the HTML tag <video>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockAnimation {
#[doc = "Type of the block, always 'animation'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The animation. Caption is ignored."]
pub animation: InputMediaAnimation,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockAnimation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockAnimation {
pub fn new(animation: InputMediaAnimation) -> Self {
Self {
kind: "animation".to_owned(),
animation,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a music file, corresponding to the HTML tag <audio>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockAudio {
#[doc = "Type of the block, always 'audio'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The audio. Caption is ignored."]
pub audio: InputMediaAudio,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockAudio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.audio, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockAudio {
pub fn new(audio: InputMediaAudio) -> Self {
Self {
kind: "audio".to_owned(),
audio,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block quotation, corresponding to the HTML tag <blockquote>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockBlockQuotation {
#[doc = "Type of the block, always 'blockquote'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Content of the block"]
pub blocks: Vec<InputRichBlockUnion>,
#[doc = "Credit of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub credit: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockBlockQuotation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.credit, output);
}
}
impl InputRichBlockBlockQuotation {
pub fn new(blocks: Vec<InputRichBlockUnion>) -> Self {
Self {
kind: "blockquote".to_owned(),
blocks,
credit: None,
extra: BTreeMap::new(),
}
}
pub fn credit(mut self, value: Box<RichTextUnion>) -> Self {
self.credit = Some(value);
self
}
}
#[doc = "A collage, corresponding to the custom HTML tag <tg-collage>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockCollage {
#[doc = "Type of the block, always 'collage'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Elements of the collage"]
pub blocks: Vec<InputRichBlockUnion>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockCollage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockCollage {
pub fn new(blocks: Vec<InputRichBlockUnion>) -> Self {
Self {
kind: "collage".to_owned(),
blocks,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "An expandable block for details disclosure, corresponding to the HTML tag <details>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockDetails {
#[doc = "Type of the block, always 'details'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Always shown summary of the block"]
pub summary: Box<RichTextUnion>,
#[doc = "Content of the block"]
pub blocks: Vec<InputRichBlockUnion>,
#[doc = "Pass True if the content of the block is visible by default"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_open: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockDetails {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.summary, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.is_open, output);
}
}
impl InputRichBlockDetails {
pub fn new(summary: Box<RichTextUnion>, blocks: Vec<InputRichBlockUnion>) -> Self {
Self {
kind: "details".to_owned(),
summary,
blocks,
is_open: None,
extra: BTreeMap::new(),
}
}
pub fn is_open(mut self, value: bool) -> Self {
self.is_open = Some(value);
self
}
}
#[doc = "A divider, corresponding to the HTML tag <hr/>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockDivider {
#[doc = "Type of the block, always 'divider'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockDivider {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl InputRichBlockDivider {
pub fn new() -> Self {
Self {
kind: "divider".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for InputRichBlockDivider {
fn default() -> Self {
Self::new()
}
}
#[doc = "A footer, corresponding to the HTML tag <footer>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockFooter {
#[doc = "Type of the block, always 'footer'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockFooter {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl InputRichBlockFooter {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "footer".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockList {
#[doc = "Type of the block, always 'list'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Items of the list"]
pub items: Vec<InputRichBlockListItem>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockList {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.items, output);
}
}
impl InputRichBlockList {
pub fn new(items: Vec<InputRichBlockListItem>) -> Self {
Self {
kind: "list".to_owned(),
items,
extra: BTreeMap::new(),
}
}
}
#[doc = "An item of a list to be sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockListItem {
#[doc = "The content of the item"]
pub blocks: Vec<InputRichBlockUnion>,
#[doc = "Pass True if the item has a checkbox"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_checkbox: Option<bool>,
#[doc = "Pass True if the item has a checked checkbox"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_checked: Option<bool>,
#[doc = "For ordered lists, the numeric value of the item label"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value: Option<i64>,
#[doc = "For ordered lists, the type of the item label; must be one of 'a' for lowercase letters, 'A' for uppercase letters, 'i' for lowercase Roman numerals, 'I' for uppercase Roman numerals, or '1' for decimal numbers"]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockListItem {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.has_checkbox, output);
CollectFiles::collect_files(&self.is_checked, output);
CollectFiles::collect_files(&self.value, output);
CollectFiles::collect_files(&self.kind, output);
}
}
impl InputRichBlockListItem {
pub fn new(blocks: Vec<InputRichBlockUnion>) -> Self {
Self {
blocks,
has_checkbox: None,
is_checked: None,
value: None,
kind: None,
extra: BTreeMap::new(),
}
}
pub fn has_checkbox(mut self, value: bool) -> Self {
self.has_checkbox = Some(value);
self
}
pub fn is_checked(mut self, value: bool) -> Self {
self.is_checked = Some(value);
self
}
pub fn value(mut self, value: i64) -> Self {
self.value = Some(value);
self
}
pub fn kind(mut self, value: impl Into<String>) -> Self {
self.kind = Some(value.into());
self
}
}
#[doc = "A block with a map, corresponding to the custom HTML tag <tg-map>. The map's width and height must not exceed 10000 in total. The width and height ratio must be at most 20."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockMap {
#[doc = "Type of the block, always 'map'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Location of the center of the map"]
pub location: Location,
#[doc = "Map zoom level; 0-24"]
pub zoom: i64,
#[doc = "Map width; 0-10000"]
pub width: i64,
#[doc = "Map height; 0-10000"]
pub height: i64,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockMap {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.zoom, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockMap {
pub fn new(location: Location, zoom: i64, width: i64, height: i64) -> Self {
Self {
kind: "map".to_owned(),
location,
zoom,
width,
height,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockMathematicalExpression {
#[doc = "Type of the block, always 'mathematical_expression'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The mathematical expression in LaTeX format"]
pub expression: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockMathematicalExpression {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.expression, output);
}
}
impl InputRichBlockMathematicalExpression {
pub fn new(kind: impl Into<String>, expression: impl Into<String>) -> Self {
Self {
kind: kind.into(),
expression: expression.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text paragraph, corresponding to the HTML tag <p>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockParagraph {
#[doc = "Type of the block, always 'paragraph'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockParagraph {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl InputRichBlockParagraph {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "paragraph".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with a photo, corresponding to the HTML tag <img>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockPhoto {
#[doc = "Type of the block, always 'photo'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The photo. Caption is ignored."]
pub photo: InputMediaPhoto,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockPhoto {
pub fn new(photo: InputMediaPhoto) -> Self {
Self {
kind: "photo".to_owned(),
photo,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A preformatted text block, corresponding to the nested HTML tags <pre> and <code>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockPreformatted {
#[doc = "Type of the block, always 'pre'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "The programming language of the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockPreformatted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.language, output);
}
}
impl InputRichBlockPreformatted {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "pre".to_owned(),
text,
language: None,
extra: BTreeMap::new(),
}
}
pub fn language(mut self, value: impl Into<String>) -> Self {
self.language = Some(value.into());
self
}
}
#[doc = "A quotation with centered text, loosely corresponding to the HTML tag <aside>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockPullQuotation {
#[doc = "Type of the block, always 'pullquote'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "Credit of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub credit: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockPullQuotation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.credit, output);
}
}
impl InputRichBlockPullQuotation {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "pullquote".to_owned(),
text,
credit: None,
extra: BTreeMap::new(),
}
}
pub fn credit(mut self, value: Box<RichTextUnion>) -> Self {
self.credit = Some(value);
self
}
}
#[doc = "A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockSectionHeading {
#[doc = "Type of the block, always 'heading'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest"]
pub size: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockSectionHeading {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.size, output);
}
}
impl InputRichBlockSectionHeading {
pub fn new(text: Box<RichTextUnion>, size: i64) -> Self {
Self {
kind: "heading".to_owned(),
text,
size,
extra: BTreeMap::new(),
}
}
}
#[doc = "A slideshow, corresponding to the custom HTML tag <tg-slideshow>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockSlideshow {
#[doc = "Type of the block, always 'slideshow'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Elements of the slideshow"]
pub blocks: Vec<InputRichBlockUnion>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockSlideshow {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockSlideshow {
pub fn new(blocks: Vec<InputRichBlockUnion>) -> Self {
Self {
kind: "slideshow".to_owned(),
blocks,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A table, corresponding to the HTML tag <table>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockTable {
#[doc = "Type of the block, always 'table'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Cells of the table"]
pub cells: Vec<Vec<RichBlockTableCell>>,
#[doc = "Pass True if the table has borders"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_bordered: Option<bool>,
#[doc = "Pass True if the table is striped"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_striped: Option<bool>,
#[doc = "Caption of the table"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockTable {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.cells, output);
CollectFiles::collect_files(&self.is_bordered, output);
CollectFiles::collect_files(&self.is_striped, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockTable {
pub fn new(cells: Vec<Vec<RichBlockTableCell>>) -> Self {
Self {
kind: "table".to_owned(),
cells,
is_bordered: None,
is_striped: None,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn is_bordered(mut self, value: bool) -> Self {
self.is_bordered = Some(value);
self
}
pub fn is_striped(mut self, value: bool) -> Self {
self.is_striped = Some(value);
self
}
pub fn caption(mut self, value: Box<RichTextUnion>) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a 'Thinking…' placeholder, corresponding to the custom HTML tag <tg-thinking>. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockThinking {
#[doc = "Type of the block, always 'thinking'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block."]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockThinking {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl InputRichBlockThinking {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "thinking".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with a video, corresponding to the HTML tag <video>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockVideo {
#[doc = "Type of the block, always 'video'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The video. Caption is ignored."]
pub video: InputMediaVideo,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockVideo {
pub fn new(video: InputMediaVideo) -> Self {
Self {
kind: "video".to_owned(),
video,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a voice note, corresponding to the HTML tag <audio>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichBlockVoiceNote {
#[doc = "Type of the block, always 'voice_note'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The voice note. Caption is ignored."]
pub voice_note: InputMediaVoiceNote,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichBlockVoiceNote {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.voice_note, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl InputRichBlockVoiceNote {
pub fn new(voice_note: InputMediaVoiceNote) -> Self {
Self {
kind: "voice_note".to_owned(),
voice_note,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "Describes a rich message to be sent. Exactly one of the fields html, markdown, or blocks must be used."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichMessage {
#[doc = "Content of the rich message to send described using HTML formatting. See rich message formatting options for more details. Use media field to specify the media used in the message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub html: Option<String>,
#[doc = "Content of the rich message to send described using Markdown formatting. See rich message formatting options for more details. Use media field to specify the media used in the message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub markdown: Option<String>,
#[doc = "Pass True if the rich message must be shown right-to-left"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_rtl: Option<bool>,
#[doc = "Pass True to skip automatic detection of entities (e.g., URLs, email addresses, username mentions, hashtags, cashtags, bot commands, or phone numbers) in the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub skip_entity_detection: Option<bool>,
#[doc = "Content of the rich message to send described as a list of blocks"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub blocks: Option<Vec<InputRichBlockUnion>>,
#[doc = "List of media that are specified in the markdown or html fields using tg://photo?id=, tg://video?id=, and tg://audio?id= links"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub media: Option<Vec<InputRichMessageMediaUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.html, output);
CollectFiles::collect_files(&self.markdown, output);
CollectFiles::collect_files(&self.is_rtl, output);
CollectFiles::collect_files(&self.skip_entity_detection, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.media, output);
}
}
impl InputRichMessage {
pub fn new() -> Self {
Self {
html: None,
markdown: None,
is_rtl: None,
skip_entity_detection: None,
blocks: None,
media: None,
extra: BTreeMap::new(),
}
}
pub fn html(mut self, value: impl Into<String>) -> Self {
self.html = Some(value.into());
self
}
pub fn markdown(mut self, value: impl Into<String>) -> Self {
self.markdown = Some(value.into());
self
}
pub fn is_rtl(mut self, value: bool) -> Self {
self.is_rtl = Some(value);
self
}
pub fn skip_entity_detection(mut self, value: bool) -> Self {
self.skip_entity_detection = Some(value);
self
}
pub fn blocks(mut self, value: Vec<InputRichBlockUnion>) -> Self {
self.blocks = Some(value);
self
}
pub fn media(mut self, value: Vec<InputRichMessageMediaUnion>) -> Self {
self.media = Some(value);
self
}
}
impl Default for InputRichMessage {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents the content of a rich message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichMessageContent {
#[doc = "The message to be sent"]
pub rich_message: InputRichMessage,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.rich_message, output);
}
}
impl InputRichMessageContent {
pub fn new(rich_message: InputRichMessage) -> Self {
Self {
rich_message,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a media element embedded in an outgoing rich message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputRichMessageMedia {
#[doc = "Unique identifier of the media used in a tg://photo?id=, tg://video?id=, or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed."]
pub id: String,
#[doc = "The media to be sent. Everything except the media itself and its properties is ignored."]
pub media: InputRichMessageMediaUnion,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputRichMessageMedia {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.media, output);
}
}
impl InputRichMessageMedia {
pub fn new(id: impl Into<String>, media: impl Into<InputRichMessageMediaUnion>) -> Self {
Self {
id: id.into(),
media: media.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes a sticker to be added to a sticker set."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputSticker {
#[doc = "The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new file using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files"]
pub sticker: super::InputFile,
#[doc = "Format of the added sticker, must be one of 'static' for a .WEBP or .PNG image, 'animated' for a .TGS animation, 'video' for a .WEBM video"]
pub format: String,
#[doc = "List of 1-20 emoji associated with the sticker"]
pub emoji_list: Vec<String>,
#[doc = "Position where the mask should be placed on faces. For 'mask' stickers only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mask_position: Option<MaskPosition>,
#[doc = "List of 0-20 search keywords for the sticker with total length of up to 64 characters. For 'regular' and 'custom_emoji' stickers only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub keywords: Option<Vec<String>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputSticker {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.format, output);
CollectFiles::collect_files(&self.emoji_list, output);
CollectFiles::collect_files(&self.mask_position, output);
CollectFiles::collect_files(&self.keywords, output);
}
}
impl InputSticker {
pub fn new(
sticker: impl Into<super::InputFile>,
format: impl Into<String>,
emoji_list: Vec<String>,
) -> Self {
Self {
sticker: sticker.into(),
format: format.into(),
emoji_list,
mask_position: None,
keywords: None,
extra: BTreeMap::new(),
}
}
pub fn mask_position(mut self, value: MaskPosition) -> Self {
self.mask_position = Some(value);
self
}
pub fn keywords(mut self, value: Vec<String>) -> Self {
self.keywords = Some(value);
self
}
}
#[doc = "This object describes the content of a story to post. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputStoryContent {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputStoryContent {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl InputStoryContent {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for InputStoryContent {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a photo to post as a story."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputStoryContentPhoto {
#[doc = "Type of the content, must be photo"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files"]
pub photo: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputStoryContentPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl InputStoryContentPhoto {
pub fn new(photo: impl Into<String>) -> Self {
Self {
kind: "photo".to_owned(),
photo: photo.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a video to post as a story."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputStoryContentVideo {
#[doc = "Type of the content, must be video"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the video was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files"]
pub video: String,
#[doc = "Precise duration of the video in seconds; 0-60"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<f64>,
#[doc = "Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cover_frame_timestamp: Option<f64>,
#[doc = "Pass True if the video has no sound"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_animation: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputStoryContentVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.cover_frame_timestamp, output);
CollectFiles::collect_files(&self.is_animation, output);
}
}
impl InputStoryContentVideo {
pub fn new(video: impl Into<String>) -> Self {
Self {
kind: "video".to_owned(),
video: video.into(),
duration: None,
cover_frame_timestamp: None,
is_animation: None,
extra: BTreeMap::new(),
}
}
pub fn duration(mut self, value: f64) -> Self {
self.duration = Some(value);
self
}
pub fn cover_frame_timestamp(mut self, value: f64) -> Self {
self.cover_frame_timestamp = Some(value);
self
}
pub fn is_animation(mut self, value: bool) -> Self {
self.is_animation = Some(value);
self
}
}
#[doc = "Represents the content of a text message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputTextMessageContent {
#[doc = "Text of the message to be sent, 1-4096 characters"]
pub message_text: String,
#[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parse_mode: Option<String>,
#[doc = "List of special entities that appear in message text, which can be specified instead of parse_mode"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub entities: Option<Vec<MessageEntity>>,
#[doc = "Link preview generation options for the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub link_preview_options: Option<LinkPreviewOptions>,
#[doc = "Disables link previews for links in the sent message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub disable_web_page_preview: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputTextMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_text, output);
CollectFiles::collect_files(&self.parse_mode, output);
CollectFiles::collect_files(&self.entities, output);
CollectFiles::collect_files(&self.link_preview_options, output);
CollectFiles::collect_files(&self.disable_web_page_preview, output);
}
}
impl InputTextMessageContent {
pub fn new(message_text: impl Into<String>) -> Self {
Self {
message_text: message_text.into(),
parse_mode: None,
entities: None,
link_preview_options: None,
disable_web_page_preview: None,
extra: BTreeMap::new(),
}
}
pub fn parse_mode(mut self, value: impl Into<String>) -> Self {
self.parse_mode = Some(value.into());
self
}
pub fn entities(mut self, value: Vec<MessageEntity>) -> Self {
self.entities = Some(value);
self
}
pub fn link_preview_options(mut self, value: LinkPreviewOptions) -> Self {
self.link_preview_options = Some(value);
self
}
pub fn disable_web_page_preview(mut self, value: bool) -> Self {
self.disable_web_page_preview = Some(value);
self
}
}
#[doc = "Represents the content of a venue message to be sent as the result of an inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct InputVenueMessageContent {
#[doc = "Latitude of the venue in degrees"]
pub latitude: f64,
#[doc = "Longitude of the venue in degrees"]
pub longitude: f64,
#[doc = "Name of the venue"]
pub title: String,
#[doc = "Address of the venue"]
pub address: String,
#[doc = "Foursquare identifier of the venue, if known"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<String>,
#[doc = "Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<String>,
#[doc = "Google Places identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_id: Option<String>,
#[doc = "Google Places type of the venue. (See supported types.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_type: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for InputVenueMessageContent {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.address, output);
CollectFiles::collect_files(&self.foursquare_id, output);
CollectFiles::collect_files(&self.foursquare_type, output);
CollectFiles::collect_files(&self.google_place_id, output);
CollectFiles::collect_files(&self.google_place_type, output);
}
}
impl InputVenueMessageContent {
pub fn new(
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> Self {
Self {
latitude,
longitude,
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
extra: BTreeMap::new(),
}
}
pub fn foursquare_id(mut self, value: impl Into<String>) -> Self {
self.foursquare_id = Some(value.into());
self
}
pub fn foursquare_type(mut self, value: impl Into<String>) -> Self {
self.foursquare_type = Some(value.into());
self
}
pub fn google_place_id(mut self, value: impl Into<String>) -> Self {
self.google_place_id = Some(value.into());
self
}
pub fn google_place_type(mut self, value: impl Into<String>) -> Self {
self.google_place_type = Some(value.into());
self
}
}
#[doc = "This object contains basic information about an invoice."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Invoice {
#[doc = "Product name"]
pub title: String,
#[doc = "Product description"]
pub description: String,
#[doc = "Unique bot deep-linking parameter that can be used to generate this invoice"]
pub start_parameter: String,
#[doc = "Three-letter ISO 4217 currency code, or 'XTR' for payments in Telegram Stars"]
pub currency: String,
#[doc = "Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."]
pub total_amount: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Invoice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.start_parameter, output);
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.total_amount, output);
}
}
impl Invoice {
pub fn new(
title: impl Into<String>,
description: impl Into<String>,
start_parameter: impl Into<String>,
currency: impl Into<String>,
total_amount: i64,
) -> Self {
Self {
title: title.into(),
description: description.into(),
start_parameter: start_parameter.into(),
currency: currency.into(),
total_amount,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButton {
#[doc = "Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed."]
pub text: String,
#[doc = "Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
#[doc = "Style of the button. Must be one of 'danger' (red), 'success' (green) or 'primary' (blue). If omitted, then an app-specific style is used."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub style: Option<String>,
#[doc = "If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a 'users_shared' service message. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_users: Option<KeyboardButtonRequestUsers>,
#[doc = "If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a 'chat_shared' service message. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_chat: Option<KeyboardButtonRequestChat>,
#[doc = "If specified, pressing the button will ask the user to create and share a bot that will be managed by the current bot. Available for bots that enabled management of other bots in the @BotFather Mini App. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_managed_bot: Option<KeyboardButtonRequestManagedBot>,
#[doc = "If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_contact: Option<bool>,
#[doc = "If True, the user's current location will be sent when the button is pressed. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_location: Option<bool>,
#[doc = "If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_poll: Option<KeyboardButtonPollType>,
#[doc = "If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a 'web_app_data' service message. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub web_app: Option<WebAppInfo>,
#[doc = "If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a 'user_shared' service message. Available in private chats only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_user: Option<KeyboardButtonRequestUser>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButton {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.icon_custom_emoji_id, output);
CollectFiles::collect_files(&self.style, output);
CollectFiles::collect_files(&self.request_users, output);
CollectFiles::collect_files(&self.request_chat, output);
CollectFiles::collect_files(&self.request_managed_bot, output);
CollectFiles::collect_files(&self.request_contact, output);
CollectFiles::collect_files(&self.request_location, output);
CollectFiles::collect_files(&self.request_poll, output);
CollectFiles::collect_files(&self.web_app, output);
CollectFiles::collect_files(&self.request_user, output);
}
}
impl KeyboardButton {
pub fn new(text: impl Into<String>) -> Self {
Self {
text: text.into(),
icon_custom_emoji_id: None,
style: None,
request_users: None,
request_chat: None,
request_managed_bot: None,
request_contact: None,
request_location: None,
request_poll: None,
web_app: None,
request_user: None,
extra: BTreeMap::new(),
}
}
pub fn icon_custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.icon_custom_emoji_id = Some(value.into());
self
}
pub fn style(mut self, value: impl Into<String>) -> Self {
self.style = Some(value.into());
self
}
pub fn request_users(mut self, value: KeyboardButtonRequestUsers) -> Self {
self.request_users = Some(value);
self
}
pub fn request_chat(mut self, value: KeyboardButtonRequestChat) -> Self {
self.request_chat = Some(value);
self
}
pub fn request_managed_bot(mut self, value: KeyboardButtonRequestManagedBot) -> Self {
self.request_managed_bot = Some(value);
self
}
pub fn request_contact(mut self, value: bool) -> Self {
self.request_contact = Some(value);
self
}
pub fn request_location(mut self, value: bool) -> Self {
self.request_location = Some(value);
self
}
pub fn request_poll(mut self, value: KeyboardButtonPollType) -> Self {
self.request_poll = Some(value);
self
}
pub fn web_app(mut self, value: WebAppInfo) -> Self {
self.web_app = Some(value);
self
}
pub fn request_user(mut self, value: KeyboardButtonRequestUser) -> Self {
self.request_user = Some(value);
self
}
}
#[doc = "This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButtonPollType {
#[doc = "If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type."]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButtonPollType {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl KeyboardButtonPollType {
pub fn new() -> Self {
Self {
kind: None,
extra: BTreeMap::new(),
}
}
pub fn kind(mut self, value: impl Into<String>) -> Self {
self.kind = Some(value.into());
self
}
}
impl Default for KeyboardButtonPollType {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate.."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButtonRequestChat {
#[doc = "Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message."]
pub request_id: i64,
#[doc = "Pass True to request a channel chat, pass False to request a group or a supergroup chat"]
pub chat_is_channel: bool,
#[doc = "Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_is_forum: Option<bool>,
#[doc = "Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_has_username: Option<bool>,
#[doc = "Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_is_created: Option<bool>,
#[doc = "A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_administrator_rights: Option<ChatAdministratorRights>,
#[doc = "A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bot_administrator_rights: Option<ChatAdministratorRights>,
#[doc = "Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bot_is_member: Option<bool>,
#[doc = "Pass True to request the chat's title"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_title: Option<bool>,
#[doc = "Pass True to request the chat's username"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_username: Option<bool>,
#[doc = "Pass True to request the chat's photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_photo: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButtonRequestChat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.chat_is_channel, output);
CollectFiles::collect_files(&self.chat_is_forum, output);
CollectFiles::collect_files(&self.chat_has_username, output);
CollectFiles::collect_files(&self.chat_is_created, output);
CollectFiles::collect_files(&self.user_administrator_rights, output);
CollectFiles::collect_files(&self.bot_administrator_rights, output);
CollectFiles::collect_files(&self.bot_is_member, output);
CollectFiles::collect_files(&self.request_title, output);
CollectFiles::collect_files(&self.request_username, output);
CollectFiles::collect_files(&self.request_photo, output);
}
}
impl KeyboardButtonRequestChat {
pub fn new(request_id: i64, chat_is_channel: bool) -> Self {
Self {
request_id,
chat_is_channel,
chat_is_forum: None,
chat_has_username: None,
chat_is_created: None,
user_administrator_rights: None,
bot_administrator_rights: None,
bot_is_member: None,
request_title: None,
request_username: None,
request_photo: None,
extra: BTreeMap::new(),
}
}
pub fn chat_is_forum(mut self, value: bool) -> Self {
self.chat_is_forum = Some(value);
self
}
pub fn chat_has_username(mut self, value: bool) -> Self {
self.chat_has_username = Some(value);
self
}
pub fn chat_is_created(mut self, value: bool) -> Self {
self.chat_is_created = Some(value);
self
}
pub fn user_administrator_rights(mut self, value: ChatAdministratorRights) -> Self {
self.user_administrator_rights = Some(value);
self
}
pub fn bot_administrator_rights(mut self, value: ChatAdministratorRights) -> Self {
self.bot_administrator_rights = Some(value);
self
}
pub fn bot_is_member(mut self, value: bool) -> Self {
self.bot_is_member = Some(value);
self
}
pub fn request_title(mut self, value: bool) -> Self {
self.request_title = Some(value);
self
}
pub fn request_username(mut self, value: bool) -> Self {
self.request_username = Some(value);
self
}
pub fn request_photo(mut self, value: bool) -> Self {
self.request_photo = Some(value);
self
}
}
#[doc = "This object defines the parameters for the creation of a managed bot. Information about the created bot will be shared with the bot using the update managed_bot and a Message with the field managed_bot_created."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButtonRequestManagedBot {
#[doc = "Signed 32-bit identifier of the request. Must be unique within the message."]
pub request_id: i64,
#[doc = "Suggested name for the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_name: Option<String>,
#[doc = "Suggested username for the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_username: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButtonRequestManagedBot {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.suggested_name, output);
CollectFiles::collect_files(&self.suggested_username, output);
}
}
impl KeyboardButtonRequestManagedBot {
pub fn new(request_id: i64) -> Self {
Self {
request_id,
suggested_name: None,
suggested_username: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_name(mut self, value: impl Into<String>) -> Self {
self.suggested_name = Some(value.into());
self
}
pub fn suggested_username(mut self, value: impl Into<String>) -> Self {
self.suggested_username = Some(value.into());
self
}
}
#[doc = "This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButtonRequestUser {
#[doc = "Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message"]
pub request_id: i64,
#[doc = "Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_is_bot: Option<bool>,
#[doc = "Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_is_premium: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButtonRequestUser {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.user_is_bot, output);
CollectFiles::collect_files(&self.user_is_premium, output);
}
}
impl KeyboardButtonRequestUser {
pub fn new(request_id: i64) -> Self {
Self {
request_id,
user_is_bot: None,
user_is_premium: None,
extra: BTreeMap::new(),
}
}
pub fn user_is_bot(mut self, value: bool) -> Self {
self.user_is_bot = Some(value);
self
}
pub fn user_is_premium(mut self, value: bool) -> Self {
self.user_is_premium = Some(value);
self
}
}
#[doc = "This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct KeyboardButtonRequestUsers {
#[doc = "Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message."]
pub request_id: i64,
#[doc = "Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_is_bot: Option<bool>,
#[doc = "Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_is_premium: Option<bool>,
#[doc = "The maximum number of users to be selected; 1-10. Defaults to 1."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_quantity: Option<i64>,
#[doc = "Pass True to request the users' first and last names"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_name: Option<bool>,
#[doc = "Pass True to request the users' usernames"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_username: Option<bool>,
#[doc = "Pass True to request the users' photos"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_photo: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for KeyboardButtonRequestUsers {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.user_is_bot, output);
CollectFiles::collect_files(&self.user_is_premium, output);
CollectFiles::collect_files(&self.max_quantity, output);
CollectFiles::collect_files(&self.request_name, output);
CollectFiles::collect_files(&self.request_username, output);
CollectFiles::collect_files(&self.request_photo, output);
}
}
impl KeyboardButtonRequestUsers {
pub fn new(request_id: i64) -> Self {
Self {
request_id,
user_is_bot: None,
user_is_premium: None,
max_quantity: None,
request_name: None,
request_username: None,
request_photo: None,
extra: BTreeMap::new(),
}
}
pub fn user_is_bot(mut self, value: bool) -> Self {
self.user_is_bot = Some(value);
self
}
pub fn user_is_premium(mut self, value: bool) -> Self {
self.user_is_premium = Some(value);
self
}
pub fn max_quantity(mut self, value: i64) -> Self {
self.max_quantity = Some(value);
self
}
pub fn request_name(mut self, value: bool) -> Self {
self.request_name = Some(value);
self
}
pub fn request_username(mut self, value: bool) -> Self {
self.request_username = Some(value);
self
}
pub fn request_photo(mut self, value: bool) -> Self {
self.request_photo = Some(value);
self
}
}
#[doc = "This object represents a portion of the price for goods or services."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LabeledPrice {
#[doc = "Portion label"]
pub label: String,
#[doc = "Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."]
pub amount: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for LabeledPrice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.label, output);
CollectFiles::collect_files(&self.amount, output);
}
}
impl LabeledPrice {
pub fn new(label: impl Into<String>, amount: i64) -> Self {
Self {
label: label.into(),
amount,
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an HTTP link."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Link {
#[doc = "URL of the link"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Link {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.url, output);
}
}
impl Link {
pub fn new(url: impl Into<String>) -> Self {
Self {
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes the options used for link preview generation."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LinkPreviewOptions {
#[doc = "True, if the link preview is disabled"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_disabled: Option<bool>,
#[doc = "URL to use for the link preview. If empty, then the first URL found in the message text will be used."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[doc = "True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prefer_small_media: Option<bool>,
#[doc = "True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prefer_large_media: Option<bool>,
#[doc = "True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_above_text: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for LinkPreviewOptions {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.is_disabled, output);
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.prefer_small_media, output);
CollectFiles::collect_files(&self.prefer_large_media, output);
CollectFiles::collect_files(&self.show_above_text, output);
}
}
impl LinkPreviewOptions {
pub fn new() -> Self {
Self {
is_disabled: None,
url: None,
prefer_small_media: None,
prefer_large_media: None,
show_above_text: None,
extra: BTreeMap::new(),
}
}
pub fn is_disabled(mut self, value: bool) -> Self {
self.is_disabled = Some(value);
self
}
pub fn url(mut self, value: impl Into<String>) -> Self {
self.url = Some(value.into());
self
}
pub fn prefer_small_media(mut self, value: bool) -> Self {
self.prefer_small_media = Some(value);
self
}
pub fn prefer_large_media(mut self, value: bool) -> Self {
self.prefer_large_media = Some(value);
self
}
pub fn show_above_text(mut self, value: bool) -> Self {
self.show_above_text = Some(value);
self
}
}
impl Default for LinkPreviewOptions {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a live photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LivePhoto {
#[doc = "Identifier for the video file which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for the video file which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Video width as defined by the sender"]
pub width: i64,
#[doc = "Video height as defined by the sender"]
pub height: i64,
#[doc = "Duration of the video in seconds as defined by the sender"]
pub duration: i64,
#[doc = "Available sizes of the corresponding static photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for LivePhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl LivePhoto {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
width: i64,
height: i64,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
duration,
photo: None,
mime_type: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents a point on the map."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Location {
#[doc = "Latitude as defined by the sender"]
pub latitude: f64,
#[doc = "Longitude as defined by the sender"]
pub longitude: f64,
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub horizontal_accuracy: Option<f64>,
#[doc = "Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_period: Option<i64>,
#[doc = "The direction in which user is moving, in degrees; 1-360. For active live locations only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub heading: Option<i64>,
#[doc = "The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub proximity_alert_radius: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Location {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.horizontal_accuracy, output);
CollectFiles::collect_files(&self.live_period, output);
CollectFiles::collect_files(&self.heading, output);
CollectFiles::collect_files(&self.proximity_alert_radius, output);
}
}
impl Location {
pub fn new(latitude: f64, longitude: f64) -> Self {
Self {
latitude,
longitude,
horizontal_accuracy: None,
live_period: None,
heading: None,
proximity_alert_radius: None,
extra: BTreeMap::new(),
}
}
pub fn horizontal_accuracy(mut self, value: f64) -> Self {
self.horizontal_accuracy = Some(value);
self
}
pub fn live_period(mut self, value: i64) -> Self {
self.live_period = Some(value);
self
}
pub fn heading(mut self, value: i64) -> Self {
self.heading = Some(value);
self
}
pub fn proximity_alert_radius(mut self, value: i64) -> Self {
self.proximity_alert_radius = Some(value);
self
}
}
#[doc = "Describes the physical address of a location."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LocationAddress {
#[doc = "The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located"]
pub country_code: String,
#[doc = "State of the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
#[doc = "City of the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
#[doc = "Street address of the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub street: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for LocationAddress {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.country_code, output);
CollectFiles::collect_files(&self.state, output);
CollectFiles::collect_files(&self.city, output);
CollectFiles::collect_files(&self.street, output);
}
}
impl LocationAddress {
pub fn new(country_code: impl Into<String>) -> Self {
Self {
country_code: country_code.into(),
state: None,
city: None,
street: None,
extra: BTreeMap::new(),
}
}
pub fn state(mut self, value: impl Into<String>) -> Self {
self.state = Some(value.into());
self
}
pub fn city(mut self, value: impl Into<String>) -> Self {
self.city = Some(value.into());
self
}
pub fn street(mut self, value: impl Into<String>) -> Self {
self.street = Some(value.into());
self
}
}
#[doc = "This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LoginUrl {
#[doc = "An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data."]
pub url: String,
#[doc = "New text of the button in forwarded messages"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_text: Option<String>,
#[doc = "Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bot_username: Option<String>,
#[doc = "Pass True to request the permission for your bot to send messages to the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_write_access: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for LoginUrl {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.forward_text, output);
CollectFiles::collect_files(&self.bot_username, output);
CollectFiles::collect_files(&self.request_write_access, output);
}
}
impl LoginUrl {
pub fn new(url: impl Into<String>) -> Self {
Self {
url: url.into(),
forward_text: None,
bot_username: None,
request_write_access: None,
extra: BTreeMap::new(),
}
}
pub fn forward_text(mut self, value: impl Into<String>) -> Self {
self.forward_text = Some(value.into());
self
}
pub fn bot_username(mut self, value: impl Into<String>) -> Self {
self.bot_username = Some(value.into());
self
}
pub fn request_write_access(mut self, value: bool) -> Self {
self.request_write_access = Some(value);
self
}
}
#[doc = "This object contains information about the bot that was created to be managed by the current bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ManagedBotCreated {
#[doc = "Information about the bot. The bot's token can be fetched using the method getManagedBotToken."]
#[serde(rename = "bot")]
pub bot_user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ManagedBotCreated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.bot_user, output);
}
}
impl ManagedBotCreated {
pub fn new(bot_user: User) -> Self {
Self {
bot_user,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about the creation, token update, or owner update of a bot that is managed by the current bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ManagedBotUpdated {
#[doc = "User that created the bot"]
pub user: User,
#[doc = "Information about the bot. Token of the bot can be fetched using the method getManagedBotToken."]
#[serde(rename = "bot")]
pub bot_user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ManagedBotUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.bot_user, output);
}
}
impl ManagedBotUpdated {
pub fn new(user: User, bot_user: User) -> Self {
Self {
user,
bot_user,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the position on faces where a mask should be placed by default."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MaskPosition {
#[doc = "The part of the face relative to which the mask should be placed. One of 'forehead', 'eyes', 'mouth', or 'chin'."]
pub point: String,
#[doc = "Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position."]
pub x_shift: f64,
#[doc = "Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position."]
pub y_shift: f64,
#[doc = "Mask scaling coefficient. For example, 2.0 means double size."]
pub scale: f64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MaskPosition {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.point, output);
CollectFiles::collect_files(&self.x_shift, output);
CollectFiles::collect_files(&self.y_shift, output);
CollectFiles::collect_files(&self.scale, output);
}
}
impl MaskPosition {
pub fn new(point: impl Into<String>, x_shift: f64, y_shift: f64, scale: f64) -> Self {
Self {
point: point.into(),
x_shift,
y_shift,
scale,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes a message that can be inaccessible to the bot. It can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MaybeInaccessibleMessage {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MaybeInaccessibleMessage {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl MaybeInaccessibleMessage {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for MaybeInaccessibleMessage {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object describes the bot's menu button in a private chat. It should be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MenuButton {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MenuButton {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl MenuButton {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for MenuButton {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents a menu button, which opens the bot's list of commands."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MenuButtonCommands {
#[doc = "Type of the button, must be commands"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MenuButtonCommands {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl MenuButtonCommands {
pub fn new() -> Self {
Self {
kind: "commands".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for MenuButtonCommands {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes that no specific value for the menu button was set."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MenuButtonDefault {
#[doc = "Type of the button, must be default"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MenuButtonDefault {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl MenuButtonDefault {
pub fn new() -> Self {
Self {
kind: "default".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for MenuButtonDefault {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents a menu button, which launches a Web App."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MenuButtonWebApp {
#[doc = "Type of the button, must be web_app"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text on the button"]
pub text: String,
#[doc = "Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link."]
pub web_app: WebAppInfo,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MenuButtonWebApp {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.web_app, output);
}
}
impl MenuButtonWebApp {
pub fn new(text: impl Into<String>, web_app: WebAppInfo) -> Self {
Self {
kind: "web_app".to_owned(),
text: text.into(),
web_app,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Message {
#[doc = "Unique message identifier inside this chat; 0 for ephemeral messages. In specific instances (e.g., a message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent."]
pub message_id: i64,
#[doc = "Date the message was sent in Unix time. It is always a positive number, representing a valid date."]
pub date: i64,
#[doc = "Chat the message belongs to"]
pub chat: Box<Chat>,
#[doc = "Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_thread_id: Option<i64>,
#[doc = "Information about the direct messages chat topic that contains the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub direct_messages_topic: Option<DirectMessagesTopic>,
#[doc = "Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats."]
#[serde(rename = "from", default, skip_serializing_if = "Option::is_none")]
pub from_user: Option<User>,
#[doc = "Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_chat: Option<Box<Chat>>,
#[doc = "If the sender of the message boosted the chat, the number of boosts added by the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_boost_count: Option<i64>,
#[doc = "The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_business_bot: Option<User>,
#[doc = "Tag or custom title of the sender of the message; for supergroups only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_tag: Option<String>,
#[doc = "The unique identifier for the guest query. Use this identifier with the method answerGuestQuery to send a response message. If non-empty, the message belongs to the chat where the guest bot was summoned, which may not coincide with other existing bot chats sharing the same identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guest_query_id: Option<String>,
#[doc = "Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_connection_id: Option<String>,
#[doc = "Information about the original message for forwarded messages"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_origin: Option<MessageOriginUnion>,
#[doc = "True, if the message is sent to a topic in a forum supergroup or a private chat with the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_topic_message: Option<bool>,
#[doc = "True, if the message is a channel post that was automatically forwarded to the connected discussion group"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_automatic_forward: Option<bool>,
#[doc = "For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. If the message is a reply to an ephemeral message, then this field may be omitted."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_to_message: Option<Box<Message>>,
#[doc = "Information about the message that is being replied to, which may come from another chat or forum topic"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub external_reply: Option<ExternalReplyInfo>,
#[doc = "For replies that quote part of the original message, the quoted part of the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub quote: Option<TextQuote>,
#[doc = "For replies to a story, the original story"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_to_story: Option<Story>,
#[doc = "Identifier of the specific checklist task that is being replied to"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_to_checklist_task_id: Option<i64>,
#[doc = "Persistent identifier of the specific poll option that is being replied to"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_to_poll_option_id: Option<String>,
#[doc = "Bot through which the message was sent"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub via_bot: Option<User>,
#[doc = "For a message sent by a guest bot, this is the user whose original message triggered the bot's response"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guest_bot_caller_user: Option<User>,
#[doc = "For a message sent by a guest bot, this is the chat whose original message triggered the bot's response"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guest_bot_caller_chat: Option<Box<Chat>>,
#[doc = "Date the message was last edited in Unix time"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edit_date: Option<i64>,
#[doc = "True, if the message can't be forwarded"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_protected_content: Option<bool>,
#[doc = "True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_from_offline: Option<bool>,
#[doc = "True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_paid_post: Option<bool>,
#[doc = "The unique identifier inside this chat of a media message group this message belongs to"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub media_group_id: Option<String>,
#[doc = "Signature of the post author for messages in channels, or the custom title of an anonymous group administrator"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub author_signature: Option<String>,
#[doc = "The number of Telegram Stars that were paid by the sender of the message to send it"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_star_count: Option<i64>,
#[doc = "For text messages, the actual UTF-8 text of the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[doc = "For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub entities: Option<Vec<MessageEntity>>,
#[doc = "Options used for link preview generation for the message, if it is a text message and link preview options were changed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub link_preview_options: Option<LinkPreviewOptions>,
#[doc = "Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_info: Option<SuggestedPostInfo>,
#[doc = "Unique identifier of the message effect added to the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub effect_id: Option<String>,
#[doc = "Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub animation: Option<Animation>,
#[doc = "Message is an audio file, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio: Option<Audio>,
#[doc = "Message is a general file, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub document: Option<Document>,
#[doc = "Message is a live photo, information about the live photo. For backward compatibility, when this field is set, the photo field will also be set."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_photo: Option<LivePhoto>,
#[doc = "Message contains paid media; information about the paid media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_media: Option<PaidMediaInfo>,
#[doc = "Message is a photo, available sizes of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[doc = "Message is a sticker, information about the sticker"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker: Option<Sticker>,
#[doc = "Message is a forwarded story"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub story: Option<Story>,
#[doc = "Message is a video, information about the video"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video: Option<Video>,
#[doc = "Message is a video note, information about the video message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_note: Option<VideoNote>,
#[doc = "Message is a voice message, information about the file"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub voice: Option<Voice>,
#[doc = "Caption for the animation, audio, document, paid media, photo, video or voice"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<String>,
#[doc = "For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption_entities: Option<Vec<MessageEntity>>,
#[doc = "True, if the caption must be shown above the message media"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub show_caption_above_media: Option<bool>,
#[doc = "True, if the message media is covered by a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_media_spoiler: Option<bool>,
#[doc = "Message is a checklist"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist: Option<Checklist>,
#[doc = "Message is a shared contact, information about the contact"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub contact: Option<Contact>,
#[doc = "Message is a dice with random value"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dice: Option<Dice>,
#[doc = "Message is a game, information about the game."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub game: Option<Game>,
#[doc = "Message is a native poll, information about the poll"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll: Option<Poll>,
#[doc = "Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub venue: Option<Venue>,
#[doc = "Message is a shared location, information about the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[doc = "New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub new_chat_members: Option<Vec<User>>,
#[doc = "A member was removed from the group, information about them (this member may be the bot itself)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub left_chat_member: Option<User>,
#[doc = "Service message: chat owner has left"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_owner_left: Option<ChatOwnerLeft>,
#[doc = "Service message: chat owner has changed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_owner_changed: Option<ChatOwnerChanged>,
#[doc = "A chat title was changed to this value"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub new_chat_title: Option<String>,
#[doc = "A chat photo was change to this value"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub new_chat_photo: Option<Vec<PhotoSize>>,
#[doc = "Service message: the chat photo was deleted"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub delete_chat_photo: Option<bool>,
#[doc = "Service message: the group has been created"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub group_chat_created: Option<bool>,
#[doc = "Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supergroup_chat_created: Option<bool>,
#[doc = "Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub channel_chat_created: Option<bool>,
#[doc = "Service message: auto-delete timer settings changed in the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_auto_delete_timer_changed: Option<MessageAutoDeleteTimerChanged>,
#[doc = "The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub migrate_to_chat_id: Option<i64>,
#[doc = "The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub migrate_from_chat_id: Option<i64>,
#[doc = "Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pinned_message: Option<MaybeInaccessibleMessageUnion>,
#[doc = "Message is an invoice for a payment, information about the invoice."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invoice: Option<Invoice>,
#[doc = "Message is a service message about a successful payment, information about the payment."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub successful_payment: Option<SuccessfulPayment>,
#[doc = "Message is a service message about a refunded payment, information about the payment."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub refunded_payment: Option<RefundedPayment>,
#[doc = "Service message: users were shared with the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub users_shared: Option<UsersShared>,
#[doc = "Service message: a chat was shared with the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_shared: Option<ChatShared>,
#[doc = "Service message: a regular gift was sent or received"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gift: Option<GiftInfo>,
#[doc = "Service message: a unique gift was sent or received"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unique_gift: Option<UniqueGiftInfo>,
#[doc = "Service message: upgrade of a gift was purchased after the gift was sent"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gift_upgrade_sent: Option<GiftInfo>,
#[doc = "The domain name of the website on which the user has logged in."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub connected_website: Option<String>,
#[doc = "Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub write_access_allowed: Option<WriteAccessAllowed>,
#[doc = "Telegram Passport data"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub passport_data: Option<PassportData>,
#[doc = "Service message. A user in the chat triggered another user's proximity alert while sharing Live Location."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub proximity_alert_triggered: Option<ProximityAlertTriggered>,
#[doc = "Service message: user boosted the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub boost_added: Option<ChatBoostAdded>,
#[doc = "Service message: chat background set"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_background_set: Option<ChatBackground>,
#[doc = "Service message: some tasks in a checklist were marked as done or not done"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist_tasks_done: Option<ChecklistTasksDone>,
#[doc = "Service message: tasks were added to a checklist"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist_tasks_added: Option<ChecklistTasksAdded>,
#[doc = "Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub direct_message_price_changed: Option<DirectMessagePriceChanged>,
#[doc = "Service message: forum topic created"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forum_topic_created: Option<ForumTopicCreated>,
#[doc = "Service message: forum topic edited"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forum_topic_edited: Option<ForumTopicEdited>,
#[doc = "Service message: forum topic closed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forum_topic_closed: Option<ForumTopicClosed>,
#[doc = "Service message: forum topic reopened"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forum_topic_reopened: Option<ForumTopicReopened>,
#[doc = "Service message: the 'General' forum topic hidden"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub general_forum_topic_hidden: Option<GeneralForumTopicHidden>,
#[doc = "Service message: the 'General' forum topic unhidden"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub general_forum_topic_unhidden: Option<GeneralForumTopicUnhidden>,
#[doc = "Service message: a scheduled giveaway was created"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway_created: Option<GiveawayCreated>,
#[doc = "The message is a scheduled giveaway message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway: Option<Giveaway>,
#[doc = "A giveaway with public winners was completed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway_winners: Option<GiveawayWinners>,
#[doc = "Service message: a giveaway without public winners was completed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub giveaway_completed: Option<GiveawayCompleted>,
#[doc = "Service message: user created a bot that will be managed by the current bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub managed_bot_created: Option<ManagedBotCreated>,
#[doc = "Service message: the price for paid messages has changed in the chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_message_price_changed: Option<PaidMessagePriceChanged>,
#[doc = "Service message: answer option was added to a poll"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_option_added: Option<PollOptionAdded>,
#[doc = "Service message: answer option was deleted from a poll"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_option_deleted: Option<PollOptionDeleted>,
#[doc = "Service message: a suggested post was approved"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_approved: Option<SuggestedPostApproved>,
#[doc = "Service message: approval of a suggested post has failed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_approval_failed: Option<SuggestedPostApprovalFailed>,
#[doc = "Service message: a suggested post was declined"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_declined: Option<SuggestedPostDeclined>,
#[doc = "Service message: payment for a suggested post was received"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_paid: Option<SuggestedPostPaid>,
#[doc = "Service message: payment for a suggested post was refunded"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_refunded: Option<SuggestedPostRefunded>,
#[doc = "Service message: video chat scheduled"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_chat_scheduled: Option<VideoChatScheduled>,
#[doc = "Service message: video chat started"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_chat_started: Option<VideoChatStarted>,
#[doc = "Service message: video chat ended"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_chat_ended: Option<VideoChatEnded>,
#[doc = "Service message: new participants invited to a video chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video_chat_participants_invited: Option<VideoChatParticipantsInvited>,
#[doc = "Service message: data sent by a Web App"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub web_app_data: Option<WebAppData>,
#[doc = "Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<InlineKeyboardMarkup>,
#[doc = "Message is a rich formatted message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rich_message: Option<RichMessage>,
#[doc = "For ephemeral messages, the user who received the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receiver_user: Option<User>,
#[doc = "For ephemeral messages, identifier of the ephemeral message inside this chat. The identifier may be reused for another ephemeral message after the message is deleted or expires."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ephemeral_message_id: Option<i64>,
#[doc = "Service message: chat added to a Community"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub community_chat_added: Option<CommunityChatAdded>,
#[doc = "Service message: chat removed from a Community"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub community_chat_removed: Option<CommunityChatRemoved>,
#[doc = "For forwarded messages, date the original message was sent in Unix time"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_date: Option<i64>,
#[doc = "For forwarded messages, sender of the original message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_from: Option<User>,
#[doc = "For messages forwarded from channels or from anonymous administrators, information about the original sender chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_from_chat: Option<Box<Chat>>,
#[doc = "For messages forwarded from channels, identifier of the original message in the channel"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_from_message_id: Option<i64>,
#[doc = "Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_sender_name: Option<String>,
#[doc = "For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forward_signature: Option<String>,
#[doc = "Service message: a user was shared with the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_shared: Option<UserShared>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Message {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_thread_id, output);
CollectFiles::collect_files(&self.direct_messages_topic, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.sender_chat, output);
CollectFiles::collect_files(&self.sender_boost_count, output);
CollectFiles::collect_files(&self.sender_business_bot, output);
CollectFiles::collect_files(&self.sender_tag, output);
CollectFiles::collect_files(&self.guest_query_id, output);
CollectFiles::collect_files(&self.business_connection_id, output);
CollectFiles::collect_files(&self.forward_origin, output);
CollectFiles::collect_files(&self.is_topic_message, output);
CollectFiles::collect_files(&self.is_automatic_forward, output);
CollectFiles::collect_files(&self.reply_to_message, output);
CollectFiles::collect_files(&self.external_reply, output);
CollectFiles::collect_files(&self.quote, output);
CollectFiles::collect_files(&self.reply_to_story, output);
CollectFiles::collect_files(&self.reply_to_checklist_task_id, output);
CollectFiles::collect_files(&self.reply_to_poll_option_id, output);
CollectFiles::collect_files(&self.via_bot, output);
CollectFiles::collect_files(&self.guest_bot_caller_user, output);
CollectFiles::collect_files(&self.guest_bot_caller_chat, output);
CollectFiles::collect_files(&self.edit_date, output);
CollectFiles::collect_files(&self.has_protected_content, output);
CollectFiles::collect_files(&self.is_from_offline, output);
CollectFiles::collect_files(&self.is_paid_post, output);
CollectFiles::collect_files(&self.media_group_id, output);
CollectFiles::collect_files(&self.author_signature, output);
CollectFiles::collect_files(&self.paid_star_count, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.entities, output);
CollectFiles::collect_files(&self.link_preview_options, output);
CollectFiles::collect_files(&self.suggested_post_info, output);
CollectFiles::collect_files(&self.effect_id, output);
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.audio, output);
CollectFiles::collect_files(&self.document, output);
CollectFiles::collect_files(&self.live_photo, output);
CollectFiles::collect_files(&self.paid_media, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.story, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.video_note, output);
CollectFiles::collect_files(&self.voice, output);
CollectFiles::collect_files(&self.caption, output);
CollectFiles::collect_files(&self.caption_entities, output);
CollectFiles::collect_files(&self.show_caption_above_media, output);
CollectFiles::collect_files(&self.has_media_spoiler, output);
CollectFiles::collect_files(&self.checklist, output);
CollectFiles::collect_files(&self.contact, output);
CollectFiles::collect_files(&self.dice, output);
CollectFiles::collect_files(&self.game, output);
CollectFiles::collect_files(&self.poll, output);
CollectFiles::collect_files(&self.venue, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.new_chat_members, output);
CollectFiles::collect_files(&self.left_chat_member, output);
CollectFiles::collect_files(&self.chat_owner_left, output);
CollectFiles::collect_files(&self.chat_owner_changed, output);
CollectFiles::collect_files(&self.new_chat_title, output);
CollectFiles::collect_files(&self.new_chat_photo, output);
CollectFiles::collect_files(&self.delete_chat_photo, output);
CollectFiles::collect_files(&self.group_chat_created, output);
CollectFiles::collect_files(&self.supergroup_chat_created, output);
CollectFiles::collect_files(&self.channel_chat_created, output);
CollectFiles::collect_files(&self.message_auto_delete_timer_changed, output);
CollectFiles::collect_files(&self.migrate_to_chat_id, output);
CollectFiles::collect_files(&self.migrate_from_chat_id, output);
CollectFiles::collect_files(&self.pinned_message, output);
CollectFiles::collect_files(&self.invoice, output);
CollectFiles::collect_files(&self.successful_payment, output);
CollectFiles::collect_files(&self.refunded_payment, output);
CollectFiles::collect_files(&self.users_shared, output);
CollectFiles::collect_files(&self.chat_shared, output);
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.unique_gift, output);
CollectFiles::collect_files(&self.gift_upgrade_sent, output);
CollectFiles::collect_files(&self.connected_website, output);
CollectFiles::collect_files(&self.write_access_allowed, output);
CollectFiles::collect_files(&self.passport_data, output);
CollectFiles::collect_files(&self.proximity_alert_triggered, output);
CollectFiles::collect_files(&self.boost_added, output);
CollectFiles::collect_files(&self.chat_background_set, output);
CollectFiles::collect_files(&self.checklist_tasks_done, output);
CollectFiles::collect_files(&self.checklist_tasks_added, output);
CollectFiles::collect_files(&self.direct_message_price_changed, output);
CollectFiles::collect_files(&self.forum_topic_created, output);
CollectFiles::collect_files(&self.forum_topic_edited, output);
CollectFiles::collect_files(&self.forum_topic_closed, output);
CollectFiles::collect_files(&self.forum_topic_reopened, output);
CollectFiles::collect_files(&self.general_forum_topic_hidden, output);
CollectFiles::collect_files(&self.general_forum_topic_unhidden, output);
CollectFiles::collect_files(&self.giveaway_created, output);
CollectFiles::collect_files(&self.giveaway, output);
CollectFiles::collect_files(&self.giveaway_winners, output);
CollectFiles::collect_files(&self.giveaway_completed, output);
CollectFiles::collect_files(&self.managed_bot_created, output);
CollectFiles::collect_files(&self.paid_message_price_changed, output);
CollectFiles::collect_files(&self.poll_option_added, output);
CollectFiles::collect_files(&self.poll_option_deleted, output);
CollectFiles::collect_files(&self.suggested_post_approved, output);
CollectFiles::collect_files(&self.suggested_post_approval_failed, output);
CollectFiles::collect_files(&self.suggested_post_declined, output);
CollectFiles::collect_files(&self.suggested_post_paid, output);
CollectFiles::collect_files(&self.suggested_post_refunded, output);
CollectFiles::collect_files(&self.video_chat_scheduled, output);
CollectFiles::collect_files(&self.video_chat_started, output);
CollectFiles::collect_files(&self.video_chat_ended, output);
CollectFiles::collect_files(&self.video_chat_participants_invited, output);
CollectFiles::collect_files(&self.web_app_data, output);
CollectFiles::collect_files(&self.reply_markup, output);
CollectFiles::collect_files(&self.rich_message, output);
CollectFiles::collect_files(&self.receiver_user, output);
CollectFiles::collect_files(&self.ephemeral_message_id, output);
CollectFiles::collect_files(&self.community_chat_added, output);
CollectFiles::collect_files(&self.community_chat_removed, output);
CollectFiles::collect_files(&self.forward_date, output);
CollectFiles::collect_files(&self.forward_from, output);
CollectFiles::collect_files(&self.forward_from_chat, output);
CollectFiles::collect_files(&self.forward_from_message_id, output);
CollectFiles::collect_files(&self.forward_sender_name, output);
CollectFiles::collect_files(&self.forward_signature, output);
CollectFiles::collect_files(&self.user_shared, output);
}
}
impl Message {
pub fn new(message_id: i64, date: i64, chat: Box<Chat>) -> Self {
Self {
message_id,
date,
chat,
message_thread_id: None,
direct_messages_topic: None,
from_user: None,
sender_chat: None,
sender_boost_count: None,
sender_business_bot: None,
sender_tag: None,
guest_query_id: None,
business_connection_id: None,
forward_origin: None,
is_topic_message: None,
is_automatic_forward: None,
reply_to_message: None,
external_reply: None,
quote: None,
reply_to_story: None,
reply_to_checklist_task_id: None,
reply_to_poll_option_id: None,
via_bot: None,
guest_bot_caller_user: None,
guest_bot_caller_chat: None,
edit_date: None,
has_protected_content: None,
is_from_offline: None,
is_paid_post: None,
media_group_id: None,
author_signature: None,
paid_star_count: None,
text: None,
entities: None,
link_preview_options: None,
suggested_post_info: None,
effect_id: None,
animation: None,
audio: None,
document: None,
live_photo: None,
paid_media: None,
photo: None,
sticker: None,
story: None,
video: None,
video_note: None,
voice: None,
caption: None,
caption_entities: None,
show_caption_above_media: None,
has_media_spoiler: None,
checklist: None,
contact: None,
dice: None,
game: None,
poll: None,
venue: None,
location: None,
new_chat_members: None,
left_chat_member: None,
chat_owner_left: None,
chat_owner_changed: None,
new_chat_title: None,
new_chat_photo: None,
delete_chat_photo: None,
group_chat_created: None,
supergroup_chat_created: None,
channel_chat_created: None,
message_auto_delete_timer_changed: None,
migrate_to_chat_id: None,
migrate_from_chat_id: None,
pinned_message: None,
invoice: None,
successful_payment: None,
refunded_payment: None,
users_shared: None,
chat_shared: None,
gift: None,
unique_gift: None,
gift_upgrade_sent: None,
connected_website: None,
write_access_allowed: None,
passport_data: None,
proximity_alert_triggered: None,
boost_added: None,
chat_background_set: None,
checklist_tasks_done: None,
checklist_tasks_added: None,
direct_message_price_changed: None,
forum_topic_created: None,
forum_topic_edited: None,
forum_topic_closed: None,
forum_topic_reopened: None,
general_forum_topic_hidden: None,
general_forum_topic_unhidden: None,
giveaway_created: None,
giveaway: None,
giveaway_winners: None,
giveaway_completed: None,
managed_bot_created: None,
paid_message_price_changed: None,
poll_option_added: None,
poll_option_deleted: None,
suggested_post_approved: None,
suggested_post_approval_failed: None,
suggested_post_declined: None,
suggested_post_paid: None,
suggested_post_refunded: None,
video_chat_scheduled: None,
video_chat_started: None,
video_chat_ended: None,
video_chat_participants_invited: None,
web_app_data: None,
reply_markup: None,
rich_message: None,
receiver_user: None,
ephemeral_message_id: None,
community_chat_added: None,
community_chat_removed: None,
forward_date: None,
forward_from: None,
forward_from_chat: None,
forward_from_message_id: None,
forward_sender_name: None,
forward_signature: None,
user_shared: None,
extra: BTreeMap::new(),
}
}
pub fn message_thread_id(mut self, value: i64) -> Self {
self.message_thread_id = Some(value);
self
}
pub fn direct_messages_topic(mut self, value: DirectMessagesTopic) -> Self {
self.direct_messages_topic = Some(value);
self
}
pub fn from_user(mut self, value: User) -> Self {
self.from_user = Some(value);
self
}
pub fn sender_chat(mut self, value: Box<Chat>) -> Self {
self.sender_chat = Some(value);
self
}
pub fn sender_boost_count(mut self, value: i64) -> Self {
self.sender_boost_count = Some(value);
self
}
pub fn sender_business_bot(mut self, value: User) -> Self {
self.sender_business_bot = Some(value);
self
}
pub fn sender_tag(mut self, value: impl Into<String>) -> Self {
self.sender_tag = Some(value.into());
self
}
pub fn guest_query_id(mut self, value: impl Into<String>) -> Self {
self.guest_query_id = Some(value.into());
self
}
pub fn business_connection_id(mut self, value: impl Into<String>) -> Self {
self.business_connection_id = Some(value.into());
self
}
pub fn forward_origin(mut self, value: impl Into<MessageOriginUnion>) -> Self {
self.forward_origin = Some(value.into());
self
}
pub fn is_topic_message(mut self, value: bool) -> Self {
self.is_topic_message = Some(value);
self
}
pub fn is_automatic_forward(mut self, value: bool) -> Self {
self.is_automatic_forward = Some(value);
self
}
pub fn reply_to_message(mut self, value: Box<Message>) -> Self {
self.reply_to_message = Some(value);
self
}
pub fn external_reply(mut self, value: ExternalReplyInfo) -> Self {
self.external_reply = Some(value);
self
}
pub fn quote(mut self, value: TextQuote) -> Self {
self.quote = Some(value);
self
}
pub fn reply_to_story(mut self, value: Story) -> Self {
self.reply_to_story = Some(value);
self
}
pub fn reply_to_checklist_task_id(mut self, value: i64) -> Self {
self.reply_to_checklist_task_id = Some(value);
self
}
pub fn reply_to_poll_option_id(mut self, value: impl Into<String>) -> Self {
self.reply_to_poll_option_id = Some(value.into());
self
}
pub fn via_bot(mut self, value: User) -> Self {
self.via_bot = Some(value);
self
}
pub fn guest_bot_caller_user(mut self, value: User) -> Self {
self.guest_bot_caller_user = Some(value);
self
}
pub fn guest_bot_caller_chat(mut self, value: Box<Chat>) -> Self {
self.guest_bot_caller_chat = Some(value);
self
}
pub fn edit_date(mut self, value: i64) -> Self {
self.edit_date = Some(value);
self
}
pub fn has_protected_content(mut self, value: bool) -> Self {
self.has_protected_content = Some(value);
self
}
pub fn is_from_offline(mut self, value: bool) -> Self {
self.is_from_offline = Some(value);
self
}
pub fn is_paid_post(mut self, value: bool) -> Self {
self.is_paid_post = Some(value);
self
}
pub fn media_group_id(mut self, value: impl Into<String>) -> Self {
self.media_group_id = Some(value.into());
self
}
pub fn author_signature(mut self, value: impl Into<String>) -> Self {
self.author_signature = Some(value.into());
self
}
pub fn paid_star_count(mut self, value: i64) -> Self {
self.paid_star_count = Some(value);
self
}
pub fn text(mut self, value: impl Into<String>) -> Self {
self.text = Some(value.into());
self
}
pub fn entities(mut self, value: Vec<MessageEntity>) -> Self {
self.entities = Some(value);
self
}
pub fn link_preview_options(mut self, value: LinkPreviewOptions) -> Self {
self.link_preview_options = Some(value);
self
}
pub fn suggested_post_info(mut self, value: SuggestedPostInfo) -> Self {
self.suggested_post_info = Some(value);
self
}
pub fn effect_id(mut self, value: impl Into<String>) -> Self {
self.effect_id = Some(value.into());
self
}
pub fn animation(mut self, value: Animation) -> Self {
self.animation = Some(value);
self
}
pub fn audio(mut self, value: Audio) -> Self {
self.audio = Some(value);
self
}
pub fn document(mut self, value: Document) -> Self {
self.document = Some(value);
self
}
pub fn live_photo(mut self, value: LivePhoto) -> Self {
self.live_photo = Some(value);
self
}
pub fn paid_media(mut self, value: PaidMediaInfo) -> Self {
self.paid_media = Some(value);
self
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
pub fn sticker(mut self, value: Sticker) -> Self {
self.sticker = Some(value);
self
}
pub fn story(mut self, value: Story) -> Self {
self.story = Some(value);
self
}
pub fn video(mut self, value: Video) -> Self {
self.video = Some(value);
self
}
pub fn video_note(mut self, value: VideoNote) -> Self {
self.video_note = Some(value);
self
}
pub fn voice(mut self, value: Voice) -> Self {
self.voice = Some(value);
self
}
pub fn caption(mut self, value: impl Into<String>) -> Self {
self.caption = Some(value.into());
self
}
pub fn caption_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.caption_entities = Some(value);
self
}
pub fn show_caption_above_media(mut self, value: bool) -> Self {
self.show_caption_above_media = Some(value);
self
}
pub fn has_media_spoiler(mut self, value: bool) -> Self {
self.has_media_spoiler = Some(value);
self
}
pub fn checklist(mut self, value: Checklist) -> Self {
self.checklist = Some(value);
self
}
pub fn contact(mut self, value: Contact) -> Self {
self.contact = Some(value);
self
}
pub fn dice(mut self, value: Dice) -> Self {
self.dice = Some(value);
self
}
pub fn game(mut self, value: Game) -> Self {
self.game = Some(value);
self
}
pub fn poll(mut self, value: Poll) -> Self {
self.poll = Some(value);
self
}
pub fn venue(mut self, value: Venue) -> Self {
self.venue = Some(value);
self
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
pub fn new_chat_members(mut self, value: Vec<User>) -> Self {
self.new_chat_members = Some(value);
self
}
pub fn left_chat_member(mut self, value: User) -> Self {
self.left_chat_member = Some(value);
self
}
pub fn chat_owner_left(mut self, value: ChatOwnerLeft) -> Self {
self.chat_owner_left = Some(value);
self
}
pub fn chat_owner_changed(mut self, value: ChatOwnerChanged) -> Self {
self.chat_owner_changed = Some(value);
self
}
pub fn new_chat_title(mut self, value: impl Into<String>) -> Self {
self.new_chat_title = Some(value.into());
self
}
pub fn new_chat_photo(mut self, value: Vec<PhotoSize>) -> Self {
self.new_chat_photo = Some(value);
self
}
pub fn delete_chat_photo(mut self, value: bool) -> Self {
self.delete_chat_photo = Some(value);
self
}
pub fn group_chat_created(mut self, value: bool) -> Self {
self.group_chat_created = Some(value);
self
}
pub fn supergroup_chat_created(mut self, value: bool) -> Self {
self.supergroup_chat_created = Some(value);
self
}
pub fn channel_chat_created(mut self, value: bool) -> Self {
self.channel_chat_created = Some(value);
self
}
pub fn message_auto_delete_timer_changed(
mut self,
value: MessageAutoDeleteTimerChanged,
) -> Self {
self.message_auto_delete_timer_changed = Some(value);
self
}
pub fn migrate_to_chat_id(mut self, value: i64) -> Self {
self.migrate_to_chat_id = Some(value);
self
}
pub fn migrate_from_chat_id(mut self, value: i64) -> Self {
self.migrate_from_chat_id = Some(value);
self
}
pub fn pinned_message(mut self, value: impl Into<MaybeInaccessibleMessageUnion>) -> Self {
self.pinned_message = Some(value.into());
self
}
pub fn invoice(mut self, value: Invoice) -> Self {
self.invoice = Some(value);
self
}
pub fn successful_payment(mut self, value: SuccessfulPayment) -> Self {
self.successful_payment = Some(value);
self
}
pub fn refunded_payment(mut self, value: RefundedPayment) -> Self {
self.refunded_payment = Some(value);
self
}
pub fn users_shared(mut self, value: UsersShared) -> Self {
self.users_shared = Some(value);
self
}
pub fn chat_shared(mut self, value: ChatShared) -> Self {
self.chat_shared = Some(value);
self
}
pub fn gift(mut self, value: GiftInfo) -> Self {
self.gift = Some(value);
self
}
pub fn unique_gift(mut self, value: UniqueGiftInfo) -> Self {
self.unique_gift = Some(value);
self
}
pub fn gift_upgrade_sent(mut self, value: GiftInfo) -> Self {
self.gift_upgrade_sent = Some(value);
self
}
pub fn connected_website(mut self, value: impl Into<String>) -> Self {
self.connected_website = Some(value.into());
self
}
pub fn write_access_allowed(mut self, value: WriteAccessAllowed) -> Self {
self.write_access_allowed = Some(value);
self
}
pub fn passport_data(mut self, value: PassportData) -> Self {
self.passport_data = Some(value);
self
}
pub fn proximity_alert_triggered(mut self, value: ProximityAlertTriggered) -> Self {
self.proximity_alert_triggered = Some(value);
self
}
pub fn boost_added(mut self, value: ChatBoostAdded) -> Self {
self.boost_added = Some(value);
self
}
pub fn chat_background_set(mut self, value: ChatBackground) -> Self {
self.chat_background_set = Some(value);
self
}
pub fn checklist_tasks_done(mut self, value: ChecklistTasksDone) -> Self {
self.checklist_tasks_done = Some(value);
self
}
pub fn checklist_tasks_added(mut self, value: ChecklistTasksAdded) -> Self {
self.checklist_tasks_added = Some(value);
self
}
pub fn direct_message_price_changed(mut self, value: DirectMessagePriceChanged) -> Self {
self.direct_message_price_changed = Some(value);
self
}
pub fn forum_topic_created(mut self, value: ForumTopicCreated) -> Self {
self.forum_topic_created = Some(value);
self
}
pub fn forum_topic_edited(mut self, value: ForumTopicEdited) -> Self {
self.forum_topic_edited = Some(value);
self
}
pub fn forum_topic_closed(mut self, value: ForumTopicClosed) -> Self {
self.forum_topic_closed = Some(value);
self
}
pub fn forum_topic_reopened(mut self, value: ForumTopicReopened) -> Self {
self.forum_topic_reopened = Some(value);
self
}
pub fn general_forum_topic_hidden(mut self, value: GeneralForumTopicHidden) -> Self {
self.general_forum_topic_hidden = Some(value);
self
}
pub fn general_forum_topic_unhidden(mut self, value: GeneralForumTopicUnhidden) -> Self {
self.general_forum_topic_unhidden = Some(value);
self
}
pub fn giveaway_created(mut self, value: GiveawayCreated) -> Self {
self.giveaway_created = Some(value);
self
}
pub fn giveaway(mut self, value: Giveaway) -> Self {
self.giveaway = Some(value);
self
}
pub fn giveaway_winners(mut self, value: GiveawayWinners) -> Self {
self.giveaway_winners = Some(value);
self
}
pub fn giveaway_completed(mut self, value: GiveawayCompleted) -> Self {
self.giveaway_completed = Some(value);
self
}
pub fn managed_bot_created(mut self, value: ManagedBotCreated) -> Self {
self.managed_bot_created = Some(value);
self
}
pub fn paid_message_price_changed(mut self, value: PaidMessagePriceChanged) -> Self {
self.paid_message_price_changed = Some(value);
self
}
pub fn poll_option_added(mut self, value: PollOptionAdded) -> Self {
self.poll_option_added = Some(value);
self
}
pub fn poll_option_deleted(mut self, value: PollOptionDeleted) -> Self {
self.poll_option_deleted = Some(value);
self
}
pub fn suggested_post_approved(mut self, value: SuggestedPostApproved) -> Self {
self.suggested_post_approved = Some(value);
self
}
pub fn suggested_post_approval_failed(mut self, value: SuggestedPostApprovalFailed) -> Self {
self.suggested_post_approval_failed = Some(value);
self
}
pub fn suggested_post_declined(mut self, value: SuggestedPostDeclined) -> Self {
self.suggested_post_declined = Some(value);
self
}
pub fn suggested_post_paid(mut self, value: SuggestedPostPaid) -> Self {
self.suggested_post_paid = Some(value);
self
}
pub fn suggested_post_refunded(mut self, value: SuggestedPostRefunded) -> Self {
self.suggested_post_refunded = Some(value);
self
}
pub fn video_chat_scheduled(mut self, value: VideoChatScheduled) -> Self {
self.video_chat_scheduled = Some(value);
self
}
pub fn video_chat_started(mut self, value: VideoChatStarted) -> Self {
self.video_chat_started = Some(value);
self
}
pub fn video_chat_ended(mut self, value: VideoChatEnded) -> Self {
self.video_chat_ended = Some(value);
self
}
pub fn video_chat_participants_invited(mut self, value: VideoChatParticipantsInvited) -> Self {
self.video_chat_participants_invited = Some(value);
self
}
pub fn web_app_data(mut self, value: WebAppData) -> Self {
self.web_app_data = Some(value);
self
}
pub fn reply_markup(mut self, value: InlineKeyboardMarkup) -> Self {
self.reply_markup = Some(value);
self
}
pub fn rich_message(mut self, value: RichMessage) -> Self {
self.rich_message = Some(value);
self
}
pub fn receiver_user(mut self, value: User) -> Self {
self.receiver_user = Some(value);
self
}
pub fn ephemeral_message_id(mut self, value: i64) -> Self {
self.ephemeral_message_id = Some(value);
self
}
pub fn community_chat_added(mut self, value: CommunityChatAdded) -> Self {
self.community_chat_added = Some(value);
self
}
pub fn community_chat_removed(mut self, value: CommunityChatRemoved) -> Self {
self.community_chat_removed = Some(value);
self
}
pub fn forward_date(mut self, value: i64) -> Self {
self.forward_date = Some(value);
self
}
pub fn forward_from(mut self, value: User) -> Self {
self.forward_from = Some(value);
self
}
pub fn forward_from_chat(mut self, value: Box<Chat>) -> Self {
self.forward_from_chat = Some(value);
self
}
pub fn forward_from_message_id(mut self, value: i64) -> Self {
self.forward_from_message_id = Some(value);
self
}
pub fn forward_sender_name(mut self, value: impl Into<String>) -> Self {
self.forward_sender_name = Some(value.into());
self
}
pub fn forward_signature(mut self, value: impl Into<String>) -> Self {
self.forward_signature = Some(value.into());
self
}
pub fn user_shared(mut self, value: UserShared) -> Self {
self.user_shared = Some(value);
self
}
}
#[doc = "This object represents a service message about a change in auto-delete timer settings."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageAutoDeleteTimerChanged {
#[doc = "New auto-delete time for messages in the chat; in seconds"]
pub message_auto_delete_time: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageAutoDeleteTimerChanged {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_auto_delete_time, output);
}
}
impl MessageAutoDeleteTimerChanged {
pub fn new(message_auto_delete_time: i64) -> Self {
Self {
message_auto_delete_time,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageEntity {
#[doc = "Type of the entity. Currently, can be 'mention' (@username), 'hashtag' (#hashtag or #hashtag@chatusername), 'cashtag' ($USD or $USD@chatusername), 'bot_command' (/start@jobs_bot), 'url' (https://telegram.org), 'email' (do-not-reply@telegram.org), 'phone_number' (+1-212-555-0123), 'bold' (bold text), 'italic' (italic text), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'spoiler' (spoiler message), 'blockquote' (block quotation), 'expandable_blockquote' (collapsed-by-default block quotation), 'code' (monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs), 'text_mention' (for users without usernames), 'custom_emoji' (for inline custom emoji stickers), or 'date_time' (for formatted date and time)."]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Offset in UTF-16 code units to the start of the entity"]
pub offset: i64,
#[doc = "Length of the entity in UTF-16 code units"]
pub length: i64,
#[doc = "For 'text_link' only, URL that will be opened after user taps on the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[doc = "For 'text_mention' only, the mentioned user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
#[doc = "For 'pre' only, the programming language of the entity text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[doc = "For 'custom_emoji' only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_emoji_id: Option<String>,
#[doc = "For 'date_time' only, the Unix time associated with the entity"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unix_time: Option<i64>,
#[doc = "For 'date_time' only, the string that defines the formatting of the date and time. See date-time entity formatting for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub date_time_format: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageEntity {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.offset, output);
CollectFiles::collect_files(&self.length, output);
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.language, output);
CollectFiles::collect_files(&self.custom_emoji_id, output);
CollectFiles::collect_files(&self.unix_time, output);
CollectFiles::collect_files(&self.date_time_format, output);
}
}
impl MessageEntity {
pub fn new(kind: impl Into<String>, offset: i64, length: i64) -> Self {
Self {
kind: kind.into(),
offset,
length,
url: None,
user: None,
language: None,
custom_emoji_id: None,
unix_time: None,
date_time_format: None,
extra: BTreeMap::new(),
}
}
pub fn url(mut self, value: impl Into<String>) -> Self {
self.url = Some(value.into());
self
}
pub fn user(mut self, value: User) -> Self {
self.user = Some(value);
self
}
pub fn language(mut self, value: impl Into<String>) -> Self {
self.language = Some(value.into());
self
}
pub fn custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.custom_emoji_id = Some(value.into());
self
}
pub fn unix_time(mut self, value: i64) -> Self {
self.unix_time = Some(value);
self
}
pub fn date_time_format(mut self, value: impl Into<String>) -> Self {
self.date_time_format = Some(value.into());
self
}
}
#[doc = "This object represents a unique message identifier."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageId {
#[doc = "Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent."]
pub message_id: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageId {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_id, output);
}
}
impl MessageId {
pub fn new(message_id: i64) -> Self {
Self {
message_id,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the origin of a message. It can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageOrigin {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageOrigin {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl MessageOrigin {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for MessageOrigin {
fn default() -> Self {
Self::new()
}
}
#[doc = "The message was originally sent to a channel chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageOriginChannel {
#[doc = "Type of the message origin, always 'channel'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Date the message was sent originally in Unix time"]
pub date: i64,
#[doc = "Channel chat to which the message was originally sent"]
pub chat: Box<Chat>,
#[doc = "Unique message identifier inside the chat"]
pub message_id: i64,
#[doc = "Signature of the original post author"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub author_signature: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageOriginChannel {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.author_signature, output);
}
}
impl MessageOriginChannel {
pub fn new(date: i64, chat: Box<Chat>, message_id: i64) -> Self {
Self {
kind: "channel".to_owned(),
date,
chat,
message_id,
author_signature: None,
extra: BTreeMap::new(),
}
}
pub fn author_signature(mut self, value: impl Into<String>) -> Self {
self.author_signature = Some(value.into());
self
}
}
#[doc = "The message was originally sent on behalf of a chat to a group chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageOriginChat {
#[doc = "Type of the message origin, always 'chat'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Date the message was sent originally in Unix time"]
pub date: i64,
#[doc = "Chat that sent the message originally"]
pub sender_chat: Box<Chat>,
#[doc = "For messages originally sent by an anonymous chat administrator, original message author signature"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub author_signature: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageOriginChat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.sender_chat, output);
CollectFiles::collect_files(&self.author_signature, output);
}
}
impl MessageOriginChat {
pub fn new(date: i64, sender_chat: Box<Chat>) -> Self {
Self {
kind: "chat".to_owned(),
date,
sender_chat,
author_signature: None,
extra: BTreeMap::new(),
}
}
pub fn author_signature(mut self, value: impl Into<String>) -> Self {
self.author_signature = Some(value.into());
self
}
}
#[doc = "The message was originally sent by an unknown user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageOriginHiddenUser {
#[doc = "Type of the message origin, always 'hidden_user'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Date the message was sent originally in Unix time"]
pub date: i64,
#[doc = "Name of the user that sent the message originally"]
pub sender_user_name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageOriginHiddenUser {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.sender_user_name, output);
}
}
impl MessageOriginHiddenUser {
pub fn new(date: i64, sender_user_name: impl Into<String>) -> Self {
Self {
kind: "hidden_user".to_owned(),
date,
sender_user_name: sender_user_name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The message was originally sent by a known user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageOriginUser {
#[doc = "Type of the message origin, always 'user'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Date the message was sent originally in Unix time"]
pub date: i64,
#[doc = "User that sent the message originally"]
pub sender_user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageOriginUser {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.sender_user, output);
}
}
impl MessageOriginUser {
pub fn new(date: i64, sender_user: User) -> Self {
Self {
kind: "user".to_owned(),
date,
sender_user,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents reaction changes on a message with anonymous reactions."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageReactionCountUpdated {
#[doc = "The chat containing the message"]
pub chat: Box<Chat>,
#[doc = "Unique message identifier inside the chat"]
pub message_id: i64,
#[doc = "Date of the change in Unix time"]
pub date: i64,
#[doc = "List of reactions that are present on the message"]
pub reactions: Vec<ReactionCount>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageReactionCountUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.reactions, output);
}
}
impl MessageReactionCountUpdated {
pub fn new(chat: Box<Chat>, message_id: i64, date: i64, reactions: Vec<ReactionCount>) -> Self {
Self {
chat,
message_id,
date,
reactions,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a change of a reaction on a message performed by a user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct MessageReactionUpdated {
#[doc = "The chat containing the message the user reacted to"]
pub chat: Box<Chat>,
#[doc = "Unique identifier of the message inside the chat"]
pub message_id: i64,
#[doc = "Date of the change in Unix time"]
pub date: i64,
#[doc = "Previous list of reaction types that were set by the user"]
pub old_reaction: Vec<ReactionTypeUnion>,
#[doc = "New list of reaction types that have been set by the user"]
pub new_reaction: Vec<ReactionTypeUnion>,
#[doc = "The user that changed the reaction, if the user isn't anonymous"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
#[doc = "The chat on behalf of which the reaction was changed, if the user is anonymous"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub actor_chat: Option<Box<Chat>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for MessageReactionUpdated {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.old_reaction, output);
CollectFiles::collect_files(&self.new_reaction, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.actor_chat, output);
}
}
impl MessageReactionUpdated {
pub fn new(
chat: Box<Chat>,
message_id: i64,
date: i64,
old_reaction: Vec<ReactionTypeUnion>,
new_reaction: Vec<ReactionTypeUnion>,
) -> Self {
Self {
chat,
message_id,
date,
old_reaction,
new_reaction,
user: None,
actor_chat: None,
extra: BTreeMap::new(),
}
}
pub fn user(mut self, value: User) -> Self {
self.user = Some(value);
self
}
pub fn actor_chat(mut self, value: Box<Chat>) -> Self {
self.actor_chat = Some(value);
self
}
}
#[doc = "This object represents information about an order."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct OrderInfo {
#[doc = "User name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "User's phone number"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
#[doc = "User email"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
#[doc = "User shipping address"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub shipping_address: Option<ShippingAddress>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for OrderInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.phone_number, output);
CollectFiles::collect_files(&self.email, output);
CollectFiles::collect_files(&self.shipping_address, output);
}
}
impl OrderInfo {
pub fn new() -> Self {
Self {
name: None,
phone_number: None,
email: None,
shipping_address: None,
extra: BTreeMap::new(),
}
}
pub fn name(mut self, value: impl Into<String>) -> Self {
self.name = Some(value.into());
self
}
pub fn phone_number(mut self, value: impl Into<String>) -> Self {
self.phone_number = Some(value.into());
self
}
pub fn email(mut self, value: impl Into<String>) -> Self {
self.email = Some(value.into());
self
}
pub fn shipping_address(mut self, value: ShippingAddress) -> Self {
self.shipping_address = Some(value);
self
}
}
impl Default for OrderInfo {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object describes a gift received and owned by a user or a chat. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct OwnedGift {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for OwnedGift {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl OwnedGift {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for OwnedGift {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a regular gift owned by a user or a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct OwnedGiftRegular {
#[doc = "Type of the gift, always 'regular'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Information about the regular gift"]
pub gift: Gift,
#[doc = "Date the gift was sent in Unix time"]
pub send_date: i64,
#[doc = "Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub owned_gift_id: Option<String>,
#[doc = "Sender of the gift if it is a known user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_user: Option<User>,
#[doc = "Text of the message that was added to the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<String>,
#[doc = "Special entities that appear in the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub entities: Option<Vec<MessageEntity>>,
#[doc = "True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_private: Option<bool>,
#[doc = "True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_saved: Option<bool>,
#[doc = "True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_be_upgraded: Option<bool>,
#[doc = "True, if the gift was refunded and isn't available anymore"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub was_refunded: Option<bool>,
#[doc = "Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub convert_star_count: Option<i64>,
#[doc = "Number of Telegram Stars that were paid for the ability to upgrade the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub prepaid_upgrade_star_count: Option<i64>,
#[doc = "True, if the gift's upgrade was purchased after the gift was sent; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_upgrade_separate: Option<bool>,
#[doc = "Unique number reserved for this gift when upgraded. See the number field in UniqueGift."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub unique_gift_number: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for OwnedGiftRegular {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.send_date, output);
CollectFiles::collect_files(&self.owned_gift_id, output);
CollectFiles::collect_files(&self.sender_user, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.entities, output);
CollectFiles::collect_files(&self.is_private, output);
CollectFiles::collect_files(&self.is_saved, output);
CollectFiles::collect_files(&self.can_be_upgraded, output);
CollectFiles::collect_files(&self.was_refunded, output);
CollectFiles::collect_files(&self.convert_star_count, output);
CollectFiles::collect_files(&self.prepaid_upgrade_star_count, output);
CollectFiles::collect_files(&self.is_upgrade_separate, output);
CollectFiles::collect_files(&self.unique_gift_number, output);
}
}
impl OwnedGiftRegular {
pub fn new(gift: Gift, send_date: i64) -> Self {
Self {
kind: "regular".to_owned(),
gift,
send_date,
owned_gift_id: None,
sender_user: None,
text: None,
entities: None,
is_private: None,
is_saved: None,
can_be_upgraded: None,
was_refunded: None,
convert_star_count: None,
prepaid_upgrade_star_count: None,
is_upgrade_separate: None,
unique_gift_number: None,
extra: BTreeMap::new(),
}
}
pub fn owned_gift_id(mut self, value: impl Into<String>) -> Self {
self.owned_gift_id = Some(value.into());
self
}
pub fn sender_user(mut self, value: User) -> Self {
self.sender_user = Some(value);
self
}
pub fn text(mut self, value: impl Into<String>) -> Self {
self.text = Some(value.into());
self
}
pub fn entities(mut self, value: Vec<MessageEntity>) -> Self {
self.entities = Some(value);
self
}
pub fn is_private(mut self, value: bool) -> Self {
self.is_private = Some(value);
self
}
pub fn is_saved(mut self, value: bool) -> Self {
self.is_saved = Some(value);
self
}
pub fn can_be_upgraded(mut self, value: bool) -> Self {
self.can_be_upgraded = Some(value);
self
}
pub fn was_refunded(mut self, value: bool) -> Self {
self.was_refunded = Some(value);
self
}
pub fn convert_star_count(mut self, value: i64) -> Self {
self.convert_star_count = Some(value);
self
}
pub fn prepaid_upgrade_star_count(mut self, value: i64) -> Self {
self.prepaid_upgrade_star_count = Some(value);
self
}
pub fn is_upgrade_separate(mut self, value: bool) -> Self {
self.is_upgrade_separate = Some(value);
self
}
pub fn unique_gift_number(mut self, value: i64) -> Self {
self.unique_gift_number = Some(value);
self
}
}
#[doc = "Describes a unique gift received and owned by a user or a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct OwnedGiftUnique {
#[doc = "Type of the gift, always 'unique'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Information about the unique gift"]
pub gift: UniqueGift,
#[doc = "Date the gift was sent in Unix time"]
pub send_date: i64,
#[doc = "Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub owned_gift_id: Option<String>,
#[doc = "Sender of the gift if it is a known user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sender_user: Option<User>,
#[doc = "True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_saved: Option<bool>,
#[doc = "True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_be_transferred: Option<bool>,
#[doc = "Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transfer_star_count: Option<i64>,
#[doc = "Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_transfer_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for OwnedGiftUnique {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.send_date, output);
CollectFiles::collect_files(&self.owned_gift_id, output);
CollectFiles::collect_files(&self.sender_user, output);
CollectFiles::collect_files(&self.is_saved, output);
CollectFiles::collect_files(&self.can_be_transferred, output);
CollectFiles::collect_files(&self.transfer_star_count, output);
CollectFiles::collect_files(&self.next_transfer_date, output);
}
}
impl OwnedGiftUnique {
pub fn new(gift: UniqueGift, send_date: i64) -> Self {
Self {
kind: "unique".to_owned(),
gift,
send_date,
owned_gift_id: None,
sender_user: None,
is_saved: None,
can_be_transferred: None,
transfer_star_count: None,
next_transfer_date: None,
extra: BTreeMap::new(),
}
}
pub fn owned_gift_id(mut self, value: impl Into<String>) -> Self {
self.owned_gift_id = Some(value.into());
self
}
pub fn sender_user(mut self, value: User) -> Self {
self.sender_user = Some(value);
self
}
pub fn is_saved(mut self, value: bool) -> Self {
self.is_saved = Some(value);
self
}
pub fn can_be_transferred(mut self, value: bool) -> Self {
self.can_be_transferred = Some(value);
self
}
pub fn transfer_star_count(mut self, value: i64) -> Self {
self.transfer_star_count = Some(value);
self
}
pub fn next_transfer_date(mut self, value: i64) -> Self {
self.next_transfer_date = Some(value);
self
}
}
#[doc = "Contains the list of gifts received and owned by a user or a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct OwnedGifts {
#[doc = "The total number of gifts owned by the user or the chat"]
pub total_count: i64,
#[doc = "The list of gifts"]
pub gifts: Vec<OwnedGiftUnion>,
#[doc = "Offset for the next request. If empty, then there are no more results."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_offset: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for OwnedGifts {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.total_count, output);
CollectFiles::collect_files(&self.gifts, output);
CollectFiles::collect_files(&self.next_offset, output);
}
}
impl OwnedGifts {
pub fn new(total_count: i64, gifts: Vec<OwnedGiftUnion>) -> Self {
Self {
total_count,
gifts,
next_offset: None,
extra: BTreeMap::new(),
}
}
pub fn next_offset(mut self, value: impl Into<String>) -> Self {
self.next_offset = Some(value.into());
self
}
}
#[doc = "This object describes paid media. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMedia {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMedia {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl PaidMedia {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for PaidMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes the paid media added to a message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaInfo {
#[doc = "The number of Telegram Stars that must be paid to buy access to the media"]
pub star_count: i64,
#[doc = "Information about the paid media"]
pub paid_media: Vec<PaidMediaUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.star_count, output);
CollectFiles::collect_files(&self.paid_media, output);
}
}
impl PaidMediaInfo {
pub fn new(star_count: i64, paid_media: Vec<PaidMediaUnion>) -> Self {
Self {
star_count,
paid_media,
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media is a live photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaLivePhoto {
#[doc = "Type of the paid media, always 'live_photo'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The photo"]
pub live_photo: LivePhoto,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaLivePhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.live_photo, output);
}
}
impl PaidMediaLivePhoto {
pub fn new(live_photo: LivePhoto) -> Self {
Self {
kind: "live_photo".to_owned(),
live_photo,
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media is a photo."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaPhoto {
#[doc = "Type of the paid media, always 'photo'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The photo"]
pub photo: Vec<PhotoSize>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl PaidMediaPhoto {
pub fn new(photo: Vec<PhotoSize>) -> Self {
Self {
kind: "photo".to_owned(),
photo,
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media isn't available before the payment."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaPreview {
#[doc = "Type of the paid media, always 'preview'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Media width as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[doc = "Media height as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[doc = "Duration of the media in seconds as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub duration: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaPreview {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
}
}
impl PaidMediaPreview {
pub fn new() -> Self {
Self {
kind: "preview".to_owned(),
width: None,
height: None,
duration: None,
extra: BTreeMap::new(),
}
}
pub fn width(mut self, value: i64) -> Self {
self.width = Some(value);
self
}
pub fn height(mut self, value: i64) -> Self {
self.height = Some(value);
self
}
pub fn duration(mut self, value: i64) -> Self {
self.duration = Some(value);
self
}
}
impl Default for PaidMediaPreview {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains information about a paid media purchase."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaPurchased {
#[doc = "User who purchased the media"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Bot-specified paid media payload"]
pub paid_media_payload: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaPurchased {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.paid_media_payload, output);
}
}
impl PaidMediaPurchased {
pub fn new(from_user: User, paid_media_payload: impl Into<String>) -> Self {
Self {
from_user,
paid_media_payload: paid_media_payload.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The paid media is a video."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMediaVideo {
#[doc = "Type of the paid media, always 'video'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The video"]
pub video: Video,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMediaVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.video, output);
}
}
impl PaidMediaVideo {
pub fn new(video: Video) -> Self {
Self {
kind: "video".to_owned(),
video,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a change in the price of paid messages within a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PaidMessagePriceChanged {
#[doc = "The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message"]
pub paid_message_star_count: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PaidMessagePriceChanged {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.paid_message_star_count, output);
}
}
impl PaidMessagePriceChanged {
pub fn new(paid_message_star_count: i64) -> Self {
Self {
paid_message_star_count,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes Telegram Passport data shared with the bot by the user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportData {
#[doc = "Array with information about documents and other Telegram Passport elements that was shared with the bot"]
pub data: Vec<EncryptedPassportElement>,
#[doc = "Encrypted credentials required to decrypt the data"]
pub credentials: EncryptedCredentials,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportData {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.data, output);
CollectFiles::collect_files(&self.credentials, output);
}
}
impl PassportData {
pub fn new(data: Vec<EncryptedPassportElement>, credentials: EncryptedCredentials) -> Self {
Self {
data,
credentials,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementError {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementError {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl PassportElementError {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for PassportElementError {
fn default() -> Self {
Self::new()
}
}
#[doc = "Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorDataField {
#[doc = "Error source, must be data"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the error, one of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Name of the data field which has the error"]
pub field_name: String,
#[doc = "Base64-encoded data hash"]
pub data_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorDataField {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.field_name, output);
CollectFiles::collect_files(&self.data_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorDataField {
pub fn new(
kind: impl Into<String>,
field_name: impl Into<String>,
data_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "data".to_owned(),
kind: kind.into(),
field_name: field_name.into(),
data_hash: data_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorFile {
#[doc = "Error source, must be file"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the issue, one of 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded file hash"]
pub file_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorFile {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorFile {
pub fn new(
kind: impl Into<String>,
file_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "file".to_owned(),
kind: kind.into(),
file_hash: file_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorFiles {
#[doc = "Error source, must be files"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the issue, one of 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "List of base64-encoded file hashes"]
pub file_hashes: Vec<String>,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorFiles {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hashes, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorFiles {
pub fn new(
kind: impl Into<String>,
file_hashes: Vec<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "files".to_owned(),
kind: kind.into(),
file_hashes,
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorFrontSide {
#[doc = "Error source, must be front_side"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded hash of the file with the front side of the document"]
pub file_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorFrontSide {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorFrontSide {
pub fn new(
kind: impl Into<String>,
file_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "front_side".to_owned(),
kind: kind.into(),
file_hash: file_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorReverseSide {
#[doc = "Error source, must be reverse_side"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the issue, one of 'driver_license', 'identity_card'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded hash of the file with the reverse side of the document"]
pub file_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorReverseSide {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorReverseSide {
pub fn new(
kind: impl Into<String>,
file_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "reverse_side".to_owned(),
kind: kind.into(),
file_hash: file_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorSelfie {
#[doc = "Error source, must be selfie"]
pub source: String,
#[doc = "The section of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded hash of the file with the selfie"]
pub file_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorSelfie {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorSelfie {
pub fn new(
kind: impl Into<String>,
file_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "selfie".to_owned(),
kind: kind.into(),
file_hash: file_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorTranslationFile {
#[doc = "Error source, must be translation_file"]
pub source: String,
#[doc = "Type of element of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded file hash"]
pub file_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorTranslationFile {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorTranslationFile {
pub fn new(
source: impl Into<String>,
kind: impl Into<String>,
file_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: source.into(),
kind: kind.into(),
file_hash: file_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorTranslationFiles {
#[doc = "Error source, must be translation_files"]
pub source: String,
#[doc = "Type of element of the user's Telegram Passport which has the issue, one of 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "List of base64-encoded file hashes"]
pub file_hashes: Vec<String>,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorTranslationFiles {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.file_hashes, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorTranslationFiles {
pub fn new(
source: impl Into<String>,
kind: impl Into<String>,
file_hashes: Vec<String>,
message: impl Into<String>,
) -> Self {
Self {
source: source.into(),
kind: kind.into(),
file_hashes,
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents an issue in an unspecified place. The error is considered resolved when new data is added."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportElementErrorUnspecified {
#[doc = "Error source, must be unspecified"]
pub source: String,
#[doc = "Type of element of the user's Telegram Passport which has the issue"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Base64-encoded element hash"]
pub element_hash: String,
#[doc = "Error message"]
pub message: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportElementErrorUnspecified {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.element_hash, output);
CollectFiles::collect_files(&self.message, output);
}
}
impl PassportElementErrorUnspecified {
pub fn new(
kind: impl Into<String>,
element_hash: impl Into<String>,
message: impl Into<String>,
) -> Self {
Self {
source: "unspecified".to_owned(),
kind: kind.into(),
element_hash: element_hash.into(),
message: message.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PassportFile {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "File size in bytes"]
pub file_size: i64,
#[doc = "Unix time when the file was uploaded"]
pub file_date: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PassportFile {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.file_size, output);
CollectFiles::collect_files(&self.file_date, output);
}
}
impl PassportFile {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
file_size: i64,
file_date: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
file_size,
file_date,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents one size of a photo or a file / sticker thumbnail."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PhotoSize {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Photo width"]
pub width: i64,
#[doc = "Photo height"]
pub height: i64,
#[doc = "File size in bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PhotoSize {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl PhotoSize {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
width: i64,
height: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object contains information about a poll."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Poll {
#[doc = "Unique poll identifier"]
pub id: String,
#[doc = "Poll question, 1-300 characters"]
pub question: String,
#[doc = "List of poll options"]
pub options: Vec<PollOption>,
#[doc = "Total number of users that voted in the poll"]
pub total_voter_count: i64,
#[doc = "True, if the poll is closed"]
pub is_closed: bool,
#[doc = "True, if the poll is anonymous"]
pub is_anonymous: bool,
#[doc = "Poll type, currently can be 'regular' or 'quiz'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "True, if the poll allows multiple answers"]
pub allows_multiple_answers: bool,
#[doc = "True, if the poll allows to change the chosen answer options"]
pub allows_revoting: bool,
#[doc = "True if voting is limited to users who have been members of the chat where the poll was originally sent for more than 24 hours"]
pub members_only: bool,
#[doc = "Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub question_entities: Option<Vec<MessageEntity>>,
#[doc = "A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which users can vote in the poll. The country code 'FT' is used for users with anonymous numbers. If omitted, then users from any country can participate in the poll."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub country_codes: Option<Vec<String>>,
#[doc = "Array of 0-based identifiers of the correct answer options. Available only for polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with the bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub correct_option_ids: Option<Vec<i64>>,
#[doc = "Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub explanation: Option<String>,
#[doc = "Special entities like usernames, URLs, bot commands, etc. that appear in the explanation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub explanation_entities: Option<Vec<MessageEntity>>,
#[doc = "Media added to the quiz explanation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub explanation_media: Option<PollMedia>,
#[doc = "Amount of time in seconds the poll will be active after creation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub open_period: Option<i64>,
#[doc = "Point in time (Unix timestamp) when the poll will be automatically closed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub close_date: Option<i64>,
#[doc = "Description of the poll; for polls inside the Message object only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Special entities like usernames, URLs, bot commands, etc. that appear in the description"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description_entities: Option<Vec<MessageEntity>>,
#[doc = "Media added to the poll description; for polls inside the Message object only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub media: Option<PollMedia>,
#[doc = "0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub correct_option_id: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Poll {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.question, output);
CollectFiles::collect_files(&self.options, output);
CollectFiles::collect_files(&self.total_voter_count, output);
CollectFiles::collect_files(&self.is_closed, output);
CollectFiles::collect_files(&self.is_anonymous, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.allows_multiple_answers, output);
CollectFiles::collect_files(&self.allows_revoting, output);
CollectFiles::collect_files(&self.members_only, output);
CollectFiles::collect_files(&self.question_entities, output);
CollectFiles::collect_files(&self.country_codes, output);
CollectFiles::collect_files(&self.correct_option_ids, output);
CollectFiles::collect_files(&self.explanation, output);
CollectFiles::collect_files(&self.explanation_entities, output);
CollectFiles::collect_files(&self.explanation_media, output);
CollectFiles::collect_files(&self.open_period, output);
CollectFiles::collect_files(&self.close_date, output);
CollectFiles::collect_files(&self.description, output);
CollectFiles::collect_files(&self.description_entities, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.correct_option_id, output);
}
}
impl Poll {
pub fn new(
id: impl Into<String>,
question: impl Into<String>,
options: Vec<PollOption>,
total_voter_count: i64,
is_closed: bool,
is_anonymous: bool,
kind: impl Into<String>,
allows_multiple_answers: bool,
allows_revoting: bool,
members_only: bool,
) -> Self {
Self {
id: id.into(),
question: question.into(),
options,
total_voter_count,
is_closed,
is_anonymous,
kind: kind.into(),
allows_multiple_answers,
allows_revoting,
members_only,
question_entities: None,
country_codes: None,
correct_option_ids: None,
explanation: None,
explanation_entities: None,
explanation_media: None,
open_period: None,
close_date: None,
description: None,
description_entities: None,
media: None,
correct_option_id: None,
extra: BTreeMap::new(),
}
}
pub fn question_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.question_entities = Some(value);
self
}
pub fn country_codes(mut self, value: Vec<String>) -> Self {
self.country_codes = Some(value);
self
}
pub fn correct_option_ids(mut self, value: Vec<i64>) -> Self {
self.correct_option_ids = Some(value);
self
}
pub fn explanation(mut self, value: impl Into<String>) -> Self {
self.explanation = Some(value.into());
self
}
pub fn explanation_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.explanation_entities = Some(value);
self
}
pub fn explanation_media(mut self, value: PollMedia) -> Self {
self.explanation_media = Some(value);
self
}
pub fn open_period(mut self, value: i64) -> Self {
self.open_period = Some(value);
self
}
pub fn close_date(mut self, value: i64) -> Self {
self.close_date = Some(value);
self
}
pub fn description(mut self, value: impl Into<String>) -> Self {
self.description = Some(value.into());
self
}
pub fn description_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.description_entities = Some(value);
self
}
pub fn media(mut self, value: PollMedia) -> Self {
self.media = Some(value);
self
}
pub fn correct_option_id(mut self, value: i64) -> Self {
self.correct_option_id = Some(value);
self
}
}
#[doc = "This object represents an answer of a user in a non-anonymous poll."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PollAnswer {
#[doc = "Unique poll identifier"]
pub poll_id: String,
#[doc = "0-based identifiers of chosen answer options. May be empty if the vote was retracted."]
pub option_ids: Vec<i64>,
#[doc = "Persistent identifiers of the chosen answer options. May be empty if the vote was retracted."]
pub option_persistent_ids: Vec<String>,
#[doc = "The chat that changed the answer to the poll, if the voter is anonymous"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub voter_chat: Option<Box<Chat>>,
#[doc = "The user that changed the answer to the poll, if the voter isn't anonymous"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<User>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PollAnswer {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.poll_id, output);
CollectFiles::collect_files(&self.option_ids, output);
CollectFiles::collect_files(&self.option_persistent_ids, output);
CollectFiles::collect_files(&self.voter_chat, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl PollAnswer {
pub fn new(
poll_id: impl Into<String>,
option_ids: Vec<i64>,
option_persistent_ids: Vec<String>,
) -> Self {
Self {
poll_id: poll_id.into(),
option_ids,
option_persistent_ids,
voter_chat: None,
user: None,
extra: BTreeMap::new(),
}
}
pub fn voter_chat(mut self, value: Box<Chat>) -> Self {
self.voter_chat = Some(value);
self
}
pub fn user(mut self, value: User) -> Self {
self.user = Some(value);
self
}
}
#[doc = "At most one of the optional fields can be present in any given object."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PollMedia {
#[doc = "Media is an animation, information about the animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub animation: Option<Animation>,
#[doc = "Media is an audio file, information about the file; currently, can't be received in a poll option"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio: Option<Audio>,
#[doc = "Media is a general file, information about the file; currently, can't be received in a poll option"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub document: Option<Document>,
#[doc = "Media is a live photo, information about the live photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub live_photo: Option<LivePhoto>,
#[doc = "Media is a shared location, information about the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub location: Option<Location>,
#[doc = "Media is a photo, available sizes of the photo"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[doc = "Media is a sticker, information about the sticker; currently, for poll options only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sticker: Option<Sticker>,
#[doc = "Media is a venue, information about the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub venue: Option<Venue>,
#[doc = "Media is a video, information about the video"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub video: Option<Video>,
#[doc = "The HTTP link attached to the poll option"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub link: Option<Link>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PollMedia {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.audio, output);
CollectFiles::collect_files(&self.document, output);
CollectFiles::collect_files(&self.live_photo, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.venue, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.link, output);
}
}
impl PollMedia {
pub fn new() -> Self {
Self {
animation: None,
audio: None,
document: None,
live_photo: None,
location: None,
photo: None,
sticker: None,
venue: None,
video: None,
link: None,
extra: BTreeMap::new(),
}
}
pub fn animation(mut self, value: Animation) -> Self {
self.animation = Some(value);
self
}
pub fn audio(mut self, value: Audio) -> Self {
self.audio = Some(value);
self
}
pub fn document(mut self, value: Document) -> Self {
self.document = Some(value);
self
}
pub fn live_photo(mut self, value: LivePhoto) -> Self {
self.live_photo = Some(value);
self
}
pub fn location(mut self, value: Location) -> Self {
self.location = Some(value);
self
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
pub fn sticker(mut self, value: Sticker) -> Self {
self.sticker = Some(value);
self
}
pub fn venue(mut self, value: Venue) -> Self {
self.venue = Some(value);
self
}
pub fn video(mut self, value: Video) -> Self {
self.video = Some(value);
self
}
pub fn link(mut self, value: Link) -> Self {
self.link = Some(value);
self
}
}
impl Default for PollMedia {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains information about one answer option in a poll."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PollOption {
#[doc = "Unique identifier of the option, persistent on option addition and deletion"]
pub persistent_id: String,
#[doc = "Option text, 1-100 characters"]
pub text: String,
#[doc = "Number of users who voted for this option; may be 0 if unknown"]
pub voter_count: i64,
#[doc = "Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_entities: Option<Vec<MessageEntity>>,
#[doc = "Media added to the poll option"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub media: Option<PollMedia>,
#[doc = "User who added the option; omitted if the option wasn't added by a user after poll creation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub added_by_user: Option<User>,
#[doc = "Chat that added the option; omitted if the option wasn't added by a chat after poll creation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub added_by_chat: Option<Box<Chat>>,
#[doc = "Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub addition_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PollOption {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.persistent_id, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.voter_count, output);
CollectFiles::collect_files(&self.text_entities, output);
CollectFiles::collect_files(&self.media, output);
CollectFiles::collect_files(&self.added_by_user, output);
CollectFiles::collect_files(&self.added_by_chat, output);
CollectFiles::collect_files(&self.addition_date, output);
}
}
impl PollOption {
pub fn new(
persistent_id: impl Into<String>,
text: impl Into<String>,
voter_count: i64,
) -> Self {
Self {
persistent_id: persistent_id.into(),
text: text.into(),
voter_count,
text_entities: None,
media: None,
added_by_user: None,
added_by_chat: None,
addition_date: None,
extra: BTreeMap::new(),
}
}
pub fn text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.text_entities = Some(value);
self
}
pub fn media(mut self, value: PollMedia) -> Self {
self.media = Some(value);
self
}
pub fn added_by_user(mut self, value: User) -> Self {
self.added_by_user = Some(value);
self
}
pub fn added_by_chat(mut self, value: Box<Chat>) -> Self {
self.added_by_chat = Some(value);
self
}
pub fn addition_date(mut self, value: i64) -> Self {
self.addition_date = Some(value);
self
}
}
#[doc = "Describes a service message about an option added to a poll."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PollOptionAdded {
#[doc = "Unique identifier of the added option"]
pub option_persistent_id: String,
#[doc = "Option text"]
pub option_text: String,
#[doc = "Message containing the poll to which the option was added, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_message: Option<MaybeInaccessibleMessageUnion>,
#[doc = "Special entities that appear in the option_text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub option_text_entities: Option<Vec<MessageEntity>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PollOptionAdded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.option_persistent_id, output);
CollectFiles::collect_files(&self.option_text, output);
CollectFiles::collect_files(&self.poll_message, output);
CollectFiles::collect_files(&self.option_text_entities, output);
}
}
impl PollOptionAdded {
pub fn new(option_persistent_id: impl Into<String>, option_text: impl Into<String>) -> Self {
Self {
option_persistent_id: option_persistent_id.into(),
option_text: option_text.into(),
poll_message: None,
option_text_entities: None,
extra: BTreeMap::new(),
}
}
pub fn poll_message(mut self, value: impl Into<MaybeInaccessibleMessageUnion>) -> Self {
self.poll_message = Some(value.into());
self
}
pub fn option_text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.option_text_entities = Some(value);
self
}
}
#[doc = "Describes a service message about an option deleted from a poll."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PollOptionDeleted {
#[doc = "Unique identifier of the deleted option"]
pub option_persistent_id: String,
#[doc = "Option text"]
pub option_text: String,
#[doc = "Message containing the poll from which the option was deleted, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_message: Option<MaybeInaccessibleMessageUnion>,
#[doc = "Special entities that appear in the option_text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub option_text_entities: Option<Vec<MessageEntity>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PollOptionDeleted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.option_persistent_id, output);
CollectFiles::collect_files(&self.option_text, output);
CollectFiles::collect_files(&self.poll_message, output);
CollectFiles::collect_files(&self.option_text_entities, output);
}
}
impl PollOptionDeleted {
pub fn new(option_persistent_id: impl Into<String>, option_text: impl Into<String>) -> Self {
Self {
option_persistent_id: option_persistent_id.into(),
option_text: option_text.into(),
poll_message: None,
option_text_entities: None,
extra: BTreeMap::new(),
}
}
pub fn poll_message(mut self, value: impl Into<MaybeInaccessibleMessageUnion>) -> Self {
self.poll_message = Some(value.into());
self
}
pub fn option_text_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.option_text_entities = Some(value);
self
}
}
#[doc = "This object contains information about an incoming pre-checkout query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PreCheckoutQuery {
#[doc = "Unique query identifier"]
pub id: String,
#[doc = "User who sent the query"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Three-letter ISO 4217 currency code, or 'XTR' for payments in Telegram Stars"]
pub currency: String,
#[doc = "Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."]
pub total_amount: i64,
#[doc = "Bot-specified invoice payload"]
pub invoice_payload: String,
#[doc = "Identifier of the shipping option chosen by the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub shipping_option_id: Option<String>,
#[doc = "Order information provided by the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub order_info: Option<OrderInfo>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PreCheckoutQuery {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.total_amount, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.shipping_option_id, output);
CollectFiles::collect_files(&self.order_info, output);
}
}
impl PreCheckoutQuery {
pub fn new(
id: impl Into<String>,
from_user: User,
currency: impl Into<String>,
total_amount: i64,
invoice_payload: impl Into<String>,
) -> Self {
Self {
id: id.into(),
from_user,
currency: currency.into(),
total_amount,
invoice_payload: invoice_payload.into(),
shipping_option_id: None,
order_info: None,
extra: BTreeMap::new(),
}
}
pub fn shipping_option_id(mut self, value: impl Into<String>) -> Self {
self.shipping_option_id = Some(value.into());
self
}
pub fn order_info(mut self, value: OrderInfo) -> Self {
self.order_info = Some(value);
self
}
}
#[doc = "Describes an inline message to be sent by a user of a Mini App."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PreparedInlineMessage {
#[doc = "Unique identifier of the prepared message"]
pub id: String,
#[doc = "Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used."]
pub expiration_date: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PreparedInlineMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.expiration_date, output);
}
}
impl PreparedInlineMessage {
pub fn new(id: impl Into<String>, expiration_date: i64) -> Self {
Self {
id: id.into(),
expiration_date,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a keyboard button to be used by a user of a Mini App."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PreparedKeyboardButton {
#[doc = "Unique identifier of the keyboard button"]
pub id: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for PreparedKeyboardButton {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
}
}
impl PreparedKeyboardButton {
pub fn new(id: impl Into<String>) -> Self {
Self {
id: id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ProximityAlertTriggered {
#[doc = "User that triggered the alert"]
pub traveler: User,
#[doc = "User that set the alert"]
pub watcher: User,
#[doc = "The distance between the users"]
pub distance: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ProximityAlertTriggered {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.traveler, output);
CollectFiles::collect_files(&self.watcher, output);
CollectFiles::collect_files(&self.distance, output);
}
}
impl ProximityAlertTriggered {
pub fn new(traveler: User, watcher: User, distance: i64) -> Self {
Self {
traveler,
watcher,
distance,
extra: BTreeMap::new(),
}
}
}
#[doc = "Represents a reaction added to a message along with the number of times it was added."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReactionCount {
#[doc = "Type of the reaction"]
#[serde(rename = "type")]
pub kind: ReactionTypeUnion,
#[doc = "Number of times the reaction was added"]
pub total_count: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReactionCount {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.total_count, output);
}
}
impl ReactionCount {
pub fn new(kind: impl Into<ReactionTypeUnion>, total_count: i64) -> Self {
Self {
kind: kind.into(),
total_count,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the type of a reaction. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReactionType {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReactionType {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl ReactionType {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for ReactionType {
fn default() -> Self {
Self::new()
}
}
#[doc = "The reaction is based on a custom emoji."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReactionTypeCustomEmoji {
#[doc = "Type of the reaction, always 'custom_emoji'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Custom emoji identifier"]
pub custom_emoji_id: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReactionTypeCustomEmoji {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.custom_emoji_id, output);
}
}
impl ReactionTypeCustomEmoji {
pub fn new(custom_emoji_id: impl Into<String>) -> Self {
Self {
kind: "custom_emoji".to_owned(),
custom_emoji_id: custom_emoji_id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The reaction is based on an emoji."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReactionTypeEmoji {
#[doc = "Type of the reaction, always 'emoji'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Reaction emoji. Currently, it can be one of \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"."]
pub emoji: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReactionTypeEmoji {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.emoji, output);
}
}
impl ReactionTypeEmoji {
pub fn new(emoji: impl Into<String>) -> Self {
Self {
kind: "emoji".to_owned(),
emoji: emoji.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "The reaction is paid."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReactionTypePaid {
#[doc = "Type of the reaction, always 'paid'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReactionTypePaid {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl ReactionTypePaid {
pub fn new() -> Self {
Self {
kind: "paid".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for ReactionTypePaid {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains basic information about a refunded payment."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RefundedPayment {
#[doc = "Three-letter ISO 4217 currency code, or 'XTR' for payments in Telegram Stars. Currently, always 'XTR'."]
pub currency: String,
#[doc = "Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."]
pub total_amount: i64,
#[doc = "Bot-specified invoice payload"]
pub invoice_payload: String,
#[doc = "Telegram payment identifier"]
pub telegram_payment_charge_id: String,
#[doc = "Provider payment identifier"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub provider_payment_charge_id: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RefundedPayment {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.total_amount, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.telegram_payment_charge_id, output);
CollectFiles::collect_files(&self.provider_payment_charge_id, output);
}
}
impl RefundedPayment {
pub fn new(
total_amount: i64,
invoice_payload: impl Into<String>,
telegram_payment_charge_id: impl Into<String>,
) -> Self {
Self {
currency: "XTR".to_owned(),
total_amount,
invoice_payload: invoice_payload.into(),
telegram_payment_charge_id: telegram_payment_charge_id.into(),
provider_payment_charge_id: None,
extra: BTreeMap::new(),
}
}
pub fn provider_payment_charge_id(mut self, value: impl Into<String>) -> Self {
self.provider_payment_charge_id = Some(value.into());
self
}
}
#[doc = "This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReplyKeyboardMarkup {
#[doc = "Array of button rows, each represented by an Array of KeyboardButton objects"]
pub keyboard: Vec<Vec<KeyboardButton>>,
#[doc = "Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to False, in which case the custom keyboard can be hidden and opened with a keyboard icon."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_persistent: Option<bool>,
#[doc = "Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to False, in which case the custom keyboard is always of the same height as the app's standard keyboard."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub resize_keyboard: Option<bool>,
#[doc = "Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to False."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub one_time_keyboard: Option<bool>,
#[doc = "The placeholder to be shown in the input field when the keyboard is active; 1-64 characters"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub input_field_placeholder: Option<String>,
#[doc = "Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selective: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReplyKeyboardMarkup {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.keyboard, output);
CollectFiles::collect_files(&self.is_persistent, output);
CollectFiles::collect_files(&self.resize_keyboard, output);
CollectFiles::collect_files(&self.one_time_keyboard, output);
CollectFiles::collect_files(&self.input_field_placeholder, output);
CollectFiles::collect_files(&self.selective, output);
}
}
impl ReplyKeyboardMarkup {
pub fn new(keyboard: Vec<Vec<KeyboardButton>>) -> Self {
Self {
keyboard,
is_persistent: None,
resize_keyboard: None,
one_time_keyboard: None,
input_field_placeholder: None,
selective: None,
extra: BTreeMap::new(),
}
}
pub fn is_persistent(mut self, value: bool) -> Self {
self.is_persistent = Some(value);
self
}
pub fn resize_keyboard(mut self, value: bool) -> Self {
self.resize_keyboard = Some(value);
self
}
pub fn one_time_keyboard(mut self, value: bool) -> Self {
self.one_time_keyboard = Some(value);
self
}
pub fn input_field_placeholder(mut self, value: impl Into<String>) -> Self {
self.input_field_placeholder = Some(value.into());
self
}
pub fn selective(mut self, value: bool) -> Self {
self.selective = Some(value);
self
}
}
#[doc = "Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a business account."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReplyKeyboardRemove {
#[doc = "Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)"]
pub remove_keyboard: bool,
#[doc = "Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub selective: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReplyKeyboardRemove {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.remove_keyboard, output);
CollectFiles::collect_files(&self.selective, output);
}
}
impl ReplyKeyboardRemove {
pub fn new() -> Self {
Self {
remove_keyboard: true,
selective: None,
extra: BTreeMap::new(),
}
}
pub fn selective(mut self, value: bool) -> Self {
self.selective = Some(value);
self
}
}
impl Default for ReplyKeyboardRemove {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes reply parameters for the message that is being sent."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReplyParameters {
#[doc = "Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified. Required if ephemeral_message_id isn't specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_id: Option<i64>,
#[doc = "If the message to be replied to is from a different chat, unique identifier for the chat or username of the bot, supergroup or channel in the format @username. Not supported for messages sent on behalf of a business account, messages from channel direct messages chats and ephemeral messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_id: Option<super::ChatId>,
#[doc = "Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic, and sent ephemeral messages. Always True for messages sent on behalf of a business account."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allow_sending_without_reply: Option<bool>,
#[doc = "Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities. The message will fail to send if the quote isn't found in the original message. Ignored for ephemeral messages."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub quote: Option<String>,
#[doc = "Mode for parsing entities in the quote. See formatting options for more details."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub quote_parse_mode: Option<String>,
#[doc = "A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub quote_entities: Option<Vec<MessageEntity>>,
#[doc = "Position of the quote in the original message in UTF-16 code units"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub quote_position: Option<i64>,
#[doc = "Identifier of the specific checklist task to be replied to"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checklist_task_id: Option<i64>,
#[doc = "Persistent identifier of the specific poll option to be replied to"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_option_id: Option<String>,
#[doc = "Identifier of the incoming ephemeral message that will be replied to in the current chat. A reply to an ephemeral message must itself be an ephemeral message. An ephemeral message may only be replied to within 15 seconds of being sent. Required if message_id isn't specified."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ephemeral_message_id: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ReplyParameters {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.message_id, output);
CollectFiles::collect_files(&self.chat_id, output);
CollectFiles::collect_files(&self.allow_sending_without_reply, output);
CollectFiles::collect_files(&self.quote, output);
CollectFiles::collect_files(&self.quote_parse_mode, output);
CollectFiles::collect_files(&self.quote_entities, output);
CollectFiles::collect_files(&self.quote_position, output);
CollectFiles::collect_files(&self.checklist_task_id, output);
CollectFiles::collect_files(&self.poll_option_id, output);
CollectFiles::collect_files(&self.ephemeral_message_id, output);
}
}
impl ReplyParameters {
pub fn new() -> Self {
Self {
message_id: None,
chat_id: None,
allow_sending_without_reply: None,
quote: None,
quote_parse_mode: None,
quote_entities: None,
quote_position: None,
checklist_task_id: None,
poll_option_id: None,
ephemeral_message_id: None,
extra: BTreeMap::new(),
}
}
pub fn message_id(mut self, value: i64) -> Self {
self.message_id = Some(value);
self
}
pub fn chat_id(mut self, value: impl Into<super::ChatId>) -> Self {
self.chat_id = Some(value.into());
self
}
pub fn allow_sending_without_reply(mut self, value: bool) -> Self {
self.allow_sending_without_reply = Some(value);
self
}
pub fn quote(mut self, value: impl Into<String>) -> Self {
self.quote = Some(value.into());
self
}
pub fn quote_parse_mode(mut self, value: impl Into<String>) -> Self {
self.quote_parse_mode = Some(value.into());
self
}
pub fn quote_entities(mut self, value: Vec<MessageEntity>) -> Self {
self.quote_entities = Some(value);
self
}
pub fn quote_position(mut self, value: i64) -> Self {
self.quote_position = Some(value);
self
}
pub fn checklist_task_id(mut self, value: i64) -> Self {
self.checklist_task_id = Some(value);
self
}
pub fn poll_option_id(mut self, value: impl Into<String>) -> Self {
self.poll_option_id = Some(value.into());
self
}
pub fn ephemeral_message_id(mut self, value: i64) -> Self {
self.ephemeral_message_id = Some(value);
self
}
}
impl Default for ReplyParameters {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes why a request was unsuccessful."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ResponseParameters {
#[doc = "The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub migrate_to_chat_id: Option<i64>,
#[doc = "In case of exceeding flood control, the number of seconds left to wait before the request can be repeated"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub retry_after: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ResponseParameters {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.migrate_to_chat_id, output);
CollectFiles::collect_files(&self.retry_after, output);
}
}
impl ResponseParameters {
pub fn new() -> Self {
Self {
migrate_to_chat_id: None,
retry_after: None,
extra: BTreeMap::new(),
}
}
pub fn migrate_to_chat_id(mut self, value: i64) -> Self {
self.migrate_to_chat_id = Some(value);
self
}
pub fn retry_after(mut self, value: i64) -> Self {
self.retry_after = Some(value);
self
}
}
impl Default for ResponseParameters {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object describes the state of a revenue withdrawal operation. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RevenueWithdrawalState {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RevenueWithdrawalState {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl RevenueWithdrawalState {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for RevenueWithdrawalState {
fn default() -> Self {
Self::new()
}
}
#[doc = "The withdrawal failed and the transaction was refunded."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RevenueWithdrawalStateFailed {
#[doc = "Type of the state, always 'failed'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RevenueWithdrawalStateFailed {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl RevenueWithdrawalStateFailed {
pub fn new() -> Self {
Self {
kind: "failed".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for RevenueWithdrawalStateFailed {
fn default() -> Self {
Self::new()
}
}
#[doc = "The withdrawal is in progress."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RevenueWithdrawalStatePending {
#[doc = "Type of the state, always 'pending'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RevenueWithdrawalStatePending {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl RevenueWithdrawalStatePending {
pub fn new() -> Self {
Self {
kind: "pending".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for RevenueWithdrawalStatePending {
fn default() -> Self {
Self::new()
}
}
#[doc = "The withdrawal succeeded."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RevenueWithdrawalStateSucceeded {
#[doc = "Type of the state, always 'succeeded'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Date the withdrawal was completed in Unix time"]
pub date: i64,
#[doc = "An HTTPS URL that can be used to see transaction details"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RevenueWithdrawalStateSucceeded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.url, output);
}
}
impl RevenueWithdrawalStateSucceeded {
pub fn new(date: i64, url: impl Into<String>) -> Self {
Self {
kind: "succeeded".to_owned(),
date,
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a block in a rich formatted message. Currently, it can be any of the following types:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlock {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlock {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl RichBlock {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for RichBlock {
fn default() -> Self {
Self::new()
}
}
#[doc = "A block with an anchor, corresponding to the HTML tag <a> with the attribute name."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockAnchor {
#[doc = "Type of the block, always 'anchor'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The name of the anchor"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockAnchor {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl RichBlockAnchor {
pub fn new(name: impl Into<String>) -> Self {
Self {
kind: "anchor".to_owned(),
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with an animation, corresponding to the HTML tag <video>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockAnimation {
#[doc = "Type of the block, always 'animation'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The animation"]
pub animation: Animation,
#[doc = "True, if the media preview is covered by a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockAnimation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.animation, output);
CollectFiles::collect_files(&self.has_spoiler, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockAnimation {
pub fn new(animation: Animation) -> Self {
Self {
kind: "animation".to_owned(),
animation,
has_spoiler: None,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a music file, corresponding to the HTML tag <audio>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockAudio {
#[doc = "Type of the block, always 'audio'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The audio"]
pub audio: Audio,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockAudio {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.audio, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockAudio {
pub fn new(audio: Audio) -> Self {
Self {
kind: "audio".to_owned(),
audio,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block quotation, corresponding to the HTML tag <blockquote>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockBlockQuotation {
#[doc = "Type of the block, always 'blockquote'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Content of the block"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "Credit of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub credit: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockBlockQuotation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.credit, output);
}
}
impl RichBlockBlockQuotation {
pub fn new(blocks: Vec<RichBlockUnion>) -> Self {
Self {
kind: "blockquote".to_owned(),
blocks,
credit: None,
extra: BTreeMap::new(),
}
}
pub fn credit(mut self, value: Box<RichTextUnion>) -> Self {
self.credit = Some(value);
self
}
}
#[doc = "Caption of a rich formatted block."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockCaption {
#[doc = "Block caption"]
pub text: Box<RichTextUnion>,
#[doc = "Block credit which corresponds to the HTML tag <cite>"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub credit: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockCaption {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.credit, output);
}
}
impl RichBlockCaption {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
text,
credit: None,
extra: BTreeMap::new(),
}
}
pub fn credit(mut self, value: Box<RichTextUnion>) -> Self {
self.credit = Some(value);
self
}
}
#[doc = "A collage, corresponding to the custom HTML tag <tg-collage>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockCollage {
#[doc = "Type of the block, always 'collage'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Elements of the collage"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockCollage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockCollage {
pub fn new(blocks: Vec<RichBlockUnion>) -> Self {
Self {
kind: "collage".to_owned(),
blocks,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "An expandable block for details disclosure, corresponding to the HTML tag <details>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockDetails {
#[doc = "Type of the block, always 'details'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Always shown summary of the block"]
pub summary: Box<RichTextUnion>,
#[doc = "Content of the block"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "True, if the content of the block is visible by default"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_open: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockDetails {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.summary, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.is_open, output);
}
}
impl RichBlockDetails {
pub fn new(summary: Box<RichTextUnion>, blocks: Vec<RichBlockUnion>) -> Self {
Self {
kind: "details".to_owned(),
summary,
blocks,
is_open: None,
extra: BTreeMap::new(),
}
}
pub fn is_open(mut self, value: bool) -> Self {
self.is_open = Some(value);
self
}
}
#[doc = "A divider, corresponding to the HTML tag <hr/>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockDivider {
#[doc = "Type of the block, always 'divider'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockDivider {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl RichBlockDivider {
pub fn new() -> Self {
Self {
kind: "divider".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for RichBlockDivider {
fn default() -> Self {
Self::new()
}
}
#[doc = "A footer, corresponding to the HTML tag <footer>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockFooter {
#[doc = "Type of the block, always 'footer'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockFooter {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichBlockFooter {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "footer".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockList {
#[doc = "Type of the block, always 'list'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Items of the list"]
pub items: Vec<RichBlockListItem>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockList {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.items, output);
}
}
impl RichBlockList {
pub fn new(items: Vec<RichBlockListItem>) -> Self {
Self {
kind: "list".to_owned(),
items,
extra: BTreeMap::new(),
}
}
}
#[doc = "An item of a list."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockListItem {
#[doc = "Label of the item"]
pub label: String,
#[doc = "The content of the item"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "True, if the item has a checkbox"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_checkbox: Option<bool>,
#[doc = "True, if the item has a checked checkbox"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_checked: Option<bool>,
#[doc = "For ordered lists, the numeric value of the item label"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value: Option<i64>,
#[doc = "For ordered lists, the type of the item label; must be one of 'a' for lowercase letters, 'A' for uppercase letters, 'i' for lowercase Roman numerals, 'I' for uppercase Roman numerals, or '1' for decimal numbers"]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockListItem {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.label, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.has_checkbox, output);
CollectFiles::collect_files(&self.is_checked, output);
CollectFiles::collect_files(&self.value, output);
CollectFiles::collect_files(&self.kind, output);
}
}
impl RichBlockListItem {
pub fn new(label: impl Into<String>, blocks: Vec<RichBlockUnion>) -> Self {
Self {
label: label.into(),
blocks,
has_checkbox: None,
is_checked: None,
value: None,
kind: None,
extra: BTreeMap::new(),
}
}
pub fn has_checkbox(mut self, value: bool) -> Self {
self.has_checkbox = Some(value);
self
}
pub fn is_checked(mut self, value: bool) -> Self {
self.is_checked = Some(value);
self
}
pub fn value(mut self, value: i64) -> Self {
self.value = Some(value);
self
}
pub fn kind(mut self, value: impl Into<String>) -> Self {
self.kind = Some(value.into());
self
}
}
#[doc = "A block with a map, corresponding to the custom HTML tag <tg-map>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockMap {
#[doc = "Type of the block, always 'map'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Location of the center of the map"]
pub location: Location,
#[doc = "Map zoom level; 13-20"]
pub zoom: i64,
#[doc = "Expected width of the map"]
pub width: i64,
#[doc = "Expected height of the map"]
pub height: i64,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockMap {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.zoom, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockMap {
pub fn new(location: Location, zoom: i64, width: i64, height: i64) -> Self {
Self {
kind: "map".to_owned(),
location,
zoom,
width,
height,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockMathematicalExpression {
#[doc = "Type of the block, always 'mathematical_expression'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The mathematical expression in LaTeX format"]
pub expression: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockMathematicalExpression {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.expression, output);
}
}
impl RichBlockMathematicalExpression {
pub fn new(expression: impl Into<String>) -> Self {
Self {
kind: "mathematical_expression".to_owned(),
expression: expression.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text paragraph, corresponding to the HTML tag <p>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockParagraph {
#[doc = "Type of the block, always 'paragraph'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockParagraph {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichBlockParagraph {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "paragraph".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with a photo, corresponding to the HTML tag <img>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockPhoto {
#[doc = "Type of the block, always 'photo'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Available sizes of the photo"]
pub photo: Vec<PhotoSize>,
#[doc = "True, if the media preview is covered by a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockPhoto {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.photo, output);
CollectFiles::collect_files(&self.has_spoiler, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockPhoto {
pub fn new(photo: Vec<PhotoSize>) -> Self {
Self {
kind: "photo".to_owned(),
photo,
has_spoiler: None,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A preformatted text block, corresponding to the nested HTML tags <pre> and <code>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockPreformatted {
#[doc = "Type of the block, always 'pre'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "The programming language of the text"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub language: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockPreformatted {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.language, output);
}
}
impl RichBlockPreformatted {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "pre".to_owned(),
text,
language: None,
extra: BTreeMap::new(),
}
}
pub fn language(mut self, value: impl Into<String>) -> Self {
self.language = Some(value.into());
self
}
}
#[doc = "A quotation with centered text, loosely corresponding to the HTML tag <aside>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockPullQuotation {
#[doc = "Type of the block, always 'pullquote'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "Credit of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub credit: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockPullQuotation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.credit, output);
}
}
impl RichBlockPullQuotation {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "pullquote".to_owned(),
text,
credit: None,
extra: BTreeMap::new(),
}
}
pub fn credit(mut self, value: Box<RichTextUnion>) -> Self {
self.credit = Some(value);
self
}
}
#[doc = "A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockSectionHeading {
#[doc = "Type of the block, always 'heading'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block"]
pub text: Box<RichTextUnion>,
#[doc = "Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest"]
pub size: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockSectionHeading {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.size, output);
}
}
impl RichBlockSectionHeading {
pub fn new(text: Box<RichTextUnion>, size: i64) -> Self {
Self {
kind: "heading".to_owned(),
text,
size,
extra: BTreeMap::new(),
}
}
}
#[doc = "A slideshow, corresponding to the custom HTML tag <tg-slideshow>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockSlideshow {
#[doc = "Type of the block, always 'slideshow'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Elements of the slideshow"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockSlideshow {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockSlideshow {
pub fn new(blocks: Vec<RichBlockUnion>) -> Self {
Self {
kind: "slideshow".to_owned(),
blocks,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A table, corresponding to the HTML tag <table>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockTable {
#[doc = "Type of the block, always 'table'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Cells of the table"]
pub cells: Vec<Vec<RichBlockTableCell>>,
#[doc = "True, if the table has borders"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_bordered: Option<bool>,
#[doc = "True, if the table is striped"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_striped: Option<bool>,
#[doc = "Caption of the table"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<Box<RichTextUnion>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockTable {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.cells, output);
CollectFiles::collect_files(&self.is_bordered, output);
CollectFiles::collect_files(&self.is_striped, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockTable {
pub fn new(cells: Vec<Vec<RichBlockTableCell>>) -> Self {
Self {
kind: "table".to_owned(),
cells,
is_bordered: None,
is_striped: None,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn is_bordered(mut self, value: bool) -> Self {
self.is_bordered = Some(value);
self
}
pub fn is_striped(mut self, value: bool) -> Self {
self.is_striped = Some(value);
self
}
pub fn caption(mut self, value: Box<RichTextUnion>) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "Cell in a table."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockTableCell {
#[doc = "Horizontal cell content alignment. Currently, must be one of 'left', 'center', or 'right'."]
pub align: String,
#[doc = "Vertical cell content alignment. Currently, must be one of 'top', 'middle', or 'bottom'."]
pub valign: String,
#[doc = "Text in the cell. If omitted, then the cell is invisible."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<Box<RichTextUnion>>,
#[doc = "True, if the cell is a header cell"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_header: Option<bool>,
#[doc = "The number of columns the cell spans if it is bigger than 1"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub colspan: Option<i64>,
#[doc = "The number of rows the cell spans if it is bigger than 1"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rowspan: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockTableCell {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.align, output);
CollectFiles::collect_files(&self.valign, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.is_header, output);
CollectFiles::collect_files(&self.colspan, output);
CollectFiles::collect_files(&self.rowspan, output);
}
}
impl RichBlockTableCell {
pub fn new(align: impl Into<String>, valign: impl Into<String>) -> Self {
Self {
align: align.into(),
valign: valign.into(),
text: None,
is_header: None,
colspan: None,
rowspan: None,
extra: BTreeMap::new(),
}
}
pub fn text(mut self, value: Box<RichTextUnion>) -> Self {
self.text = Some(value);
self
}
pub fn is_header(mut self, value: bool) -> Self {
self.is_header = Some(value);
self
}
pub fn colspan(mut self, value: i64) -> Self {
self.colspan = Some(value);
self
}
pub fn rowspan(mut self, value: i64) -> Self {
self.rowspan = Some(value);
self
}
}
#[doc = "A block with a 'Thinking…' placeholder, corresponding to the custom HTML tag <tg-thinking>. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockThinking {
#[doc = "Type of the block, always 'thinking'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block."]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockThinking {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichBlockThinking {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "thinking".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A block with a video, corresponding to the HTML tag <video>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockVideo {
#[doc = "Type of the block, always 'video'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The video"]
pub video: Video,
#[doc = "True, if the media preview is covered by a spoiler animation"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_spoiler: Option<bool>,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockVideo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.video, output);
CollectFiles::collect_files(&self.has_spoiler, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockVideo {
pub fn new(video: Video) -> Self {
Self {
kind: "video".to_owned(),
video,
has_spoiler: None,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn has_spoiler(mut self, value: bool) -> Self {
self.has_spoiler = Some(value);
self
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "A block with a voice note, corresponding to the HTML tag <audio>."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichBlockVoiceNote {
#[doc = "Type of the block, always 'voice_note'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The voice note"]
pub voice_note: Voice,
#[doc = "Caption of the block"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub caption: Option<RichBlockCaption>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichBlockVoiceNote {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.voice_note, output);
CollectFiles::collect_files(&self.caption, output);
}
}
impl RichBlockVoiceNote {
pub fn new(voice_note: Voice) -> Self {
Self {
kind: "voice_note".to_owned(),
voice_note,
caption: None,
extra: BTreeMap::new(),
}
}
pub fn caption(mut self, value: RichBlockCaption) -> Self {
self.caption = Some(value);
self
}
}
#[doc = "Rich formatted message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichMessage {
#[doc = "Content of the message"]
pub blocks: Vec<RichBlockUnion>,
#[doc = "True, if the rich message must be shown right-to-left"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_rtl: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.blocks, output);
CollectFiles::collect_files(&self.is_rtl, output);
}
}
impl RichMessage {
pub fn new(blocks: Vec<RichBlockUnion>) -> Self {
Self {
blocks,
is_rtl: None,
extra: BTreeMap::new(),
}
}
pub fn is_rtl(mut self, value: bool) -> Self {
self.is_rtl = Some(value);
self
}
}
#[doc = "This object represents a rich formatted text. Currently, it can be either a String for plain text, an Array of RichText, or any of the following types:"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichText {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichText {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl RichText {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for RichText {
fn default() -> Self {
Self::new()
}
}
#[doc = "An anchor."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextAnchor {
#[doc = "Type of the rich text, always 'anchor'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The name of the anchor"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextAnchor {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl RichTextAnchor {
pub fn new(name: impl Into<String>) -> Self {
Self {
kind: "anchor".to_owned(),
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A link to an anchor."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextAnchorLink {
#[doc = "Type of the rich text, always 'anchor_link'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The link text"]
pub text: Box<RichTextUnion>,
#[doc = "The name of the anchor. If the name is empty, then the link brings back to the top of the message."]
pub anchor_name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextAnchorLink {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.anchor_name, output);
}
}
impl RichTextAnchorLink {
pub fn new(text: Box<RichTextUnion>, anchor_name: impl Into<String>) -> Self {
Self {
kind: "anchor_link".to_owned(),
text,
anchor_name: anchor_name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text with a bank card number."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextBankCardNumber {
#[doc = "Type of the rich text, always 'bank_card_number'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The bank card number"]
pub bank_card_number: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextBankCardNumber {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.bank_card_number, output);
}
}
impl RichTextBankCardNumber {
pub fn new(text: Box<RichTextUnion>, bank_card_number: impl Into<String>) -> Self {
Self {
kind: "bank_card_number".to_owned(),
text,
bank_card_number: bank_card_number.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A bold text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextBold {
#[doc = "Type of the rich text, always 'bold'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextBold {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextBold {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "bold".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A bot command."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextBotCommand {
#[doc = "Type of the rich text, always 'bot_command'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The bot command"]
pub bot_command: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextBotCommand {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.bot_command, output);
}
}
impl RichTextBotCommand {
pub fn new(text: Box<RichTextUnion>, bot_command: impl Into<String>) -> Self {
Self {
kind: "bot_command".to_owned(),
text,
bot_command: bot_command.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A cashtag."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextCashtag {
#[doc = "Type of the rich text, always 'cashtag'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The cashtag"]
pub cashtag: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextCashtag {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.cashtag, output);
}
}
impl RichTextCashtag {
pub fn new(text: Box<RichTextUnion>, cashtag: impl Into<String>) -> Self {
Self {
kind: "cashtag".to_owned(),
text,
cashtag: cashtag.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A monowidth text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextCode {
#[doc = "Type of the rich text, always 'code'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextCode {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextCode {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "code".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A custom emoji."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextCustomEmoji {
#[doc = "Type of the rich text, always 'custom_emoji'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker."]
pub custom_emoji_id: String,
#[doc = "Alternative emoji for the custom emoji"]
pub alternative_text: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextCustomEmoji {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.custom_emoji_id, output);
CollectFiles::collect_files(&self.alternative_text, output);
}
}
impl RichTextCustomEmoji {
pub fn new(custom_emoji_id: impl Into<String>, alternative_text: impl Into<String>) -> Self {
Self {
kind: "custom_emoji".to_owned(),
custom_emoji_id: custom_emoji_id.into(),
alternative_text: alternative_text.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Formatted date and time."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextDateTime {
#[doc = "Type of the rich text, always 'date_time'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The Unix time associated with the entity"]
pub unix_time: i64,
#[doc = "The string that defines the formatting of the date and time. See date-time entity formatting for more details."]
pub date_time_format: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextDateTime {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.unix_time, output);
CollectFiles::collect_files(&self.date_time_format, output);
}
}
impl RichTextDateTime {
pub fn new(
text: Box<RichTextUnion>,
unix_time: i64,
date_time_format: impl Into<String>,
) -> Self {
Self {
kind: "date_time".to_owned(),
text,
unix_time,
date_time_format: date_time_format.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text with an email address."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextEmailAddress {
#[doc = "Type of the rich text, always 'email_address'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The email address"]
pub email_address: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextEmailAddress {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.email_address, output);
}
}
impl RichTextEmailAddress {
pub fn new(text: Box<RichTextUnion>, email_address: impl Into<String>) -> Self {
Self {
kind: "email_address".to_owned(),
text,
email_address: email_address.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A hashtag."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextHashtag {
#[doc = "Type of the rich text, always 'hashtag'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The hashtag"]
pub hashtag: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextHashtag {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.hashtag, output);
}
}
impl RichTextHashtag {
pub fn new(text: Box<RichTextUnion>, hashtag: impl Into<String>) -> Self {
Self {
kind: "hashtag".to_owned(),
text,
hashtag: hashtag.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "An italicized text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextItalic {
#[doc = "Type of the rich text, always 'italic'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextItalic {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextItalic {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "italic".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A marked text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextMarked {
#[doc = "Type of the rich text, always 'marked'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextMarked {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextMarked {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "marked".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A mathematical expression."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextMathematicalExpression {
#[doc = "Type of the rich text, always 'mathematical_expression'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The expression in LaTeX format"]
pub expression: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextMathematicalExpression {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.expression, output);
}
}
impl RichTextMathematicalExpression {
pub fn new(expression: impl Into<String>) -> Self {
Self {
kind: "mathematical_expression".to_owned(),
expression: expression.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A mention by a username."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextMention {
#[doc = "Type of the rich text, always 'mention'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The username"]
pub username: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextMention {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.username, output);
}
}
impl RichTextMention {
pub fn new(text: Box<RichTextUnion>, username: impl Into<String>) -> Self {
Self {
kind: "mention".to_owned(),
text,
username: username.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text with a phone number."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextPhoneNumber {
#[doc = "Type of the rich text, always 'phone_number'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The phone number"]
pub phone_number: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextPhoneNumber {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.phone_number, output);
}
}
impl RichTextPhoneNumber {
pub fn new(text: Box<RichTextUnion>, phone_number: impl Into<String>) -> Self {
Self {
kind: "phone_number".to_owned(),
text,
phone_number: phone_number.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A reference."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextReference {
#[doc = "Type of the rich text, always 'reference'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Text of the reference"]
pub text: Box<RichTextUnion>,
#[doc = "The name of the reference"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextReference {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl RichTextReference {
pub fn new(text: Box<RichTextUnion>, name: impl Into<String>) -> Self {
Self {
kind: "reference".to_owned(),
text,
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A link to a reference."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextReferenceLink {
#[doc = "Type of the rich text, always 'reference_link'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The link text"]
pub text: Box<RichTextUnion>,
#[doc = "The name of the reference"]
pub reference_name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextReferenceLink {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.reference_name, output);
}
}
impl RichTextReferenceLink {
pub fn new(text: Box<RichTextUnion>, reference_name: impl Into<String>) -> Self {
Self {
kind: "reference_link".to_owned(),
text,
reference_name: reference_name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "A text covered by a spoiler."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextSpoiler {
#[doc = "Type of the rich text, always 'spoiler'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextSpoiler {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextSpoiler {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "spoiler".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A strikethrough text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextStrikethrough {
#[doc = "Type of the rich text, always 'strikethrough'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextStrikethrough {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextStrikethrough {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "strikethrough".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A subscript text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextSubscript {
#[doc = "Type of the rich text, always 'subscript'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextSubscript {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextSubscript {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "subscript".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A superscript text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextSuperscript {
#[doc = "Type of the rich text, always 'superscript'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextSuperscript {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextSuperscript {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "superscript".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A mention of a Telegram user by their identifier."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextTextMention {
#[doc = "Type of the rich text, always 'text_mention'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "The mentioned user"]
pub user: User,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextTextMention {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.user, output);
}
}
impl RichTextTextMention {
pub fn new(text: Box<RichTextUnion>, user: User) -> Self {
Self {
kind: "text_mention".to_owned(),
text,
user,
extra: BTreeMap::new(),
}
}
}
#[doc = "An underlined text."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextUnderline {
#[doc = "Type of the rich text, always 'underline'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextUnderline {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
}
}
impl RichTextUnderline {
pub fn new(text: Box<RichTextUnion>) -> Self {
Self {
kind: "underline".to_owned(),
text,
extra: BTreeMap::new(),
}
}
}
#[doc = "A text with a link."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RichTextUrl {
#[doc = "Type of the rich text, always 'url'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The text"]
pub text: Box<RichTextUnion>,
#[doc = "URL of the link"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for RichTextUrl {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.url, output);
}
}
impl RichTextUrl {
pub fn new(text: Box<RichTextUnion>, url: impl Into<String>) -> Self {
Self {
kind: "url".to_owned(),
text,
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes an inline message sent by a guest bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SentGuestMessage {
#[doc = "Identifier of the sent inline message"]
pub inline_message_id: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SentGuestMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.inline_message_id, output);
}
}
impl SentGuestMessage {
pub fn new(inline_message_id: impl Into<String>) -> Self {
Self {
inline_message_id: inline_message_id.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes an inline message sent by a Web App on behalf of a user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SentWebAppMessage {
#[doc = "Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub inline_message_id: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SentWebAppMessage {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.inline_message_id, output);
}
}
impl SentWebAppMessage {
pub fn new() -> Self {
Self {
inline_message_id: None,
extra: BTreeMap::new(),
}
}
pub fn inline_message_id(mut self, value: impl Into<String>) -> Self {
self.inline_message_id = Some(value.into());
self
}
}
impl Default for SentWebAppMessage {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SharedUser {
#[doc = "Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means."]
pub user_id: i64,
#[doc = "First name of the user, if the name was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[doc = "Last name of the user, if the name was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "Username of the user, if the username was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[doc = "Available sizes of the chat photo, if the photo was requested by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub photo: Option<Vec<PhotoSize>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SharedUser {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.user_id, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.username, output);
CollectFiles::collect_files(&self.photo, output);
}
}
impl SharedUser {
pub fn new(user_id: i64) -> Self {
Self {
user_id,
first_name: None,
last_name: None,
username: None,
photo: None,
extra: BTreeMap::new(),
}
}
pub fn first_name(mut self, value: impl Into<String>) -> Self {
self.first_name = Some(value.into());
self
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn username(mut self, value: impl Into<String>) -> Self {
self.username = Some(value.into());
self
}
pub fn photo(mut self, value: Vec<PhotoSize>) -> Self {
self.photo = Some(value);
self
}
}
#[doc = "This object represents a shipping address."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ShippingAddress {
#[doc = "Two-letter ISO 3166-1 alpha-2 country code"]
pub country_code: String,
#[doc = "State, if applicable"]
pub state: String,
#[doc = "City"]
pub city: String,
#[doc = "First line for the address"]
pub street_line1: String,
#[doc = "Second line for the address"]
pub street_line2: String,
#[doc = "Address post code"]
pub post_code: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ShippingAddress {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.country_code, output);
CollectFiles::collect_files(&self.state, output);
CollectFiles::collect_files(&self.city, output);
CollectFiles::collect_files(&self.street_line1, output);
CollectFiles::collect_files(&self.street_line2, output);
CollectFiles::collect_files(&self.post_code, output);
}
}
impl ShippingAddress {
pub fn new(
country_code: impl Into<String>,
state: impl Into<String>,
city: impl Into<String>,
street_line1: impl Into<String>,
street_line2: impl Into<String>,
post_code: impl Into<String>,
) -> Self {
Self {
country_code: country_code.into(),
state: state.into(),
city: city.into(),
street_line1: street_line1.into(),
street_line2: street_line2.into(),
post_code: post_code.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents one shipping option."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ShippingOption {
#[doc = "Shipping option identifier"]
pub id: String,
#[doc = "Option title"]
pub title: String,
#[doc = "List of price portions"]
pub prices: Vec<LabeledPrice>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ShippingOption {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.prices, output);
}
}
impl ShippingOption {
pub fn new(id: impl Into<String>, title: impl Into<String>, prices: Vec<LabeledPrice>) -> Self {
Self {
id: id.into(),
title: title.into(),
prices,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about an incoming shipping query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ShippingQuery {
#[doc = "Unique query identifier"]
pub id: String,
#[doc = "User who sent the query"]
#[serde(rename = "from")]
pub from_user: User,
#[doc = "Bot-specified invoice payload"]
pub invoice_payload: String,
#[doc = "User specified shipping address"]
pub shipping_address: ShippingAddress,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for ShippingQuery {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.from_user, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.shipping_address, output);
}
}
impl ShippingQuery {
pub fn new(
id: impl Into<String>,
from_user: User,
invoice_payload: impl Into<String>,
shipping_address: ShippingAddress,
) -> Self {
Self {
id: id.into(),
from_user,
invoice_payload: invoice_payload.into(),
shipping_address,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes an amount of Telegram Stars."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StarAmount {
#[doc = "Integer amount of Telegram Stars, rounded to 0; can be negative"]
pub amount: i64,
#[doc = "The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nanostar_amount: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StarAmount {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.amount, output);
CollectFiles::collect_files(&self.nanostar_amount, output);
}
}
impl StarAmount {
pub fn new(amount: i64) -> Self {
Self {
amount,
nanostar_amount: None,
extra: BTreeMap::new(),
}
}
pub fn nanostar_amount(mut self, value: i64) -> Self {
self.nanostar_amount = Some(value);
self
}
}
#[doc = "Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StarTransaction {
#[doc = "Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users."]
pub id: String,
#[doc = "Integer amount of Telegram Stars transferred by the transaction"]
pub amount: i64,
#[doc = "Date the transaction was created in Unix time"]
pub date: i64,
#[doc = "The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nanostar_amount: Option<i64>,
#[doc = "Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source: Option<TransactionPartnerUnion>,
#[doc = "Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub receiver: Option<TransactionPartnerUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StarTransaction {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.amount, output);
CollectFiles::collect_files(&self.date, output);
CollectFiles::collect_files(&self.nanostar_amount, output);
CollectFiles::collect_files(&self.source, output);
CollectFiles::collect_files(&self.receiver, output);
}
}
impl StarTransaction {
pub fn new(id: impl Into<String>, amount: i64, date: i64) -> Self {
Self {
id: id.into(),
amount,
date,
nanostar_amount: None,
source: None,
receiver: None,
extra: BTreeMap::new(),
}
}
pub fn nanostar_amount(mut self, value: i64) -> Self {
self.nanostar_amount = Some(value);
self
}
pub fn source(mut self, value: impl Into<TransactionPartnerUnion>) -> Self {
self.source = Some(value.into());
self
}
pub fn receiver(mut self, value: impl Into<TransactionPartnerUnion>) -> Self {
self.receiver = Some(value.into());
self
}
}
#[doc = "Contains a list of Telegram Star transactions."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StarTransactions {
#[doc = "The list of transactions"]
pub transactions: Vec<StarTransaction>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StarTransactions {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.transactions, output);
}
}
impl StarTransactions {
pub fn new(transactions: Vec<StarTransaction>) -> Self {
Self {
transactions,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a sticker."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Sticker {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Type of the sticker, currently one of 'regular', 'mask', 'custom_emoji'. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video."]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Sticker width"]
pub width: i64,
#[doc = "Sticker height"]
pub height: i64,
#[doc = "True, if the sticker is animated"]
pub is_animated: bool,
#[doc = "True, if the sticker is a video sticker"]
pub is_video: bool,
#[doc = "Sticker thumbnail in the .WEBP or .JPG format"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "Emoji associated with the sticker"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emoji: Option<String>,
#[doc = "Name of the sticker set to which the sticker belongs"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub set_name: Option<String>,
#[doc = "For premium regular stickers, premium animation for the sticker"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub premium_animation: Option<File>,
#[doc = "For mask stickers, the position where the mask should be placed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mask_position: Option<MaskPosition>,
#[doc = "For custom emoji stickers, unique identifier of the custom emoji"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_emoji_id: Option<String>,
#[doc = "True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub needs_repainting: Option<bool>,
#[doc = "File size in bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Sticker {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.is_animated, output);
CollectFiles::collect_files(&self.is_video, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.emoji, output);
CollectFiles::collect_files(&self.set_name, output);
CollectFiles::collect_files(&self.premium_animation, output);
CollectFiles::collect_files(&self.mask_position, output);
CollectFiles::collect_files(&self.custom_emoji_id, output);
CollectFiles::collect_files(&self.needs_repainting, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl Sticker {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
kind: impl Into<String>,
width: i64,
height: i64,
is_animated: bool,
is_video: bool,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
kind: kind.into(),
width,
height,
is_animated,
is_video,
thumbnail: None,
emoji: None,
set_name: None,
premium_animation: None,
mask_position: None,
custom_emoji_id: None,
needs_repainting: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn emoji(mut self, value: impl Into<String>) -> Self {
self.emoji = Some(value.into());
self
}
pub fn set_name(mut self, value: impl Into<String>) -> Self {
self.set_name = Some(value.into());
self
}
pub fn premium_animation(mut self, value: File) -> Self {
self.premium_animation = Some(value);
self
}
pub fn mask_position(mut self, value: MaskPosition) -> Self {
self.mask_position = Some(value);
self
}
pub fn custom_emoji_id(mut self, value: impl Into<String>) -> Self {
self.custom_emoji_id = Some(value.into());
self
}
pub fn needs_repainting(mut self, value: bool) -> Self {
self.needs_repainting = Some(value);
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents a sticker set."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StickerSet {
#[doc = "Sticker set name"]
pub name: String,
#[doc = "Sticker set title"]
pub title: String,
#[doc = "Type of stickers in the set, currently one of 'regular', 'mask', 'custom_emoji'"]
pub sticker_type: String,
#[doc = "List of all set stickers"]
pub stickers: Vec<Sticker>,
#[doc = "Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "True, if the sticker set contains animated stickers"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_animated: Option<bool>,
#[doc = "True, if the sticker set contains video stickers"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_video: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StickerSet {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.sticker_type, output);
CollectFiles::collect_files(&self.stickers, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.is_animated, output);
CollectFiles::collect_files(&self.is_video, output);
}
}
impl StickerSet {
pub fn new(
name: impl Into<String>,
title: impl Into<String>,
sticker_type: impl Into<String>,
stickers: Vec<Sticker>,
) -> Self {
Self {
name: name.into(),
title: title.into(),
sticker_type: sticker_type.into(),
stickers,
thumbnail: None,
is_animated: None,
is_video: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn is_animated(mut self, value: bool) -> Self {
self.is_animated = Some(value);
self
}
pub fn is_video(mut self, value: bool) -> Self {
self.is_video = Some(value);
self
}
}
#[doc = "This object represents a story."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Story {
#[doc = "Chat that posted the story"]
pub chat: Box<Chat>,
#[doc = "Unique identifier for the story in the chat"]
pub id: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Story {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.id, output);
}
}
impl Story {
pub fn new(chat: Box<Chat>, id: i64) -> Self {
Self {
chat,
id,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a clickable area on a story media."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryArea {
#[doc = "Position of the area"]
pub position: StoryAreaPosition,
#[doc = "Type of the area"]
#[serde(rename = "type")]
pub kind: StoryAreaTypeUnion,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryArea {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.position, output);
CollectFiles::collect_files(&self.kind, output);
}
}
impl StoryArea {
pub fn new(position: StoryAreaPosition, kind: impl Into<StoryAreaTypeUnion>) -> Self {
Self {
position,
kind: kind.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes the position of a clickable area within a story."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaPosition {
#[doc = "The abscissa of the area's center, as a percentage of the media width"]
pub x_percentage: f64,
#[doc = "The ordinate of the area's center, as a percentage of the media height"]
pub y_percentage: f64,
#[doc = "The width of the area's rectangle, as a percentage of the media width"]
pub width_percentage: f64,
#[doc = "The height of the area's rectangle, as a percentage of the media height"]
pub height_percentage: f64,
#[doc = "The clockwise rotation angle of the rectangle, in degrees; 0-360"]
pub rotation_angle: f64,
#[doc = "The radius of the rectangle corner rounding, as a percentage of the media width"]
pub corner_radius_percentage: f64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaPosition {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.x_percentage, output);
CollectFiles::collect_files(&self.y_percentage, output);
CollectFiles::collect_files(&self.width_percentage, output);
CollectFiles::collect_files(&self.height_percentage, output);
CollectFiles::collect_files(&self.rotation_angle, output);
CollectFiles::collect_files(&self.corner_radius_percentage, output);
}
}
impl StoryAreaPosition {
pub fn new(
x_percentage: f64,
y_percentage: f64,
width_percentage: f64,
height_percentage: f64,
rotation_angle: f64,
corner_radius_percentage: f64,
) -> Self {
Self {
x_percentage,
y_percentage,
width_percentage,
height_percentage,
rotation_angle,
corner_radius_percentage,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes the type of a clickable area on a story. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaType {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaType {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl StoryAreaType {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for StoryAreaType {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaTypeLink {
#[doc = "Type of the area, always 'link'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "HTTP or tg:// URL to be opened when the area is clicked"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaTypeLink {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.url, output);
}
}
impl StoryAreaTypeLink {
pub fn new(url: impl Into<String>) -> Self {
Self {
kind: "link".to_owned(),
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a story area pointing to a location. Currently, a story can have up to 10 location areas."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaTypeLocation {
#[doc = "Type of the area, always 'location'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Location latitude in degrees"]
pub latitude: f64,
#[doc = "Location longitude in degrees"]
pub longitude: f64,
#[doc = "Address of the location"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub address: Option<LocationAddress>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaTypeLocation {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.latitude, output);
CollectFiles::collect_files(&self.longitude, output);
CollectFiles::collect_files(&self.address, output);
}
}
impl StoryAreaTypeLocation {
pub fn new(latitude: f64, longitude: f64) -> Self {
Self {
kind: "location".to_owned(),
latitude,
longitude,
address: None,
extra: BTreeMap::new(),
}
}
pub fn address(mut self, value: LocationAddress) -> Self {
self.address = Some(value);
self
}
}
#[doc = "Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaTypeSuggestedReaction {
#[doc = "Type of the area, always 'suggested_reaction'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Type of the reaction"]
pub reaction_type: ReactionTypeUnion,
#[doc = "Pass True if the reaction area has a dark background"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_dark: Option<bool>,
#[doc = "Pass True if reaction area corner is flipped"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_flipped: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaTypeSuggestedReaction {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.reaction_type, output);
CollectFiles::collect_files(&self.is_dark, output);
CollectFiles::collect_files(&self.is_flipped, output);
}
}
impl StoryAreaTypeSuggestedReaction {
pub fn new(reaction_type: impl Into<ReactionTypeUnion>) -> Self {
Self {
kind: "suggested_reaction".to_owned(),
reaction_type: reaction_type.into(),
is_dark: None,
is_flipped: None,
extra: BTreeMap::new(),
}
}
pub fn is_dark(mut self, value: bool) -> Self {
self.is_dark = Some(value);
self
}
pub fn is_flipped(mut self, value: bool) -> Self {
self.is_flipped = Some(value);
self
}
}
#[doc = "Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaTypeUniqueGift {
#[doc = "Type of the area, always 'unique_gift'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Unique name of the gift"]
pub name: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaTypeUniqueGift {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.name, output);
}
}
impl StoryAreaTypeUniqueGift {
pub fn new(name: impl Into<String>) -> Self {
Self {
kind: "unique_gift".to_owned(),
name: name.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a story area containing weather information. Currently, a story can have up to 3 weather areas."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct StoryAreaTypeWeather {
#[doc = "Type of the area, always 'weather'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Temperature, in degree Celsius"]
pub temperature: f64,
#[doc = "Emoji representing the weather"]
pub emoji: String,
#[doc = "A color of the area background in the ARGB format"]
pub background_color: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for StoryAreaTypeWeather {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.temperature, output);
CollectFiles::collect_files(&self.emoji, output);
CollectFiles::collect_files(&self.background_color, output);
}
}
impl StoryAreaTypeWeather {
pub fn new(temperature: f64, emoji: impl Into<String>, background_color: i64) -> Self {
Self {
kind: "weather".to_owned(),
temperature,
emoji: emoji.into(),
background_color,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuccessfulPayment {
#[doc = "Three-letter ISO 4217 currency code, or 'XTR' for payments in Telegram Stars"]
pub currency: String,
#[doc = "Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."]
pub total_amount: i64,
#[doc = "Bot-specified invoice payload"]
pub invoice_payload: String,
#[doc = "Telegram payment identifier"]
pub telegram_payment_charge_id: String,
#[doc = "Provider payment identifier"]
pub provider_payment_charge_id: String,
#[doc = "Expiration date of the subscription, in Unix time; for recurring payments only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_expiration_date: Option<i64>,
#[doc = "True, if the payment is a recurring payment for a subscription"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_recurring: Option<bool>,
#[doc = "True, if the payment is the first payment for a subscription"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_first_recurring: Option<bool>,
#[doc = "Identifier of the shipping option chosen by the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub shipping_option_id: Option<String>,
#[doc = "Order information provided by the user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub order_info: Option<OrderInfo>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuccessfulPayment {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.total_amount, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.telegram_payment_charge_id, output);
CollectFiles::collect_files(&self.provider_payment_charge_id, output);
CollectFiles::collect_files(&self.subscription_expiration_date, output);
CollectFiles::collect_files(&self.is_recurring, output);
CollectFiles::collect_files(&self.is_first_recurring, output);
CollectFiles::collect_files(&self.shipping_option_id, output);
CollectFiles::collect_files(&self.order_info, output);
}
}
impl SuccessfulPayment {
pub fn new(
currency: impl Into<String>,
total_amount: i64,
invoice_payload: impl Into<String>,
telegram_payment_charge_id: impl Into<String>,
provider_payment_charge_id: impl Into<String>,
) -> Self {
Self {
currency: currency.into(),
total_amount,
invoice_payload: invoice_payload.into(),
telegram_payment_charge_id: telegram_payment_charge_id.into(),
provider_payment_charge_id: provider_payment_charge_id.into(),
subscription_expiration_date: None,
is_recurring: None,
is_first_recurring: None,
shipping_option_id: None,
order_info: None,
extra: BTreeMap::new(),
}
}
pub fn subscription_expiration_date(mut self, value: i64) -> Self {
self.subscription_expiration_date = Some(value);
self
}
pub fn is_recurring(mut self, value: bool) -> Self {
self.is_recurring = Some(value);
self
}
pub fn is_first_recurring(mut self, value: bool) -> Self {
self.is_first_recurring = Some(value);
self
}
pub fn shipping_option_id(mut self, value: impl Into<String>) -> Self {
self.shipping_option_id = Some(value.into());
self
}
pub fn order_info(mut self, value: OrderInfo) -> Self {
self.order_info = Some(value);
self
}
}
#[doc = "Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostApprovalFailed {
#[doc = "Expected price of the post"]
pub price: SuggestedPostPrice,
#[doc = "Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostApprovalFailed {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.price, output);
CollectFiles::collect_files(&self.suggested_post_message, output);
}
}
impl SuggestedPostApprovalFailed {
pub fn new(price: SuggestedPostPrice) -> Self {
Self {
price,
suggested_post_message: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_post_message(mut self, value: Box<Message>) -> Self {
self.suggested_post_message = Some(value);
self
}
}
#[doc = "Describes a service message about the approval of a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostApproved {
#[doc = "Date when the post will be published"]
pub send_date: i64,
#[doc = "Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
#[doc = "Amount paid for the post"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostApproved {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.send_date, output);
CollectFiles::collect_files(&self.suggested_post_message, output);
CollectFiles::collect_files(&self.price, output);
}
}
impl SuggestedPostApproved {
pub fn new(send_date: i64) -> Self {
Self {
send_date,
suggested_post_message: None,
price: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_post_message(mut self, value: Box<Message>) -> Self {
self.suggested_post_message = Some(value);
self
}
pub fn price(mut self, value: SuggestedPostPrice) -> Self {
self.price = Some(value);
self
}
}
#[doc = "Describes a service message about the rejection of a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostDeclined {
#[doc = "Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
#[doc = "Comment with which the post was declined"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostDeclined {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.suggested_post_message, output);
CollectFiles::collect_files(&self.comment, output);
}
}
impl SuggestedPostDeclined {
pub fn new() -> Self {
Self {
suggested_post_message: None,
comment: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_post_message(mut self, value: Box<Message>) -> Self {
self.suggested_post_message = Some(value);
self
}
pub fn comment(mut self, value: impl Into<String>) -> Self {
self.comment = Some(value.into());
self
}
}
impl Default for SuggestedPostDeclined {
fn default() -> Self {
Self::new()
}
}
#[doc = "Contains information about a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostInfo {
#[doc = "State of the suggested post. Currently, it can be one of 'pending', 'approved', 'declined'."]
pub state: String,
#[doc = "Proposed price of the post. If the field is omitted, then the post is unpaid."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
#[doc = "Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.state, output);
CollectFiles::collect_files(&self.price, output);
CollectFiles::collect_files(&self.send_date, output);
}
}
impl SuggestedPostInfo {
pub fn new(state: impl Into<String>) -> Self {
Self {
state: state.into(),
price: None,
send_date: None,
extra: BTreeMap::new(),
}
}
pub fn price(mut self, value: SuggestedPostPrice) -> Self {
self.price = Some(value);
self
}
pub fn send_date(mut self, value: i64) -> Self {
self.send_date = Some(value);
self
}
}
#[doc = "Describes a service message about a successful payment for a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostPaid {
#[doc = "Currency in which the payment was made. Currently, one of 'XTR' for Telegram Stars or 'TON' for TON grams."]
pub currency: String,
#[doc = "Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
#[doc = "The amount of the currency that was received by the channel in nanograms; for payments in TON grams only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
#[doc = "The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub star_amount: Option<StarAmount>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostPaid {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.suggested_post_message, output);
CollectFiles::collect_files(&self.amount, output);
CollectFiles::collect_files(&self.star_amount, output);
}
}
impl SuggestedPostPaid {
pub fn new(currency: impl Into<String>) -> Self {
Self {
currency: currency.into(),
suggested_post_message: None,
amount: None,
star_amount: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_post_message(mut self, value: Box<Message>) -> Self {
self.suggested_post_message = Some(value);
self
}
pub fn amount(mut self, value: i64) -> Self {
self.amount = Some(value);
self
}
pub fn star_amount(mut self, value: StarAmount) -> Self {
self.star_amount = Some(value);
self
}
}
#[doc = "Contains parameters of a post that is being suggested by the bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostParameters {
#[doc = "Proposed price for the post. If the field is omitted, then the post is unpaid."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub price: Option<SuggestedPostPrice>,
#[doc = "Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub send_date: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostParameters {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.price, output);
CollectFiles::collect_files(&self.send_date, output);
}
}
impl SuggestedPostParameters {
pub fn new() -> Self {
Self {
price: None,
send_date: None,
extra: BTreeMap::new(),
}
}
pub fn price(mut self, value: SuggestedPostPrice) -> Self {
self.price = Some(value);
self
}
pub fn send_date(mut self, value: i64) -> Self {
self.send_date = Some(value);
self
}
}
impl Default for SuggestedPostParameters {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes the price of a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostPrice {
#[doc = "Currency in which the post will be paid. Currently, must be one of 'XTR' for Telegram Stars or 'TON' for TON grams."]
pub currency: String,
#[doc = "The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanograms. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanograms must be between 10000000 and 10000000000000."]
pub amount: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostPrice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.currency, output);
CollectFiles::collect_files(&self.amount, output);
}
}
impl SuggestedPostPrice {
pub fn new(currency: impl Into<String>, amount: i64) -> Self {
Self {
currency: currency.into(),
amount,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a payment refund for a suggested post."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SuggestedPostRefunded {
#[doc = "Reason for the refund. Currently, one of 'post_deleted' if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or 'payment_refunded' if the payer refunded their payment."]
pub reason: String,
#[doc = "Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub suggested_post_message: Option<Box<Message>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SuggestedPostRefunded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.reason, output);
CollectFiles::collect_files(&self.suggested_post_message, output);
}
}
impl SuggestedPostRefunded {
pub fn new(reason: impl Into<String>) -> Self {
Self {
reason: reason.into(),
suggested_post_message: None,
extra: BTreeMap::new(),
}
}
pub fn suggested_post_message(mut self, value: Box<Message>) -> Self {
self.suggested_post_message = Some(value);
self
}
}
#[doc = "This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct SwitchInlineQueryChosenChat {
#[doc = "The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub query: Option<String>,
#[doc = "True, if private chats with users can be chosen"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allow_user_chats: Option<bool>,
#[doc = "True, if private chats with bots can be chosen"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allow_bot_chats: Option<bool>,
#[doc = "True, if group and supergroup chats can be chosen"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allow_group_chats: Option<bool>,
#[doc = "True, if channel chats can be chosen"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allow_channel_chats: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for SwitchInlineQueryChosenChat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.query, output);
CollectFiles::collect_files(&self.allow_user_chats, output);
CollectFiles::collect_files(&self.allow_bot_chats, output);
CollectFiles::collect_files(&self.allow_group_chats, output);
CollectFiles::collect_files(&self.allow_channel_chats, output);
}
}
impl SwitchInlineQueryChosenChat {
pub fn new() -> Self {
Self {
query: None,
allow_user_chats: None,
allow_bot_chats: None,
allow_group_chats: None,
allow_channel_chats: None,
extra: BTreeMap::new(),
}
}
pub fn query(mut self, value: impl Into<String>) -> Self {
self.query = Some(value.into());
self
}
pub fn allow_user_chats(mut self, value: bool) -> Self {
self.allow_user_chats = Some(value);
self
}
pub fn allow_bot_chats(mut self, value: bool) -> Self {
self.allow_bot_chats = Some(value);
self
}
pub fn allow_group_chats(mut self, value: bool) -> Self {
self.allow_group_chats = Some(value);
self
}
pub fn allow_channel_chats(mut self, value: bool) -> Self {
self.allow_channel_chats = Some(value);
self
}
}
impl Default for SwitchInlineQueryChosenChat {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object contains information about the quoted part of a message that is replied to by the given message."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TextQuote {
#[doc = "Text of the quoted part of a message that is replied to by the given message"]
pub text: String,
#[doc = "Approximate quote position in the original message in UTF-16 code units as specified by the sender"]
pub position: i64,
#[doc = "Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are kept in quotes."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub entities: Option<Vec<MessageEntity>>,
#[doc = "True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_manual: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TextQuote {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.text, output);
CollectFiles::collect_files(&self.position, output);
CollectFiles::collect_files(&self.entities, output);
CollectFiles::collect_files(&self.is_manual, output);
}
}
impl TextQuote {
pub fn new(text: impl Into<String>, position: i64) -> Self {
Self {
text: text.into(),
position,
entities: None,
is_manual: None,
extra: BTreeMap::new(),
}
}
pub fn entities(mut self, value: Vec<MessageEntity>) -> Self {
self.entities = Some(value);
self
}
pub fn is_manual(mut self, value: bool) -> Self {
self.is_manual = Some(value);
self
}
}
#[doc = "This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of"]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartner {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartner {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl TransactionPartner {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for TransactionPartner {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes the affiliate program that issued the affiliate commission received via this transaction."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerAffiliateProgram {
#[doc = "Type of the transaction partner, always 'affiliate_program'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users"]
pub commission_per_mille: i64,
#[doc = "Information about the bot that sponsored the affiliate program"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sponsor_user: Option<User>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerAffiliateProgram {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.commission_per_mille, output);
CollectFiles::collect_files(&self.sponsor_user, output);
}
}
impl TransactionPartnerAffiliateProgram {
pub fn new(kind: impl Into<String>, commission_per_mille: i64) -> Self {
Self {
kind: kind.into(),
commission_per_mille,
sponsor_user: None,
extra: BTreeMap::new(),
}
}
pub fn sponsor_user(mut self, value: User) -> Self {
self.sponsor_user = Some(value);
self
}
}
#[doc = "Describes a transaction with a chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerChat {
#[doc = "Type of the transaction partner, always 'chat'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Information about the chat"]
pub chat: Box<Chat>,
#[doc = "The gift sent to the chat by the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gift: Option<Gift>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerChat {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.chat, output);
CollectFiles::collect_files(&self.gift, output);
}
}
impl TransactionPartnerChat {
pub fn new(chat: Box<Chat>) -> Self {
Self {
kind: "chat".to_owned(),
chat,
gift: None,
extra: BTreeMap::new(),
}
}
pub fn gift(mut self, value: Gift) -> Self {
self.gift = Some(value);
self
}
}
#[doc = "Describes a withdrawal transaction with Fragment."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerFragment {
#[doc = "Type of the transaction partner, always 'fragment'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "State of the transaction if the transaction is outgoing"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub withdrawal_state: Option<RevenueWithdrawalStateUnion>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerFragment {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.withdrawal_state, output);
}
}
impl TransactionPartnerFragment {
pub fn new() -> Self {
Self {
kind: "fragment".to_owned(),
withdrawal_state: None,
extra: BTreeMap::new(),
}
}
pub fn withdrawal_state(mut self, value: impl Into<RevenueWithdrawalStateUnion>) -> Self {
self.withdrawal_state = Some(value.into());
self
}
}
impl Default for TransactionPartnerFragment {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a transaction with an unknown source or recipient."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerOther {
#[doc = "Type of the transaction partner, always 'other'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerOther {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl TransactionPartnerOther {
pub fn new() -> Self {
Self {
kind: "other".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for TransactionPartnerOther {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a withdrawal transaction to the Telegram Ads platform."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerTelegramAds {
#[doc = "Type of the transaction partner, always 'telegram_ads'"]
#[serde(rename = "type")]
pub kind: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerTelegramAds {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
}
}
impl TransactionPartnerTelegramAds {
pub fn new() -> Self {
Self {
kind: "telegram_ads".to_owned(),
extra: BTreeMap::new(),
}
}
}
impl Default for TransactionPartnerTelegramAds {
fn default() -> Self {
Self::new()
}
}
#[doc = "Describes a transaction with payment for paid broadcasting."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerTelegramApi {
#[doc = "Type of the transaction partner, always 'telegram_api'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "The number of successful requests that exceeded regular limits and were therefore billed"]
pub request_count: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerTelegramApi {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.request_count, output);
}
}
impl TransactionPartnerTelegramApi {
pub fn new(request_count: i64) -> Self {
Self {
kind: "telegram_api".to_owned(),
request_count,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a transaction with a user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TransactionPartnerUser {
#[doc = "Type of the transaction partner, always 'user'"]
#[serde(rename = "type")]
pub kind: String,
#[doc = "Type of the transaction, currently one of 'invoice_payment' for payments via invoices, 'paid_media_payment' for payments for paid media, 'gift_purchase' for gifts sent by the bot, 'premium_purchase' for Telegram Premium subscriptions gifted by the bot, 'business_account_transfer' for direct transfers from managed business accounts"]
pub transaction_type: String,
#[doc = "Information about the user"]
pub user: User,
#[doc = "Information about the affiliate that received a commission via this transaction. Can be available only for 'invoice_payment' and 'paid_media_payment' transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub affiliate: Option<AffiliateInfo>,
#[doc = "Bot-specified invoice payload. Can be available only for 'invoice_payment' transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub invoice_payload: Option<String>,
#[doc = "The duration of the paid subscription. Can be available only for 'invoice_payment' transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription_period: Option<i64>,
#[doc = "Information about the paid media bought by the user; for 'paid_media_payment' transactions only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_media: Option<Vec<PaidMediaUnion>>,
#[doc = "Bot-specified paid media payload. Can be available only for 'paid_media_payment' transactions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub paid_media_payload: Option<String>,
#[doc = "The gift sent to the user by the bot; for 'gift_purchase' transactions only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gift: Option<Gift>,
#[doc = "Number of months the gifted Telegram Premium subscription will be active for; for 'premium_purchase' transactions only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub premium_subscription_duration: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for TransactionPartnerUser {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.kind, output);
CollectFiles::collect_files(&self.transaction_type, output);
CollectFiles::collect_files(&self.user, output);
CollectFiles::collect_files(&self.affiliate, output);
CollectFiles::collect_files(&self.invoice_payload, output);
CollectFiles::collect_files(&self.subscription_period, output);
CollectFiles::collect_files(&self.paid_media, output);
CollectFiles::collect_files(&self.paid_media_payload, output);
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.premium_subscription_duration, output);
}
}
impl TransactionPartnerUser {
pub fn new(transaction_type: impl Into<String>, user: User) -> Self {
Self {
kind: "user".to_owned(),
transaction_type: transaction_type.into(),
user,
affiliate: None,
invoice_payload: None,
subscription_period: None,
paid_media: None,
paid_media_payload: None,
gift: None,
premium_subscription_duration: None,
extra: BTreeMap::new(),
}
}
pub fn affiliate(mut self, value: AffiliateInfo) -> Self {
self.affiliate = Some(value);
self
}
pub fn invoice_payload(mut self, value: impl Into<String>) -> Self {
self.invoice_payload = Some(value.into());
self
}
pub fn subscription_period(mut self, value: i64) -> Self {
self.subscription_period = Some(value);
self
}
pub fn paid_media(mut self, value: Vec<PaidMediaUnion>) -> Self {
self.paid_media = Some(value);
self
}
pub fn paid_media_payload(mut self, value: impl Into<String>) -> Self {
self.paid_media_payload = Some(value.into());
self
}
pub fn gift(mut self, value: Gift) -> Self {
self.gift = Some(value);
self
}
pub fn premium_subscription_duration(mut self, value: i64) -> Self {
self.premium_subscription_duration = Some(value);
self
}
}
#[doc = "This object describes a unique gift that was upgraded from a regular gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGift {
#[doc = "Identifier of the regular gift from which the gift was upgraded"]
pub gift_id: String,
#[doc = "Human-readable name of the regular gift from which this unique gift was upgraded"]
pub base_name: String,
#[doc = "Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas."]
pub name: String,
#[doc = "Unique number of the upgraded gift among gifts upgraded from the same regular gift"]
pub number: i64,
#[doc = "Model of the gift"]
pub model: UniqueGiftModel,
#[doc = "Symbol of the gift"]
pub symbol: UniqueGiftSymbol,
#[doc = "Backdrop of the gift"]
pub backdrop: UniqueGiftBackdrop,
#[doc = "True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_premium: Option<bool>,
#[doc = "True, if the gift was used to craft another gift and isn't available anymore"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_burned: Option<bool>,
#[doc = "True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_from_blockchain: Option<bool>,
#[doc = "The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub colors: Option<UniqueGiftColors>,
#[doc = "Information about the chat that published the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub publisher_chat: Option<Box<Chat>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGift {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.gift_id, output);
CollectFiles::collect_files(&self.base_name, output);
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.number, output);
CollectFiles::collect_files(&self.model, output);
CollectFiles::collect_files(&self.symbol, output);
CollectFiles::collect_files(&self.backdrop, output);
CollectFiles::collect_files(&self.is_premium, output);
CollectFiles::collect_files(&self.is_burned, output);
CollectFiles::collect_files(&self.is_from_blockchain, output);
CollectFiles::collect_files(&self.colors, output);
CollectFiles::collect_files(&self.publisher_chat, output);
}
}
impl UniqueGift {
pub fn new(
gift_id: impl Into<String>,
base_name: impl Into<String>,
name: impl Into<String>,
number: i64,
model: UniqueGiftModel,
symbol: UniqueGiftSymbol,
backdrop: UniqueGiftBackdrop,
) -> Self {
Self {
gift_id: gift_id.into(),
base_name: base_name.into(),
name: name.into(),
number,
model,
symbol,
backdrop,
is_premium: None,
is_burned: None,
is_from_blockchain: None,
colors: None,
publisher_chat: None,
extra: BTreeMap::new(),
}
}
pub fn is_premium(mut self, value: bool) -> Self {
self.is_premium = Some(value);
self
}
pub fn is_burned(mut self, value: bool) -> Self {
self.is_burned = Some(value);
self
}
pub fn is_from_blockchain(mut self, value: bool) -> Self {
self.is_from_blockchain = Some(value);
self
}
pub fn colors(mut self, value: UniqueGiftColors) -> Self {
self.colors = Some(value);
self
}
pub fn publisher_chat(mut self, value: Box<Chat>) -> Self {
self.publisher_chat = Some(value);
self
}
}
#[doc = "This object describes the backdrop of a unique gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftBackdrop {
#[doc = "Name of the backdrop"]
pub name: String,
#[doc = "Colors of the backdrop"]
pub colors: UniqueGiftBackdropColors,
#[doc = "The number of unique gifts that receive this backdrop for every 1000 gifts upgraded"]
pub rarity_per_mille: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftBackdrop {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.colors, output);
CollectFiles::collect_files(&self.rarity_per_mille, output);
}
}
impl UniqueGiftBackdrop {
pub fn new(
name: impl Into<String>,
colors: UniqueGiftBackdropColors,
rarity_per_mille: i64,
) -> Self {
Self {
name: name.into(),
colors,
rarity_per_mille,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the colors of the backdrop of a unique gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftBackdropColors {
#[doc = "The color in the center of the backdrop in RGB format"]
pub center_color: i64,
#[doc = "The color on the edges of the backdrop in RGB format"]
pub edge_color: i64,
#[doc = "The color to be applied to the symbol in RGB format"]
pub symbol_color: i64,
#[doc = "The color for the text on the backdrop in RGB format"]
pub text_color: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftBackdropColors {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.center_color, output);
CollectFiles::collect_files(&self.edge_color, output);
CollectFiles::collect_files(&self.symbol_color, output);
CollectFiles::collect_files(&self.text_color, output);
}
}
impl UniqueGiftBackdropColors {
pub fn new(center_color: i64, edge_color: i64, symbol_color: i64, text_color: i64) -> Self {
Self {
center_color,
edge_color,
symbol_color,
text_color,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftColors {
#[doc = "Custom emoji identifier of the unique gift's model"]
pub model_custom_emoji_id: String,
#[doc = "Custom emoji identifier of the unique gift's symbol"]
pub symbol_custom_emoji_id: String,
#[doc = "Main color used in light themes; RGB format"]
pub light_theme_main_color: i64,
#[doc = "List of 1-3 additional colors used in light themes; RGB format"]
pub light_theme_other_colors: Vec<i64>,
#[doc = "Main color used in dark themes; RGB format"]
pub dark_theme_main_color: i64,
#[doc = "List of 1-3 additional colors used in dark themes; RGB format"]
pub dark_theme_other_colors: Vec<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftColors {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.model_custom_emoji_id, output);
CollectFiles::collect_files(&self.symbol_custom_emoji_id, output);
CollectFiles::collect_files(&self.light_theme_main_color, output);
CollectFiles::collect_files(&self.light_theme_other_colors, output);
CollectFiles::collect_files(&self.dark_theme_main_color, output);
CollectFiles::collect_files(&self.dark_theme_other_colors, output);
}
}
impl UniqueGiftColors {
pub fn new(
model_custom_emoji_id: impl Into<String>,
symbol_custom_emoji_id: impl Into<String>,
light_theme_main_color: i64,
light_theme_other_colors: Vec<i64>,
dark_theme_main_color: i64,
dark_theme_other_colors: Vec<i64>,
) -> Self {
Self {
model_custom_emoji_id: model_custom_emoji_id.into(),
symbol_custom_emoji_id: symbol_custom_emoji_id.into(),
light_theme_main_color,
light_theme_other_colors,
dark_theme_main_color,
dark_theme_other_colors,
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a service message about a unique gift that was sent or received."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftInfo {
#[doc = "Information about the gift"]
pub gift: UniqueGift,
#[doc = "Origin of the gift. Currently, either 'upgrade' for gifts upgraded from regular gifts, 'transfer' for gifts transferred from other users or channels, 'resale' for gifts bought from other users, 'gifted_upgrade' for upgrades purchased after the gift was sent, or 'offer' for gifts bought or sold through gift purchase offers."]
pub origin: String,
#[doc = "For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of 'XTR' for Telegram Stars or 'TON' for TON grams."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_resale_currency: Option<String>,
#[doc = "For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanograms"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_resale_amount: Option<i64>,
#[doc = "Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub owned_gift_id: Option<String>,
#[doc = "Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transfer_star_count: Option<i64>,
#[doc = "Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_transfer_date: Option<i64>,
#[doc = "For gifts bought from other users, the price paid for the gift"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_resale_star_count: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.gift, output);
CollectFiles::collect_files(&self.origin, output);
CollectFiles::collect_files(&self.last_resale_currency, output);
CollectFiles::collect_files(&self.last_resale_amount, output);
CollectFiles::collect_files(&self.owned_gift_id, output);
CollectFiles::collect_files(&self.transfer_star_count, output);
CollectFiles::collect_files(&self.next_transfer_date, output);
CollectFiles::collect_files(&self.last_resale_star_count, output);
}
}
impl UniqueGiftInfo {
pub fn new(gift: UniqueGift, origin: impl Into<String>) -> Self {
Self {
gift,
origin: origin.into(),
last_resale_currency: None,
last_resale_amount: None,
owned_gift_id: None,
transfer_star_count: None,
next_transfer_date: None,
last_resale_star_count: None,
extra: BTreeMap::new(),
}
}
pub fn last_resale_currency(mut self, value: impl Into<String>) -> Self {
self.last_resale_currency = Some(value.into());
self
}
pub fn last_resale_amount(mut self, value: i64) -> Self {
self.last_resale_amount = Some(value);
self
}
pub fn owned_gift_id(mut self, value: impl Into<String>) -> Self {
self.owned_gift_id = Some(value.into());
self
}
pub fn transfer_star_count(mut self, value: i64) -> Self {
self.transfer_star_count = Some(value);
self
}
pub fn next_transfer_date(mut self, value: i64) -> Self {
self.next_transfer_date = Some(value);
self
}
pub fn last_resale_star_count(mut self, value: i64) -> Self {
self.last_resale_star_count = Some(value);
self
}
}
#[doc = "This object describes the model of a unique gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftModel {
#[doc = "Name of the model"]
pub name: String,
#[doc = "The sticker that represents the unique gift"]
pub sticker: Sticker,
#[doc = "The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts."]
pub rarity_per_mille: i64,
#[doc = "Rarity of the model if it is a crafted model. Currently, can be 'uncommon', 'rare', 'epic', or 'legendary'."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rarity: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftModel {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.rarity_per_mille, output);
CollectFiles::collect_files(&self.rarity, output);
}
}
impl UniqueGiftModel {
pub fn new(name: impl Into<String>, sticker: Sticker, rarity_per_mille: i64) -> Self {
Self {
name: name.into(),
sticker,
rarity_per_mille,
rarity: None,
extra: BTreeMap::new(),
}
}
pub fn rarity(mut self, value: impl Into<String>) -> Self {
self.rarity = Some(value.into());
self
}
}
#[doc = "This object describes the symbol shown on the pattern of a unique gift."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UniqueGiftSymbol {
#[doc = "Name of the symbol"]
pub name: String,
#[doc = "The sticker that represents the unique gift"]
pub sticker: Sticker,
#[doc = "The number of unique gifts that receive this model for every 1000 gifts upgraded"]
pub rarity_per_mille: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UniqueGiftSymbol {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.name, output);
CollectFiles::collect_files(&self.sticker, output);
CollectFiles::collect_files(&self.rarity_per_mille, output);
}
}
impl UniqueGiftSymbol {
pub fn new(name: impl Into<String>, sticker: Sticker, rarity_per_mille: i64) -> Self {
Self {
name: name.into(),
sticker,
rarity_per_mille,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents an incoming update."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Update {
#[doc = "The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially."]
pub update_id: i64,
#[doc = "New incoming message of any kind - text, photo, sticker, etc."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<Box<Message>>,
#[doc = "New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edited_message: Option<Box<Message>>,
#[doc = "New incoming channel post of any kind - text, photo, sticker, etc."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub channel_post: Option<Box<Message>>,
#[doc = "New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edited_channel_post: Option<Box<Message>>,
#[doc = "The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_connection: Option<BusinessConnection>,
#[doc = "New message from a connected business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub business_message: Option<Box<Message>>,
#[doc = "New version of a message from a connected business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edited_business_message: Option<Box<Message>>,
#[doc = "Messages were deleted from a connected business account"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub deleted_business_messages: Option<BusinessMessagesDeleted>,
#[doc = "New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub guest_message: Option<Box<Message>>,
#[doc = "A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify \"message_reaction\" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_reaction: Option<MessageReactionUpdated>,
#[doc = "Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify \"message_reaction_count\" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_reaction_count: Option<MessageReactionCountUpdated>,
#[doc = "New incoming inline query"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub inline_query: Option<InlineQuery>,
#[doc = "The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chosen_inline_result: Option<ChosenInlineResult>,
#[doc = "New incoming callback query"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub callback_query: Option<CallbackQuery>,
#[doc = "New incoming shipping query. Only for invoices with flexible price."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub shipping_query: Option<ShippingQuery>,
#[doc = "New incoming pre-checkout query. Contains full information about checkout."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pre_checkout_query: Option<PreCheckoutQuery>,
#[doc = "A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub purchased_paid_media: Option<PaidMediaPurchased>,
#[doc = "New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll: Option<Poll>,
#[doc = "A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub poll_answer: Option<PollAnswer>,
#[doc = "The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub my_chat_member: Option<ChatMemberUpdated>,
#[doc = "A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify \"chat_member\" in the list of allowed_updates to receive these updates."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_member: Option<ChatMemberUpdated>,
#[doc = "A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_join_request: Option<ChatJoinRequest>,
#[doc = "A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub chat_boost: Option<ChatBoostUpdated>,
#[doc = "A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub removed_chat_boost: Option<ChatBoostRemoved>,
#[doc = "A new bot was created to be managed by the bot, or token or owner of a managed bot was changed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub managed_bot: Option<ManagedBotUpdated>,
#[doc = "User payment subscription has changed"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subscription: Option<BotSubscriptionUpdated>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Update {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.update_id, output);
CollectFiles::collect_files(&self.message, output);
CollectFiles::collect_files(&self.edited_message, output);
CollectFiles::collect_files(&self.channel_post, output);
CollectFiles::collect_files(&self.edited_channel_post, output);
CollectFiles::collect_files(&self.business_connection, output);
CollectFiles::collect_files(&self.business_message, output);
CollectFiles::collect_files(&self.edited_business_message, output);
CollectFiles::collect_files(&self.deleted_business_messages, output);
CollectFiles::collect_files(&self.guest_message, output);
CollectFiles::collect_files(&self.message_reaction, output);
CollectFiles::collect_files(&self.message_reaction_count, output);
CollectFiles::collect_files(&self.inline_query, output);
CollectFiles::collect_files(&self.chosen_inline_result, output);
CollectFiles::collect_files(&self.callback_query, output);
CollectFiles::collect_files(&self.shipping_query, output);
CollectFiles::collect_files(&self.pre_checkout_query, output);
CollectFiles::collect_files(&self.purchased_paid_media, output);
CollectFiles::collect_files(&self.poll, output);
CollectFiles::collect_files(&self.poll_answer, output);
CollectFiles::collect_files(&self.my_chat_member, output);
CollectFiles::collect_files(&self.chat_member, output);
CollectFiles::collect_files(&self.chat_join_request, output);
CollectFiles::collect_files(&self.chat_boost, output);
CollectFiles::collect_files(&self.removed_chat_boost, output);
CollectFiles::collect_files(&self.managed_bot, output);
CollectFiles::collect_files(&self.subscription, output);
}
}
impl Update {
pub fn new(update_id: i64) -> Self {
Self {
update_id,
message: None,
edited_message: None,
channel_post: None,
edited_channel_post: None,
business_connection: None,
business_message: None,
edited_business_message: None,
deleted_business_messages: None,
guest_message: None,
message_reaction: None,
message_reaction_count: None,
inline_query: None,
chosen_inline_result: None,
callback_query: None,
shipping_query: None,
pre_checkout_query: None,
purchased_paid_media: None,
poll: None,
poll_answer: None,
my_chat_member: None,
chat_member: None,
chat_join_request: None,
chat_boost: None,
removed_chat_boost: None,
managed_bot: None,
subscription: None,
extra: BTreeMap::new(),
}
}
pub fn message(mut self, value: Box<Message>) -> Self {
self.message = Some(value);
self
}
pub fn edited_message(mut self, value: Box<Message>) -> Self {
self.edited_message = Some(value);
self
}
pub fn channel_post(mut self, value: Box<Message>) -> Self {
self.channel_post = Some(value);
self
}
pub fn edited_channel_post(mut self, value: Box<Message>) -> Self {
self.edited_channel_post = Some(value);
self
}
pub fn business_connection(mut self, value: BusinessConnection) -> Self {
self.business_connection = Some(value);
self
}
pub fn business_message(mut self, value: Box<Message>) -> Self {
self.business_message = Some(value);
self
}
pub fn edited_business_message(mut self, value: Box<Message>) -> Self {
self.edited_business_message = Some(value);
self
}
pub fn deleted_business_messages(mut self, value: BusinessMessagesDeleted) -> Self {
self.deleted_business_messages = Some(value);
self
}
pub fn guest_message(mut self, value: Box<Message>) -> Self {
self.guest_message = Some(value);
self
}
pub fn message_reaction(mut self, value: MessageReactionUpdated) -> Self {
self.message_reaction = Some(value);
self
}
pub fn message_reaction_count(mut self, value: MessageReactionCountUpdated) -> Self {
self.message_reaction_count = Some(value);
self
}
pub fn inline_query(mut self, value: InlineQuery) -> Self {
self.inline_query = Some(value);
self
}
pub fn chosen_inline_result(mut self, value: ChosenInlineResult) -> Self {
self.chosen_inline_result = Some(value);
self
}
pub fn callback_query(mut self, value: CallbackQuery) -> Self {
self.callback_query = Some(value);
self
}
pub fn shipping_query(mut self, value: ShippingQuery) -> Self {
self.shipping_query = Some(value);
self
}
pub fn pre_checkout_query(mut self, value: PreCheckoutQuery) -> Self {
self.pre_checkout_query = Some(value);
self
}
pub fn purchased_paid_media(mut self, value: PaidMediaPurchased) -> Self {
self.purchased_paid_media = Some(value);
self
}
pub fn poll(mut self, value: Poll) -> Self {
self.poll = Some(value);
self
}
pub fn poll_answer(mut self, value: PollAnswer) -> Self {
self.poll_answer = Some(value);
self
}
pub fn my_chat_member(mut self, value: ChatMemberUpdated) -> Self {
self.my_chat_member = Some(value);
self
}
pub fn chat_member(mut self, value: ChatMemberUpdated) -> Self {
self.chat_member = Some(value);
self
}
pub fn chat_join_request(mut self, value: ChatJoinRequest) -> Self {
self.chat_join_request = Some(value);
self
}
pub fn chat_boost(mut self, value: ChatBoostUpdated) -> Self {
self.chat_boost = Some(value);
self
}
pub fn removed_chat_boost(mut self, value: ChatBoostRemoved) -> Self {
self.removed_chat_boost = Some(value);
self
}
pub fn managed_bot(mut self, value: ManagedBotUpdated) -> Self {
self.managed_bot = Some(value);
self
}
pub fn subscription(mut self, value: BotSubscriptionUpdated) -> Self {
self.subscription = Some(value);
self
}
}
#[doc = "This object represents a Telegram user or bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct User {
#[doc = "Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier."]
pub id: i64,
#[doc = "True, if this user is a bot"]
pub is_bot: bool,
#[doc = "User's or bot's first name"]
pub first_name: String,
#[doc = "User's or bot's last name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[doc = "User's or bot's username"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[doc = "IETF language tag of the user's language"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
#[doc = "True, if this user is a Telegram Premium user"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub is_premium: Option<bool>,
#[doc = "True, if this user added the bot to the attachment menu"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub added_to_attachment_menu: Option<bool>,
#[doc = "True, if the bot can be invited to groups. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_join_groups: Option<bool>,
#[doc = "True, if privacy mode is disabled for the bot. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_read_all_group_messages: Option<bool>,
#[doc = "True, if the bot supports guest queries from chats it is not a member of. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_guest_queries: Option<bool>,
#[doc = "True, if the bot supports inline queries. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_inline_queries: Option<bool>,
#[doc = "True, if the bot can be connected to a user account to manage it. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_connect_to_business: Option<bool>,
#[doc = "True, if the bot has a main Web App. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_main_web_app: Option<bool>,
#[doc = "True, if the bot has forum topic mode enabled in private chats. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub has_topics_enabled: Option<bool>,
#[doc = "True, if the bot allows users to create and delete topics in private chats. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allows_users_to_create_topics: Option<bool>,
#[doc = "True, if other bots can be created to be controlled by the bot. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub can_manage_bots: Option<bool>,
#[doc = "True, if the bot supports join request queries and can be assigned to process them. Returned only in getMe."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub supports_join_request_queries: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for User {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.id, output);
CollectFiles::collect_files(&self.is_bot, output);
CollectFiles::collect_files(&self.first_name, output);
CollectFiles::collect_files(&self.last_name, output);
CollectFiles::collect_files(&self.username, output);
CollectFiles::collect_files(&self.language_code, output);
CollectFiles::collect_files(&self.is_premium, output);
CollectFiles::collect_files(&self.added_to_attachment_menu, output);
CollectFiles::collect_files(&self.can_join_groups, output);
CollectFiles::collect_files(&self.can_read_all_group_messages, output);
CollectFiles::collect_files(&self.supports_guest_queries, output);
CollectFiles::collect_files(&self.supports_inline_queries, output);
CollectFiles::collect_files(&self.can_connect_to_business, output);
CollectFiles::collect_files(&self.has_main_web_app, output);
CollectFiles::collect_files(&self.has_topics_enabled, output);
CollectFiles::collect_files(&self.allows_users_to_create_topics, output);
CollectFiles::collect_files(&self.can_manage_bots, output);
CollectFiles::collect_files(&self.supports_join_request_queries, output);
}
}
impl User {
pub fn new(id: i64, is_bot: bool, first_name: impl Into<String>) -> Self {
Self {
id,
is_bot,
first_name: first_name.into(),
last_name: None,
username: None,
language_code: None,
is_premium: None,
added_to_attachment_menu: None,
can_join_groups: None,
can_read_all_group_messages: None,
supports_guest_queries: None,
supports_inline_queries: None,
can_connect_to_business: None,
has_main_web_app: None,
has_topics_enabled: None,
allows_users_to_create_topics: None,
can_manage_bots: None,
supports_join_request_queries: None,
extra: BTreeMap::new(),
}
}
pub fn last_name(mut self, value: impl Into<String>) -> Self {
self.last_name = Some(value.into());
self
}
pub fn username(mut self, value: impl Into<String>) -> Self {
self.username = Some(value.into());
self
}
pub fn language_code(mut self, value: impl Into<String>) -> Self {
self.language_code = Some(value.into());
self
}
pub fn is_premium(mut self, value: bool) -> Self {
self.is_premium = Some(value);
self
}
pub fn added_to_attachment_menu(mut self, value: bool) -> Self {
self.added_to_attachment_menu = Some(value);
self
}
pub fn can_join_groups(mut self, value: bool) -> Self {
self.can_join_groups = Some(value);
self
}
pub fn can_read_all_group_messages(mut self, value: bool) -> Self {
self.can_read_all_group_messages = Some(value);
self
}
pub fn supports_guest_queries(mut self, value: bool) -> Self {
self.supports_guest_queries = Some(value);
self
}
pub fn supports_inline_queries(mut self, value: bool) -> Self {
self.supports_inline_queries = Some(value);
self
}
pub fn can_connect_to_business(mut self, value: bool) -> Self {
self.can_connect_to_business = Some(value);
self
}
pub fn has_main_web_app(mut self, value: bool) -> Self {
self.has_main_web_app = Some(value);
self
}
pub fn has_topics_enabled(mut self, value: bool) -> Self {
self.has_topics_enabled = Some(value);
self
}
pub fn allows_users_to_create_topics(mut self, value: bool) -> Self {
self.allows_users_to_create_topics = Some(value);
self
}
pub fn can_manage_bots(mut self, value: bool) -> Self {
self.can_manage_bots = Some(value);
self
}
pub fn supports_join_request_queries(mut self, value: bool) -> Self {
self.supports_join_request_queries = Some(value);
self
}
}
#[doc = "This object represents a list of boosts added to a chat by a user."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UserChatBoosts {
#[doc = "The list of boosts added to the chat by the user"]
pub boosts: Vec<ChatBoost>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UserChatBoosts {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.boosts, output);
}
}
impl UserChatBoosts {
pub fn new(boosts: Vec<ChatBoost>) -> Self {
Self {
boosts,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents the audios displayed on a user's profile."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UserProfileAudios {
#[doc = "Total number of profile audios for the target user"]
pub total_count: i64,
#[doc = "Requested profile audios"]
pub audios: Vec<Audio>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UserProfileAudios {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.total_count, output);
CollectFiles::collect_files(&self.audios, output);
}
}
impl UserProfileAudios {
pub fn new(total_count: i64, audios: Vec<Audio>) -> Self {
Self {
total_count,
audios,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represent a user's profile pictures."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UserProfilePhotos {
#[doc = "Total number of profile pictures the target user has"]
pub total_count: i64,
#[doc = "Requested profile pictures (in up to 4 sizes each)"]
pub photos: Vec<Vec<PhotoSize>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UserProfilePhotos {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.total_count, output);
CollectFiles::collect_files(&self.photos, output);
}
}
impl UserProfilePhotos {
pub fn new(total_count: i64, photos: Vec<Vec<PhotoSize>>) -> Self {
Self {
total_count,
photos,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object describes the rating of a user based on their Telegram Star spendings."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UserRating {
#[doc = "Current level of the user, indicating their reliability when purchasing digital goods and services. A higher level suggests a more trustworthy customer; a negative level is likely reason for concern."]
pub level: i64,
#[doc = "Numerical value of the user's rating; the higher the rating, the better"]
pub rating: i64,
#[doc = "The rating value required to get the current level"]
pub current_level_rating: i64,
#[doc = "The rating value required to get to the next level; omitted if the maximum level was reached"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub next_level_rating: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UserRating {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.level, output);
CollectFiles::collect_files(&self.rating, output);
CollectFiles::collect_files(&self.current_level_rating, output);
CollectFiles::collect_files(&self.next_level_rating, output);
}
}
impl UserRating {
pub fn new(level: i64, rating: i64, current_level_rating: i64) -> Self {
Self {
level,
rating,
current_level_rating,
next_level_rating: None,
extra: BTreeMap::new(),
}
}
pub fn next_level_rating(mut self, value: i64) -> Self {
self.next_level_rating = Some(value);
self
}
}
#[doc = "This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UserShared {
#[doc = "Identifier of the request"]
pub request_id: i64,
#[doc = "Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means."]
pub user_id: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UserShared {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.user_id, output);
}
}
impl UserShared {
pub fn new(request_id: i64, user_id: i64) -> Self {
Self {
request_id,
user_id,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct UsersShared {
#[doc = "Identifier of the request"]
pub request_id: i64,
#[doc = "Information about users shared with the bot"]
pub users: Vec<SharedUser>,
#[doc = "Identifiers of the shared users. These numbers may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting them. But they have at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user_ids: Option<Vec<i64>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for UsersShared {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.request_id, output);
CollectFiles::collect_files(&self.users, output);
CollectFiles::collect_files(&self.user_ids, output);
}
}
impl UsersShared {
pub fn new(request_id: i64, users: Vec<SharedUser>) -> Self {
Self {
request_id,
users,
user_ids: None,
extra: BTreeMap::new(),
}
}
pub fn user_ids(mut self, value: Vec<i64>) -> Self {
self.user_ids = Some(value);
self
}
}
#[doc = "This object represents a venue."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Venue {
#[doc = "Venue location. Can't be a live location."]
pub location: Location,
#[doc = "Name of the venue"]
pub title: String,
#[doc = "Address of the venue"]
pub address: String,
#[doc = "Foursquare identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_id: Option<String>,
#[doc = "Foursquare type of the venue. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub foursquare_type: Option<String>,
#[doc = "Google Places identifier of the venue"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_id: Option<String>,
#[doc = "Google Places type of the venue. (See supported types.)"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub google_place_type: Option<String>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Venue {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.location, output);
CollectFiles::collect_files(&self.title, output);
CollectFiles::collect_files(&self.address, output);
CollectFiles::collect_files(&self.foursquare_id, output);
CollectFiles::collect_files(&self.foursquare_type, output);
CollectFiles::collect_files(&self.google_place_id, output);
CollectFiles::collect_files(&self.google_place_type, output);
}
}
impl Venue {
pub fn new(location: Location, title: impl Into<String>, address: impl Into<String>) -> Self {
Self {
location,
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
extra: BTreeMap::new(),
}
}
pub fn foursquare_id(mut self, value: impl Into<String>) -> Self {
self.foursquare_id = Some(value.into());
self
}
pub fn foursquare_type(mut self, value: impl Into<String>) -> Self {
self.foursquare_type = Some(value.into());
self
}
pub fn google_place_id(mut self, value: impl Into<String>) -> Self {
self.google_place_id = Some(value.into());
self
}
pub fn google_place_type(mut self, value: impl Into<String>) -> Self {
self.google_place_type = Some(value.into());
self
}
}
#[doc = "This object represents a video file."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Video {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Video width as defined by the sender"]
pub width: i64,
#[doc = "Video height as defined by the sender"]
pub height: i64,
#[doc = "Duration of the video in seconds as defined by the sender"]
pub duration: i64,
#[doc = "Video thumbnail"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "Available sizes of the cover of the video in the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cover: Option<Vec<PhotoSize>>,
#[doc = "Timestamp in seconds from which the video will play in the message"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub start_timestamp: Option<i64>,
#[doc = "List of available qualities of the video"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub qualities: Option<Vec<VideoQuality>>,
#[doc = "Original filename as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Video {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.cover, output);
CollectFiles::collect_files(&self.start_timestamp, output);
CollectFiles::collect_files(&self.qualities, output);
CollectFiles::collect_files(&self.file_name, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl Video {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
width: i64,
height: i64,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
duration,
thumbnail: None,
cover: None,
start_timestamp: None,
qualities: None,
file_name: None,
mime_type: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn cover(mut self, value: Vec<PhotoSize>) -> Self {
self.cover = Some(value);
self
}
pub fn start_timestamp(mut self, value: i64) -> Self {
self.start_timestamp = Some(value);
self
}
pub fn qualities(mut self, value: Vec<VideoQuality>) -> Self {
self.qualities = Some(value);
self
}
pub fn file_name(mut self, value: impl Into<String>) -> Self {
self.file_name = Some(value.into());
self
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents a service message about a video chat ended in the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoChatEnded {
#[doc = "Video chat duration in seconds"]
pub duration: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoChatEnded {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.duration, output);
}
}
impl VideoChatEnded {
pub fn new(duration: i64) -> Self {
Self {
duration,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a service message about new members invited to a video chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoChatParticipantsInvited {
#[doc = "New members that were invited to the video chat"]
pub users: Vec<User>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoChatParticipantsInvited {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.users, output);
}
}
impl VideoChatParticipantsInvited {
pub fn new(users: Vec<User>) -> Self {
Self {
users,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a service message about a video chat scheduled in the chat."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoChatScheduled {
#[doc = "Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator"]
pub start_date: i64,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoChatScheduled {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.start_date, output);
}
}
impl VideoChatScheduled {
pub fn new(start_date: i64) -> Self {
Self {
start_date,
extra: BTreeMap::new(),
}
}
}
#[doc = "This object represents a service message about a video chat started in the chat. Currently holds no information."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoChatStarted {
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoChatStarted {
fn collect_files(&self, _output: &mut Vec<InputFileUpload>) {}
}
impl VideoChatStarted {
pub fn new() -> Self {
Self {
extra: BTreeMap::new(),
}
}
}
impl Default for VideoChatStarted {
fn default() -> Self {
Self::new()
}
}
#[doc = "This object represents a video message (available in Telegram apps as of v.4.0)."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoNote {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Video width and height (diameter of the video message) as defined by the sender"]
pub length: i64,
#[doc = "Duration of the video in seconds as defined by the sender"]
pub duration: i64,
#[doc = "Video thumbnail"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<PhotoSize>,
#[doc = "File size in bytes"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoNote {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.length, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.thumbnail, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl VideoNote {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
length: i64,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
length,
duration,
thumbnail: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn thumbnail(mut self, value: PhotoSize) -> Self {
self.thumbnail = Some(value);
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents a video file of a specific quality."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct VideoQuality {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Video width"]
pub width: i64,
#[doc = "Video height"]
pub height: i64,
#[doc = "Codec that was used to encode the video, for example, 'h264', 'h265', or 'av01'"]
pub codec: String,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for VideoQuality {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.width, output);
CollectFiles::collect_files(&self.height, output);
CollectFiles::collect_files(&self.codec, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl VideoQuality {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
width: i64,
height: i64,
codec: impl Into<String>,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
width,
height,
codec: codec.into(),
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "This object represents a voice note."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Voice {
#[doc = "Identifier for this file, which can be used to download or reuse the file"]
pub file_id: String,
#[doc = "Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file."]
pub file_unique_id: String,
#[doc = "Duration of the audio in seconds as defined by the sender"]
pub duration: i64,
#[doc = "MIME type of the file as defined by the sender"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mime_type: Option<String>,
#[doc = "File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for Voice {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.file_id, output);
CollectFiles::collect_files(&self.file_unique_id, output);
CollectFiles::collect_files(&self.duration, output);
CollectFiles::collect_files(&self.mime_type, output);
CollectFiles::collect_files(&self.file_size, output);
}
}
impl Voice {
pub fn new(
file_id: impl Into<String>,
file_unique_id: impl Into<String>,
duration: i64,
) -> Self {
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
duration,
mime_type: None,
file_size: None,
extra: BTreeMap::new(),
}
}
pub fn mime_type(mut self, value: impl Into<String>) -> Self {
self.mime_type = Some(value.into());
self
}
pub fn file_size(mut self, value: i64) -> Self {
self.file_size = Some(value);
self
}
}
#[doc = "Describes data sent from a Web App to the bot."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct WebAppData {
#[doc = "The data. Be aware that a bad client can send arbitrary data in this field."]
pub data: String,
#[doc = "Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field."]
pub button_text: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for WebAppData {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.data, output);
CollectFiles::collect_files(&self.button_text, output);
}
}
impl WebAppData {
pub fn new(data: impl Into<String>, button_text: impl Into<String>) -> Self {
Self {
data: data.into(),
button_text: button_text.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes a Web App."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct WebAppInfo {
#[doc = "An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps"]
pub url: String,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for WebAppInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.url, output);
}
}
impl WebAppInfo {
pub fn new(url: impl Into<String>) -> Self {
Self {
url: url.into(),
extra: BTreeMap::new(),
}
}
}
#[doc = "Describes the current status of a webhook."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct WebhookInfo {
#[doc = "Webhook URL, may be empty if webhook is not set up"]
pub url: String,
#[doc = "True, if a custom certificate was provided for webhook certificate checks"]
pub has_custom_certificate: bool,
#[doc = "Number of updates awaiting delivery"]
pub pending_update_count: i64,
#[doc = "Currently used webhook IP address"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ip_address: Option<String>,
#[doc = "Unix time for the most recent error that happened when trying to deliver an update via webhook"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_error_date: Option<i64>,
#[doc = "Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_error_message: Option<String>,
#[doc = "Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_synchronization_error_date: Option<i64>,
#[doc = "The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_connections: Option<i64>,
#[doc = "A list of update types the bot is subscribed to. Defaults to all update types except chat_member, message_reaction, and message_reaction_count."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub allowed_updates: Option<Vec<String>>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for WebhookInfo {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.url, output);
CollectFiles::collect_files(&self.has_custom_certificate, output);
CollectFiles::collect_files(&self.pending_update_count, output);
CollectFiles::collect_files(&self.ip_address, output);
CollectFiles::collect_files(&self.last_error_date, output);
CollectFiles::collect_files(&self.last_error_message, output);
CollectFiles::collect_files(&self.last_synchronization_error_date, output);
CollectFiles::collect_files(&self.max_connections, output);
CollectFiles::collect_files(&self.allowed_updates, output);
}
}
impl WebhookInfo {
pub fn new(
url: impl Into<String>,
has_custom_certificate: bool,
pending_update_count: i64,
) -> Self {
Self {
url: url.into(),
has_custom_certificate,
pending_update_count,
ip_address: None,
last_error_date: None,
last_error_message: None,
last_synchronization_error_date: None,
max_connections: None,
allowed_updates: None,
extra: BTreeMap::new(),
}
}
pub fn ip_address(mut self, value: impl Into<String>) -> Self {
self.ip_address = Some(value.into());
self
}
pub fn last_error_date(mut self, value: i64) -> Self {
self.last_error_date = Some(value);
self
}
pub fn last_error_message(mut self, value: impl Into<String>) -> Self {
self.last_error_message = Some(value.into());
self
}
pub fn last_synchronization_error_date(mut self, value: i64) -> Self {
self.last_synchronization_error_date = Some(value);
self
}
pub fn max_connections(mut self, value: i64) -> Self {
self.max_connections = Some(value);
self
}
pub fn allowed_updates(mut self, value: Vec<String>) -> Self {
self.allowed_updates = Some(value);
self
}
}
#[doc = "This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess."]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct WriteAccessAllowed {
#[doc = "True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub from_request: Option<bool>,
#[doc = "Name of the Web App, if the access was granted when the Web App was launched from a link"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub web_app_name: Option<String>,
#[doc = "True, if the access was granted when the bot was added to the attachment or side menu"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub from_attachment_menu: Option<bool>,
#[serde(flatten, default)]
pub extra: BTreeMap<String, Value>,
}
impl CollectFiles for WriteAccessAllowed {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
CollectFiles::collect_files(&self.from_request, output);
CollectFiles::collect_files(&self.web_app_name, output);
CollectFiles::collect_files(&self.from_attachment_menu, output);
}
}
impl WriteAccessAllowed {
pub fn new() -> Self {
Self {
from_request: None,
web_app_name: None,
from_attachment_menu: None,
extra: BTreeMap::new(),
}
}
pub fn from_request(mut self, value: bool) -> Self {
self.from_request = Some(value);
self
}
pub fn web_app_name(mut self, value: impl Into<String>) -> Self {
self.web_app_name = Some(value.into());
self
}
pub fn from_attachment_menu(mut self, value: bool) -> Self {
self.from_attachment_menu = Some(value);
self
}
}
impl Default for WriteAccessAllowed {
fn default() -> Self {
Self::new()
}
}
/// Number of aiogram-compatible helper unions.
pub const API_UNION_COUNT: usize = 35;
#[derive(Debug, Clone, PartialEq)]
pub enum BackgroundFillUnion {
BackgroundFillFreeformGradient(Box<BackgroundFillFreeformGradient>),
BackgroundFillGradient(Box<BackgroundFillGradient>),
BackgroundFillSolid(Box<BackgroundFillSolid>),
}
impl Serialize for BackgroundFillUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::BackgroundFillFreeformGradient(value) => value.serialize(serializer),
Self::BackgroundFillGradient(value) => value.serialize(serializer),
Self::BackgroundFillSolid(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for BackgroundFillUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"freeform_gradient" => serde_json::from_value::<BackgroundFillFreeformGradient>(value)
.map(|value| Self::BackgroundFillFreeformGradient(Box::new(value)))
.map_err(serde::de::Error::custom),
"gradient" => serde_json::from_value::<BackgroundFillGradient>(value)
.map(|value| Self::BackgroundFillGradient(Box::new(value)))
.map_err(serde::de::Error::custom),
"solid" => serde_json::from_value::<BackgroundFillSolid>(value)
.map(|value| Self::BackgroundFillSolid(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for BackgroundFillUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::BackgroundFillFreeformGradient(value) => value.collect_files(output),
Self::BackgroundFillGradient(value) => value.collect_files(output),
Self::BackgroundFillSolid(value) => value.collect_files(output),
}
}
}
impl From<BackgroundFillFreeformGradient> for BackgroundFillUnion {
fn from(value: BackgroundFillFreeformGradient) -> Self {
Self::BackgroundFillFreeformGradient(Box::new(value))
}
}
impl From<BackgroundFillGradient> for BackgroundFillUnion {
fn from(value: BackgroundFillGradient) -> Self {
Self::BackgroundFillGradient(Box::new(value))
}
}
impl From<BackgroundFillSolid> for BackgroundFillUnion {
fn from(value: BackgroundFillSolid) -> Self {
Self::BackgroundFillSolid(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum BackgroundTypeUnion {
BackgroundTypeChatTheme(Box<BackgroundTypeChatTheme>),
BackgroundTypeFill(Box<BackgroundTypeFill>),
BackgroundTypePattern(Box<BackgroundTypePattern>),
BackgroundTypeWallpaper(Box<BackgroundTypeWallpaper>),
}
impl Serialize for BackgroundTypeUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::BackgroundTypeChatTheme(value) => value.serialize(serializer),
Self::BackgroundTypeFill(value) => value.serialize(serializer),
Self::BackgroundTypePattern(value) => value.serialize(serializer),
Self::BackgroundTypeWallpaper(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for BackgroundTypeUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"chat_theme" => serde_json::from_value::<BackgroundTypeChatTheme>(value)
.map(|value| Self::BackgroundTypeChatTheme(Box::new(value)))
.map_err(serde::de::Error::custom),
"fill" => serde_json::from_value::<BackgroundTypeFill>(value)
.map(|value| Self::BackgroundTypeFill(Box::new(value)))
.map_err(serde::de::Error::custom),
"pattern" => serde_json::from_value::<BackgroundTypePattern>(value)
.map(|value| Self::BackgroundTypePattern(Box::new(value)))
.map_err(serde::de::Error::custom),
"wallpaper" => serde_json::from_value::<BackgroundTypeWallpaper>(value)
.map(|value| Self::BackgroundTypeWallpaper(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for BackgroundTypeUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::BackgroundTypeChatTheme(value) => value.collect_files(output),
Self::BackgroundTypeFill(value) => value.collect_files(output),
Self::BackgroundTypePattern(value) => value.collect_files(output),
Self::BackgroundTypeWallpaper(value) => value.collect_files(output),
}
}
}
impl From<BackgroundTypeChatTheme> for BackgroundTypeUnion {
fn from(value: BackgroundTypeChatTheme) -> Self {
Self::BackgroundTypeChatTheme(Box::new(value))
}
}
impl From<BackgroundTypeFill> for BackgroundTypeUnion {
fn from(value: BackgroundTypeFill) -> Self {
Self::BackgroundTypeFill(Box::new(value))
}
}
impl From<BackgroundTypePattern> for BackgroundTypeUnion {
fn from(value: BackgroundTypePattern) -> Self {
Self::BackgroundTypePattern(Box::new(value))
}
}
impl From<BackgroundTypeWallpaper> for BackgroundTypeUnion {
fn from(value: BackgroundTypeWallpaper) -> Self {
Self::BackgroundTypeWallpaper(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum BotCommandScopeUnion {
BotCommandScopeAllChatAdministrators(Box<BotCommandScopeAllChatAdministrators>),
BotCommandScopeAllGroupChats(Box<BotCommandScopeAllGroupChats>),
BotCommandScopeAllPrivateChats(Box<BotCommandScopeAllPrivateChats>),
BotCommandScopeChat(Box<BotCommandScopeChat>),
BotCommandScopeChatAdministrators(Box<BotCommandScopeChatAdministrators>),
BotCommandScopeChatMember(Box<BotCommandScopeChatMember>),
BotCommandScopeDefault(Box<BotCommandScopeDefault>),
}
impl CollectFiles for BotCommandScopeUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::BotCommandScopeAllChatAdministrators(value) => value.collect_files(output),
Self::BotCommandScopeAllGroupChats(value) => value.collect_files(output),
Self::BotCommandScopeAllPrivateChats(value) => value.collect_files(output),
Self::BotCommandScopeChat(value) => value.collect_files(output),
Self::BotCommandScopeChatAdministrators(value) => value.collect_files(output),
Self::BotCommandScopeChatMember(value) => value.collect_files(output),
Self::BotCommandScopeDefault(value) => value.collect_files(output),
}
}
}
impl From<BotCommandScopeAllChatAdministrators> for BotCommandScopeUnion {
fn from(value: BotCommandScopeAllChatAdministrators) -> Self {
Self::BotCommandScopeAllChatAdministrators(Box::new(value))
}
}
impl From<BotCommandScopeAllGroupChats> for BotCommandScopeUnion {
fn from(value: BotCommandScopeAllGroupChats) -> Self {
Self::BotCommandScopeAllGroupChats(Box::new(value))
}
}
impl From<BotCommandScopeAllPrivateChats> for BotCommandScopeUnion {
fn from(value: BotCommandScopeAllPrivateChats) -> Self {
Self::BotCommandScopeAllPrivateChats(Box::new(value))
}
}
impl From<BotCommandScopeChat> for BotCommandScopeUnion {
fn from(value: BotCommandScopeChat) -> Self {
Self::BotCommandScopeChat(Box::new(value))
}
}
impl From<BotCommandScopeChatAdministrators> for BotCommandScopeUnion {
fn from(value: BotCommandScopeChatAdministrators) -> Self {
Self::BotCommandScopeChatAdministrators(Box::new(value))
}
}
impl From<BotCommandScopeChatMember> for BotCommandScopeUnion {
fn from(value: BotCommandScopeChatMember) -> Self {
Self::BotCommandScopeChatMember(Box::new(value))
}
}
impl From<BotCommandScopeDefault> for BotCommandScopeUnion {
fn from(value: BotCommandScopeDefault) -> Self {
Self::BotCommandScopeDefault(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ChatBoostSourceUnion {
ChatBoostSourceGiftCode(Box<ChatBoostSourceGiftCode>),
ChatBoostSourceGiveaway(Box<ChatBoostSourceGiveaway>),
ChatBoostSourcePremium(Box<ChatBoostSourcePremium>),
}
impl Serialize for ChatBoostSourceUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::ChatBoostSourceGiftCode(value) => value.serialize(serializer),
Self::ChatBoostSourceGiveaway(value) => value.serialize(serializer),
Self::ChatBoostSourcePremium(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for ChatBoostSourceUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("source")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"gift_code" => serde_json::from_value::<ChatBoostSourceGiftCode>(value)
.map(|value| Self::ChatBoostSourceGiftCode(Box::new(value)))
.map_err(serde::de::Error::custom),
"giveaway" => serde_json::from_value::<ChatBoostSourceGiveaway>(value)
.map(|value| Self::ChatBoostSourceGiveaway(Box::new(value)))
.map_err(serde::de::Error::custom),
"premium" => serde_json::from_value::<ChatBoostSourcePremium>(value)
.map(|value| Self::ChatBoostSourcePremium(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for ChatBoostSourceUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::ChatBoostSourceGiftCode(value) => value.collect_files(output),
Self::ChatBoostSourceGiveaway(value) => value.collect_files(output),
Self::ChatBoostSourcePremium(value) => value.collect_files(output),
}
}
}
impl From<ChatBoostSourceGiftCode> for ChatBoostSourceUnion {
fn from(value: ChatBoostSourceGiftCode) -> Self {
Self::ChatBoostSourceGiftCode(Box::new(value))
}
}
impl From<ChatBoostSourceGiveaway> for ChatBoostSourceUnion {
fn from(value: ChatBoostSourceGiveaway) -> Self {
Self::ChatBoostSourceGiveaway(Box::new(value))
}
}
impl From<ChatBoostSourcePremium> for ChatBoostSourceUnion {
fn from(value: ChatBoostSourcePremium) -> Self {
Self::ChatBoostSourcePremium(Box::new(value))
}
}
pub type ChatIdUnion = super::ChatId;
#[derive(Debug, Clone, PartialEq)]
pub enum ChatMemberUnion {
ChatMemberAdministrator(Box<ChatMemberAdministrator>),
ChatMemberBanned(Box<ChatMemberBanned>),
ChatMemberLeft(Box<ChatMemberLeft>),
ChatMemberMember(Box<ChatMemberMember>),
ChatMemberOwner(Box<ChatMemberOwner>),
ChatMemberRestricted(Box<ChatMemberRestricted>),
}
impl Serialize for ChatMemberUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::ChatMemberAdministrator(value) => value.serialize(serializer),
Self::ChatMemberBanned(value) => value.serialize(serializer),
Self::ChatMemberLeft(value) => value.serialize(serializer),
Self::ChatMemberMember(value) => value.serialize(serializer),
Self::ChatMemberOwner(value) => value.serialize(serializer),
Self::ChatMemberRestricted(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for ChatMemberUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("status")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"administrator" => serde_json::from_value::<ChatMemberAdministrator>(value)
.map(|value| Self::ChatMemberAdministrator(Box::new(value)))
.map_err(serde::de::Error::custom),
"kicked" => serde_json::from_value::<ChatMemberBanned>(value)
.map(|value| Self::ChatMemberBanned(Box::new(value)))
.map_err(serde::de::Error::custom),
"left" => serde_json::from_value::<ChatMemberLeft>(value)
.map(|value| Self::ChatMemberLeft(Box::new(value)))
.map_err(serde::de::Error::custom),
"member" => serde_json::from_value::<ChatMemberMember>(value)
.map(|value| Self::ChatMemberMember(Box::new(value)))
.map_err(serde::de::Error::custom),
"creator" => serde_json::from_value::<ChatMemberOwner>(value)
.map(|value| Self::ChatMemberOwner(Box::new(value)))
.map_err(serde::de::Error::custom),
"restricted" => serde_json::from_value::<ChatMemberRestricted>(value)
.map(|value| Self::ChatMemberRestricted(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for ChatMemberUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::ChatMemberAdministrator(value) => value.collect_files(output),
Self::ChatMemberBanned(value) => value.collect_files(output),
Self::ChatMemberLeft(value) => value.collect_files(output),
Self::ChatMemberMember(value) => value.collect_files(output),
Self::ChatMemberOwner(value) => value.collect_files(output),
Self::ChatMemberRestricted(value) => value.collect_files(output),
}
}
}
impl From<ChatMemberAdministrator> for ChatMemberUnion {
fn from(value: ChatMemberAdministrator) -> Self {
Self::ChatMemberAdministrator(Box::new(value))
}
}
impl From<ChatMemberBanned> for ChatMemberUnion {
fn from(value: ChatMemberBanned) -> Self {
Self::ChatMemberBanned(Box::new(value))
}
}
impl From<ChatMemberLeft> for ChatMemberUnion {
fn from(value: ChatMemberLeft) -> Self {
Self::ChatMemberLeft(Box::new(value))
}
}
impl From<ChatMemberMember> for ChatMemberUnion {
fn from(value: ChatMemberMember) -> Self {
Self::ChatMemberMember(Box::new(value))
}
}
impl From<ChatMemberOwner> for ChatMemberUnion {
fn from(value: ChatMemberOwner) -> Self {
Self::ChatMemberOwner(Box::new(value))
}
}
impl From<ChatMemberRestricted> for ChatMemberUnion {
fn from(value: ChatMemberRestricted) -> Self {
Self::ChatMemberRestricted(Box::new(value))
}
}
pub type DateTimeUnion = i64;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InlineQueryResultUnion {
InlineQueryResultArticle(Box<InlineQueryResultArticle>),
InlineQueryResultAudio(Box<InlineQueryResultAudio>),
InlineQueryResultCachedAudio(Box<InlineQueryResultCachedAudio>),
InlineQueryResultCachedDocument(Box<InlineQueryResultCachedDocument>),
InlineQueryResultCachedGif(Box<InlineQueryResultCachedGif>),
InlineQueryResultCachedMpeg4Gif(Box<InlineQueryResultCachedMpeg4Gif>),
InlineQueryResultCachedPhoto(Box<InlineQueryResultCachedPhoto>),
InlineQueryResultCachedSticker(Box<InlineQueryResultCachedSticker>),
InlineQueryResultCachedVideo(Box<InlineQueryResultCachedVideo>),
InlineQueryResultCachedVoice(Box<InlineQueryResultCachedVoice>),
InlineQueryResultContact(Box<InlineQueryResultContact>),
InlineQueryResultDocument(Box<InlineQueryResultDocument>),
InlineQueryResultGame(Box<InlineQueryResultGame>),
InlineQueryResultGif(Box<InlineQueryResultGif>),
InlineQueryResultLocation(Box<InlineQueryResultLocation>),
InlineQueryResultMpeg4Gif(Box<InlineQueryResultMpeg4Gif>),
InlineQueryResultPhoto(Box<InlineQueryResultPhoto>),
InlineQueryResultVenue(Box<InlineQueryResultVenue>),
InlineQueryResultVideo(Box<InlineQueryResultVideo>),
InlineQueryResultVoice(Box<InlineQueryResultVoice>),
}
impl CollectFiles for InlineQueryResultUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InlineQueryResultArticle(value) => value.collect_files(output),
Self::InlineQueryResultAudio(value) => value.collect_files(output),
Self::InlineQueryResultCachedAudio(value) => value.collect_files(output),
Self::InlineQueryResultCachedDocument(value) => value.collect_files(output),
Self::InlineQueryResultCachedGif(value) => value.collect_files(output),
Self::InlineQueryResultCachedMpeg4Gif(value) => value.collect_files(output),
Self::InlineQueryResultCachedPhoto(value) => value.collect_files(output),
Self::InlineQueryResultCachedSticker(value) => value.collect_files(output),
Self::InlineQueryResultCachedVideo(value) => value.collect_files(output),
Self::InlineQueryResultCachedVoice(value) => value.collect_files(output),
Self::InlineQueryResultContact(value) => value.collect_files(output),
Self::InlineQueryResultDocument(value) => value.collect_files(output),
Self::InlineQueryResultGame(value) => value.collect_files(output),
Self::InlineQueryResultGif(value) => value.collect_files(output),
Self::InlineQueryResultLocation(value) => value.collect_files(output),
Self::InlineQueryResultMpeg4Gif(value) => value.collect_files(output),
Self::InlineQueryResultPhoto(value) => value.collect_files(output),
Self::InlineQueryResultVenue(value) => value.collect_files(output),
Self::InlineQueryResultVideo(value) => value.collect_files(output),
Self::InlineQueryResultVoice(value) => value.collect_files(output),
}
}
}
impl From<InlineQueryResultArticle> for InlineQueryResultUnion {
fn from(value: InlineQueryResultArticle) -> Self {
Self::InlineQueryResultArticle(Box::new(value))
}
}
impl From<InlineQueryResultAudio> for InlineQueryResultUnion {
fn from(value: InlineQueryResultAudio) -> Self {
Self::InlineQueryResultAudio(Box::new(value))
}
}
impl From<InlineQueryResultCachedAudio> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedAudio) -> Self {
Self::InlineQueryResultCachedAudio(Box::new(value))
}
}
impl From<InlineQueryResultCachedDocument> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedDocument) -> Self {
Self::InlineQueryResultCachedDocument(Box::new(value))
}
}
impl From<InlineQueryResultCachedGif> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedGif) -> Self {
Self::InlineQueryResultCachedGif(Box::new(value))
}
}
impl From<InlineQueryResultCachedMpeg4Gif> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedMpeg4Gif) -> Self {
Self::InlineQueryResultCachedMpeg4Gif(Box::new(value))
}
}
impl From<InlineQueryResultCachedPhoto> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedPhoto) -> Self {
Self::InlineQueryResultCachedPhoto(Box::new(value))
}
}
impl From<InlineQueryResultCachedSticker> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedSticker) -> Self {
Self::InlineQueryResultCachedSticker(Box::new(value))
}
}
impl From<InlineQueryResultCachedVideo> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedVideo) -> Self {
Self::InlineQueryResultCachedVideo(Box::new(value))
}
}
impl From<InlineQueryResultCachedVoice> for InlineQueryResultUnion {
fn from(value: InlineQueryResultCachedVoice) -> Self {
Self::InlineQueryResultCachedVoice(Box::new(value))
}
}
impl From<InlineQueryResultContact> for InlineQueryResultUnion {
fn from(value: InlineQueryResultContact) -> Self {
Self::InlineQueryResultContact(Box::new(value))
}
}
impl From<InlineQueryResultDocument> for InlineQueryResultUnion {
fn from(value: InlineQueryResultDocument) -> Self {
Self::InlineQueryResultDocument(Box::new(value))
}
}
impl From<InlineQueryResultGame> for InlineQueryResultUnion {
fn from(value: InlineQueryResultGame) -> Self {
Self::InlineQueryResultGame(Box::new(value))
}
}
impl From<InlineQueryResultGif> for InlineQueryResultUnion {
fn from(value: InlineQueryResultGif) -> Self {
Self::InlineQueryResultGif(Box::new(value))
}
}
impl From<InlineQueryResultLocation> for InlineQueryResultUnion {
fn from(value: InlineQueryResultLocation) -> Self {
Self::InlineQueryResultLocation(Box::new(value))
}
}
impl From<InlineQueryResultMpeg4Gif> for InlineQueryResultUnion {
fn from(value: InlineQueryResultMpeg4Gif) -> Self {
Self::InlineQueryResultMpeg4Gif(Box::new(value))
}
}
impl From<InlineQueryResultPhoto> for InlineQueryResultUnion {
fn from(value: InlineQueryResultPhoto) -> Self {
Self::InlineQueryResultPhoto(Box::new(value))
}
}
impl From<InlineQueryResultVenue> for InlineQueryResultUnion {
fn from(value: InlineQueryResultVenue) -> Self {
Self::InlineQueryResultVenue(Box::new(value))
}
}
impl From<InlineQueryResultVideo> for InlineQueryResultUnion {
fn from(value: InlineQueryResultVideo) -> Self {
Self::InlineQueryResultVideo(Box::new(value))
}
}
impl From<InlineQueryResultVoice> for InlineQueryResultUnion {
fn from(value: InlineQueryResultVoice) -> Self {
Self::InlineQueryResultVoice(Box::new(value))
}
}
pub type InputFileUnion = super::InputFile;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputMediaUnion {
InputMediaAnimation(Box<InputMediaAnimation>),
InputMediaAudio(Box<InputMediaAudio>),
InputMediaDocument(Box<InputMediaDocument>),
InputMediaLivePhoto(Box<InputMediaLivePhoto>),
InputMediaPhoto(Box<InputMediaPhoto>),
InputMediaVideo(Box<InputMediaVideo>),
}
impl CollectFiles for InputMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputMediaAnimation(value) => value.collect_files(output),
Self::InputMediaAudio(value) => value.collect_files(output),
Self::InputMediaDocument(value) => value.collect_files(output),
Self::InputMediaLivePhoto(value) => value.collect_files(output),
Self::InputMediaPhoto(value) => value.collect_files(output),
Self::InputMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<InputMediaAnimation> for InputMediaUnion {
fn from(value: InputMediaAnimation) -> Self {
Self::InputMediaAnimation(Box::new(value))
}
}
impl From<InputMediaAudio> for InputMediaUnion {
fn from(value: InputMediaAudio) -> Self {
Self::InputMediaAudio(Box::new(value))
}
}
impl From<InputMediaDocument> for InputMediaUnion {
fn from(value: InputMediaDocument) -> Self {
Self::InputMediaDocument(Box::new(value))
}
}
impl From<InputMediaLivePhoto> for InputMediaUnion {
fn from(value: InputMediaLivePhoto) -> Self {
Self::InputMediaLivePhoto(Box::new(value))
}
}
impl From<InputMediaPhoto> for InputMediaUnion {
fn from(value: InputMediaPhoto) -> Self {
Self::InputMediaPhoto(Box::new(value))
}
}
impl From<InputMediaVideo> for InputMediaUnion {
fn from(value: InputMediaVideo) -> Self {
Self::InputMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputMessageContentUnion {
InputContactMessageContent(Box<InputContactMessageContent>),
InputInvoiceMessageContent(Box<InputInvoiceMessageContent>),
InputLocationMessageContent(Box<InputLocationMessageContent>),
InputRichMessageContent(Box<InputRichMessageContent>),
InputTextMessageContent(Box<InputTextMessageContent>),
InputVenueMessageContent(Box<InputVenueMessageContent>),
}
impl CollectFiles for InputMessageContentUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputContactMessageContent(value) => value.collect_files(output),
Self::InputInvoiceMessageContent(value) => value.collect_files(output),
Self::InputLocationMessageContent(value) => value.collect_files(output),
Self::InputRichMessageContent(value) => value.collect_files(output),
Self::InputTextMessageContent(value) => value.collect_files(output),
Self::InputVenueMessageContent(value) => value.collect_files(output),
}
}
}
impl From<InputContactMessageContent> for InputMessageContentUnion {
fn from(value: InputContactMessageContent) -> Self {
Self::InputContactMessageContent(Box::new(value))
}
}
impl From<InputInvoiceMessageContent> for InputMessageContentUnion {
fn from(value: InputInvoiceMessageContent) -> Self {
Self::InputInvoiceMessageContent(Box::new(value))
}
}
impl From<InputLocationMessageContent> for InputMessageContentUnion {
fn from(value: InputLocationMessageContent) -> Self {
Self::InputLocationMessageContent(Box::new(value))
}
}
impl From<InputRichMessageContent> for InputMessageContentUnion {
fn from(value: InputRichMessageContent) -> Self {
Self::InputRichMessageContent(Box::new(value))
}
}
impl From<InputTextMessageContent> for InputMessageContentUnion {
fn from(value: InputTextMessageContent) -> Self {
Self::InputTextMessageContent(Box::new(value))
}
}
impl From<InputVenueMessageContent> for InputMessageContentUnion {
fn from(value: InputVenueMessageContent) -> Self {
Self::InputVenueMessageContent(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputPaidMediaUnion {
InputPaidMediaLivePhoto(Box<InputPaidMediaLivePhoto>),
InputPaidMediaPhoto(Box<InputPaidMediaPhoto>),
InputPaidMediaVideo(Box<InputPaidMediaVideo>),
}
impl CollectFiles for InputPaidMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputPaidMediaLivePhoto(value) => value.collect_files(output),
Self::InputPaidMediaPhoto(value) => value.collect_files(output),
Self::InputPaidMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<InputPaidMediaLivePhoto> for InputPaidMediaUnion {
fn from(value: InputPaidMediaLivePhoto) -> Self {
Self::InputPaidMediaLivePhoto(Box::new(value))
}
}
impl From<InputPaidMediaPhoto> for InputPaidMediaUnion {
fn from(value: InputPaidMediaPhoto) -> Self {
Self::InputPaidMediaPhoto(Box::new(value))
}
}
impl From<InputPaidMediaVideo> for InputPaidMediaUnion {
fn from(value: InputPaidMediaVideo) -> Self {
Self::InputPaidMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputPollMediaUnion {
InputMediaAnimation(Box<InputMediaAnimation>),
InputMediaAudio(Box<InputMediaAudio>),
InputMediaDocument(Box<InputMediaDocument>),
InputMediaLivePhoto(Box<InputMediaLivePhoto>),
InputMediaLocation(Box<InputMediaLocation>),
InputMediaPhoto(Box<InputMediaPhoto>),
InputMediaVenue(Box<InputMediaVenue>),
InputMediaVideo(Box<InputMediaVideo>),
}
impl CollectFiles for InputPollMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputMediaAnimation(value) => value.collect_files(output),
Self::InputMediaAudio(value) => value.collect_files(output),
Self::InputMediaDocument(value) => value.collect_files(output),
Self::InputMediaLivePhoto(value) => value.collect_files(output),
Self::InputMediaLocation(value) => value.collect_files(output),
Self::InputMediaPhoto(value) => value.collect_files(output),
Self::InputMediaVenue(value) => value.collect_files(output),
Self::InputMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<InputMediaAnimation> for InputPollMediaUnion {
fn from(value: InputMediaAnimation) -> Self {
Self::InputMediaAnimation(Box::new(value))
}
}
impl From<InputMediaAudio> for InputPollMediaUnion {
fn from(value: InputMediaAudio) -> Self {
Self::InputMediaAudio(Box::new(value))
}
}
impl From<InputMediaDocument> for InputPollMediaUnion {
fn from(value: InputMediaDocument) -> Self {
Self::InputMediaDocument(Box::new(value))
}
}
impl From<InputMediaLivePhoto> for InputPollMediaUnion {
fn from(value: InputMediaLivePhoto) -> Self {
Self::InputMediaLivePhoto(Box::new(value))
}
}
impl From<InputMediaLocation> for InputPollMediaUnion {
fn from(value: InputMediaLocation) -> Self {
Self::InputMediaLocation(Box::new(value))
}
}
impl From<InputMediaPhoto> for InputPollMediaUnion {
fn from(value: InputMediaPhoto) -> Self {
Self::InputMediaPhoto(Box::new(value))
}
}
impl From<InputMediaVenue> for InputPollMediaUnion {
fn from(value: InputMediaVenue) -> Self {
Self::InputMediaVenue(Box::new(value))
}
}
impl From<InputMediaVideo> for InputPollMediaUnion {
fn from(value: InputMediaVideo) -> Self {
Self::InputMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputPollOptionMediaUnion {
InputMediaAnimation(Box<InputMediaAnimation>),
InputMediaLink(Box<InputMediaLink>),
InputMediaLivePhoto(Box<InputMediaLivePhoto>),
InputMediaLocation(Box<InputMediaLocation>),
InputMediaPhoto(Box<InputMediaPhoto>),
InputMediaSticker(Box<InputMediaSticker>),
InputMediaVenue(Box<InputMediaVenue>),
InputMediaVideo(Box<InputMediaVideo>),
}
impl CollectFiles for InputPollOptionMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputMediaAnimation(value) => value.collect_files(output),
Self::InputMediaLink(value) => value.collect_files(output),
Self::InputMediaLivePhoto(value) => value.collect_files(output),
Self::InputMediaLocation(value) => value.collect_files(output),
Self::InputMediaPhoto(value) => value.collect_files(output),
Self::InputMediaSticker(value) => value.collect_files(output),
Self::InputMediaVenue(value) => value.collect_files(output),
Self::InputMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<InputMediaAnimation> for InputPollOptionMediaUnion {
fn from(value: InputMediaAnimation) -> Self {
Self::InputMediaAnimation(Box::new(value))
}
}
impl From<InputMediaLink> for InputPollOptionMediaUnion {
fn from(value: InputMediaLink) -> Self {
Self::InputMediaLink(Box::new(value))
}
}
impl From<InputMediaLivePhoto> for InputPollOptionMediaUnion {
fn from(value: InputMediaLivePhoto) -> Self {
Self::InputMediaLivePhoto(Box::new(value))
}
}
impl From<InputMediaLocation> for InputPollOptionMediaUnion {
fn from(value: InputMediaLocation) -> Self {
Self::InputMediaLocation(Box::new(value))
}
}
impl From<InputMediaPhoto> for InputPollOptionMediaUnion {
fn from(value: InputMediaPhoto) -> Self {
Self::InputMediaPhoto(Box::new(value))
}
}
impl From<InputMediaSticker> for InputPollOptionMediaUnion {
fn from(value: InputMediaSticker) -> Self {
Self::InputMediaSticker(Box::new(value))
}
}
impl From<InputMediaVenue> for InputPollOptionMediaUnion {
fn from(value: InputMediaVenue) -> Self {
Self::InputMediaVenue(Box::new(value))
}
}
impl From<InputMediaVideo> for InputPollOptionMediaUnion {
fn from(value: InputMediaVideo) -> Self {
Self::InputMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputPollOptionUnion {
Text(String),
InputPollOption(Box<InputPollOption>),
}
impl CollectFiles for InputPollOptionUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::Text(value) => value.collect_files(output),
Self::InputPollOption(value) => value.collect_files(output),
}
}
}
impl From<InputPollOption> for InputPollOptionUnion {
fn from(value: InputPollOption) -> Self {
Self::InputPollOption(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputProfilePhotoUnion {
InputProfilePhotoAnimated(Box<InputProfilePhotoAnimated>),
InputProfilePhotoStatic(Box<InputProfilePhotoStatic>),
}
impl CollectFiles for InputProfilePhotoUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputProfilePhotoAnimated(value) => value.collect_files(output),
Self::InputProfilePhotoStatic(value) => value.collect_files(output),
}
}
}
impl From<InputProfilePhotoAnimated> for InputProfilePhotoUnion {
fn from(value: InputProfilePhotoAnimated) -> Self {
Self::InputProfilePhotoAnimated(Box::new(value))
}
}
impl From<InputProfilePhotoStatic> for InputProfilePhotoUnion {
fn from(value: InputProfilePhotoStatic) -> Self {
Self::InputProfilePhotoStatic(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum InputRichBlockUnion {
InputRichBlockAnchor(Box<InputRichBlockAnchor>),
InputRichBlockAnimation(Box<InputRichBlockAnimation>),
InputRichBlockAudio(Box<InputRichBlockAudio>),
InputRichBlockBlockQuotation(Box<InputRichBlockBlockQuotation>),
InputRichBlockCollage(Box<InputRichBlockCollage>),
InputRichBlockDetails(Box<InputRichBlockDetails>),
InputRichBlockDivider(Box<InputRichBlockDivider>),
InputRichBlockFooter(Box<InputRichBlockFooter>),
InputRichBlockList(Box<InputRichBlockList>),
InputRichBlockMap(Box<InputRichBlockMap>),
InputRichBlockMathematicalExpression(Box<InputRichBlockMathematicalExpression>),
InputRichBlockParagraph(Box<InputRichBlockParagraph>),
InputRichBlockPhoto(Box<InputRichBlockPhoto>),
InputRichBlockPreformatted(Box<InputRichBlockPreformatted>),
InputRichBlockPullQuotation(Box<InputRichBlockPullQuotation>),
InputRichBlockSectionHeading(Box<InputRichBlockSectionHeading>),
InputRichBlockSlideshow(Box<InputRichBlockSlideshow>),
InputRichBlockTable(Box<InputRichBlockTable>),
InputRichBlockThinking(Box<InputRichBlockThinking>),
InputRichBlockVideo(Box<InputRichBlockVideo>),
InputRichBlockVoiceNote(Box<InputRichBlockVoiceNote>),
}
impl Serialize for InputRichBlockUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::InputRichBlockAnchor(value) => value.serialize(serializer),
Self::InputRichBlockAnimation(value) => value.serialize(serializer),
Self::InputRichBlockAudio(value) => value.serialize(serializer),
Self::InputRichBlockBlockQuotation(value) => value.serialize(serializer),
Self::InputRichBlockCollage(value) => value.serialize(serializer),
Self::InputRichBlockDetails(value) => value.serialize(serializer),
Self::InputRichBlockDivider(value) => value.serialize(serializer),
Self::InputRichBlockFooter(value) => value.serialize(serializer),
Self::InputRichBlockList(value) => value.serialize(serializer),
Self::InputRichBlockMap(value) => value.serialize(serializer),
Self::InputRichBlockMathematicalExpression(value) => value.serialize(serializer),
Self::InputRichBlockParagraph(value) => value.serialize(serializer),
Self::InputRichBlockPhoto(value) => value.serialize(serializer),
Self::InputRichBlockPreformatted(value) => value.serialize(serializer),
Self::InputRichBlockPullQuotation(value) => value.serialize(serializer),
Self::InputRichBlockSectionHeading(value) => value.serialize(serializer),
Self::InputRichBlockSlideshow(value) => value.serialize(serializer),
Self::InputRichBlockTable(value) => value.serialize(serializer),
Self::InputRichBlockThinking(value) => value.serialize(serializer),
Self::InputRichBlockVideo(value) => value.serialize(serializer),
Self::InputRichBlockVoiceNote(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for InputRichBlockUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"anchor" => serde_json::from_value::<InputRichBlockAnchor>(value)
.map(|value| Self::InputRichBlockAnchor(Box::new(value)))
.map_err(serde::de::Error::custom),
"animation" => serde_json::from_value::<InputRichBlockAnimation>(value)
.map(|value| Self::InputRichBlockAnimation(Box::new(value)))
.map_err(serde::de::Error::custom),
"audio" => serde_json::from_value::<InputRichBlockAudio>(value)
.map(|value| Self::InputRichBlockAudio(Box::new(value)))
.map_err(serde::de::Error::custom),
"blockquote" => serde_json::from_value::<InputRichBlockBlockQuotation>(value)
.map(|value| Self::InputRichBlockBlockQuotation(Box::new(value)))
.map_err(serde::de::Error::custom),
"collage" => serde_json::from_value::<InputRichBlockCollage>(value)
.map(|value| Self::InputRichBlockCollage(Box::new(value)))
.map_err(serde::de::Error::custom),
"details" => serde_json::from_value::<InputRichBlockDetails>(value)
.map(|value| Self::InputRichBlockDetails(Box::new(value)))
.map_err(serde::de::Error::custom),
"divider" => serde_json::from_value::<InputRichBlockDivider>(value)
.map(|value| Self::InputRichBlockDivider(Box::new(value)))
.map_err(serde::de::Error::custom),
"footer" => serde_json::from_value::<InputRichBlockFooter>(value)
.map(|value| Self::InputRichBlockFooter(Box::new(value)))
.map_err(serde::de::Error::custom),
"list" => serde_json::from_value::<InputRichBlockList>(value)
.map(|value| Self::InputRichBlockList(Box::new(value)))
.map_err(serde::de::Error::custom),
"map" => serde_json::from_value::<InputRichBlockMap>(value)
.map(|value| Self::InputRichBlockMap(Box::new(value)))
.map_err(serde::de::Error::custom),
"mathematical_expression" => {
serde_json::from_value::<InputRichBlockMathematicalExpression>(value)
.map(|value| Self::InputRichBlockMathematicalExpression(Box::new(value)))
.map_err(serde::de::Error::custom)
}
"paragraph" => serde_json::from_value::<InputRichBlockParagraph>(value)
.map(|value| Self::InputRichBlockParagraph(Box::new(value)))
.map_err(serde::de::Error::custom),
"photo" => serde_json::from_value::<InputRichBlockPhoto>(value)
.map(|value| Self::InputRichBlockPhoto(Box::new(value)))
.map_err(serde::de::Error::custom),
"pre" => serde_json::from_value::<InputRichBlockPreformatted>(value)
.map(|value| Self::InputRichBlockPreformatted(Box::new(value)))
.map_err(serde::de::Error::custom),
"pullquote" => serde_json::from_value::<InputRichBlockPullQuotation>(value)
.map(|value| Self::InputRichBlockPullQuotation(Box::new(value)))
.map_err(serde::de::Error::custom),
"heading" => serde_json::from_value::<InputRichBlockSectionHeading>(value)
.map(|value| Self::InputRichBlockSectionHeading(Box::new(value)))
.map_err(serde::de::Error::custom),
"slideshow" => serde_json::from_value::<InputRichBlockSlideshow>(value)
.map(|value| Self::InputRichBlockSlideshow(Box::new(value)))
.map_err(serde::de::Error::custom),
"table" => serde_json::from_value::<InputRichBlockTable>(value)
.map(|value| Self::InputRichBlockTable(Box::new(value)))
.map_err(serde::de::Error::custom),
"thinking" => serde_json::from_value::<InputRichBlockThinking>(value)
.map(|value| Self::InputRichBlockThinking(Box::new(value)))
.map_err(serde::de::Error::custom),
"video" => serde_json::from_value::<InputRichBlockVideo>(value)
.map(|value| Self::InputRichBlockVideo(Box::new(value)))
.map_err(serde::de::Error::custom),
"voice_note" => serde_json::from_value::<InputRichBlockVoiceNote>(value)
.map(|value| Self::InputRichBlockVoiceNote(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for InputRichBlockUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputRichBlockAnchor(value) => value.collect_files(output),
Self::InputRichBlockAnimation(value) => value.collect_files(output),
Self::InputRichBlockAudio(value) => value.collect_files(output),
Self::InputRichBlockBlockQuotation(value) => value.collect_files(output),
Self::InputRichBlockCollage(value) => value.collect_files(output),
Self::InputRichBlockDetails(value) => value.collect_files(output),
Self::InputRichBlockDivider(value) => value.collect_files(output),
Self::InputRichBlockFooter(value) => value.collect_files(output),
Self::InputRichBlockList(value) => value.collect_files(output),
Self::InputRichBlockMap(value) => value.collect_files(output),
Self::InputRichBlockMathematicalExpression(value) => value.collect_files(output),
Self::InputRichBlockParagraph(value) => value.collect_files(output),
Self::InputRichBlockPhoto(value) => value.collect_files(output),
Self::InputRichBlockPreformatted(value) => value.collect_files(output),
Self::InputRichBlockPullQuotation(value) => value.collect_files(output),
Self::InputRichBlockSectionHeading(value) => value.collect_files(output),
Self::InputRichBlockSlideshow(value) => value.collect_files(output),
Self::InputRichBlockTable(value) => value.collect_files(output),
Self::InputRichBlockThinking(value) => value.collect_files(output),
Self::InputRichBlockVideo(value) => value.collect_files(output),
Self::InputRichBlockVoiceNote(value) => value.collect_files(output),
}
}
}
impl From<InputRichBlockAnchor> for InputRichBlockUnion {
fn from(value: InputRichBlockAnchor) -> Self {
Self::InputRichBlockAnchor(Box::new(value))
}
}
impl From<InputRichBlockAnimation> for InputRichBlockUnion {
fn from(value: InputRichBlockAnimation) -> Self {
Self::InputRichBlockAnimation(Box::new(value))
}
}
impl From<InputRichBlockAudio> for InputRichBlockUnion {
fn from(value: InputRichBlockAudio) -> Self {
Self::InputRichBlockAudio(Box::new(value))
}
}
impl From<InputRichBlockBlockQuotation> for InputRichBlockUnion {
fn from(value: InputRichBlockBlockQuotation) -> Self {
Self::InputRichBlockBlockQuotation(Box::new(value))
}
}
impl From<InputRichBlockCollage> for InputRichBlockUnion {
fn from(value: InputRichBlockCollage) -> Self {
Self::InputRichBlockCollage(Box::new(value))
}
}
impl From<InputRichBlockDetails> for InputRichBlockUnion {
fn from(value: InputRichBlockDetails) -> Self {
Self::InputRichBlockDetails(Box::new(value))
}
}
impl From<InputRichBlockDivider> for InputRichBlockUnion {
fn from(value: InputRichBlockDivider) -> Self {
Self::InputRichBlockDivider(Box::new(value))
}
}
impl From<InputRichBlockFooter> for InputRichBlockUnion {
fn from(value: InputRichBlockFooter) -> Self {
Self::InputRichBlockFooter(Box::new(value))
}
}
impl From<InputRichBlockList> for InputRichBlockUnion {
fn from(value: InputRichBlockList) -> Self {
Self::InputRichBlockList(Box::new(value))
}
}
impl From<InputRichBlockMap> for InputRichBlockUnion {
fn from(value: InputRichBlockMap) -> Self {
Self::InputRichBlockMap(Box::new(value))
}
}
impl From<InputRichBlockMathematicalExpression> for InputRichBlockUnion {
fn from(value: InputRichBlockMathematicalExpression) -> Self {
Self::InputRichBlockMathematicalExpression(Box::new(value))
}
}
impl From<InputRichBlockParagraph> for InputRichBlockUnion {
fn from(value: InputRichBlockParagraph) -> Self {
Self::InputRichBlockParagraph(Box::new(value))
}
}
impl From<InputRichBlockPhoto> for InputRichBlockUnion {
fn from(value: InputRichBlockPhoto) -> Self {
Self::InputRichBlockPhoto(Box::new(value))
}
}
impl From<InputRichBlockPreformatted> for InputRichBlockUnion {
fn from(value: InputRichBlockPreformatted) -> Self {
Self::InputRichBlockPreformatted(Box::new(value))
}
}
impl From<InputRichBlockPullQuotation> for InputRichBlockUnion {
fn from(value: InputRichBlockPullQuotation) -> Self {
Self::InputRichBlockPullQuotation(Box::new(value))
}
}
impl From<InputRichBlockSectionHeading> for InputRichBlockUnion {
fn from(value: InputRichBlockSectionHeading) -> Self {
Self::InputRichBlockSectionHeading(Box::new(value))
}
}
impl From<InputRichBlockSlideshow> for InputRichBlockUnion {
fn from(value: InputRichBlockSlideshow) -> Self {
Self::InputRichBlockSlideshow(Box::new(value))
}
}
impl From<InputRichBlockTable> for InputRichBlockUnion {
fn from(value: InputRichBlockTable) -> Self {
Self::InputRichBlockTable(Box::new(value))
}
}
impl From<InputRichBlockThinking> for InputRichBlockUnion {
fn from(value: InputRichBlockThinking) -> Self {
Self::InputRichBlockThinking(Box::new(value))
}
}
impl From<InputRichBlockVideo> for InputRichBlockUnion {
fn from(value: InputRichBlockVideo) -> Self {
Self::InputRichBlockVideo(Box::new(value))
}
}
impl From<InputRichBlockVoiceNote> for InputRichBlockUnion {
fn from(value: InputRichBlockVoiceNote) -> Self {
Self::InputRichBlockVoiceNote(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputRichMessageMediaUnion {
InputMediaAnimation(Box<InputMediaAnimation>),
InputMediaAudio(Box<InputMediaAudio>),
InputMediaPhoto(Box<InputMediaPhoto>),
InputMediaVideo(Box<InputMediaVideo>),
InputMediaVoiceNote(Box<InputMediaVoiceNote>),
}
impl CollectFiles for InputRichMessageMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputMediaAnimation(value) => value.collect_files(output),
Self::InputMediaAudio(value) => value.collect_files(output),
Self::InputMediaPhoto(value) => value.collect_files(output),
Self::InputMediaVideo(value) => value.collect_files(output),
Self::InputMediaVoiceNote(value) => value.collect_files(output),
}
}
}
impl From<InputMediaAnimation> for InputRichMessageMediaUnion {
fn from(value: InputMediaAnimation) -> Self {
Self::InputMediaAnimation(Box::new(value))
}
}
impl From<InputMediaAudio> for InputRichMessageMediaUnion {
fn from(value: InputMediaAudio) -> Self {
Self::InputMediaAudio(Box::new(value))
}
}
impl From<InputMediaPhoto> for InputRichMessageMediaUnion {
fn from(value: InputMediaPhoto) -> Self {
Self::InputMediaPhoto(Box::new(value))
}
}
impl From<InputMediaVideo> for InputRichMessageMediaUnion {
fn from(value: InputMediaVideo) -> Self {
Self::InputMediaVideo(Box::new(value))
}
}
impl From<InputMediaVoiceNote> for InputRichMessageMediaUnion {
fn from(value: InputMediaVoiceNote) -> Self {
Self::InputMediaVoiceNote(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum InputStoryContentUnion {
InputStoryContentPhoto(Box<InputStoryContentPhoto>),
InputStoryContentVideo(Box<InputStoryContentVideo>),
}
impl CollectFiles for InputStoryContentUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputStoryContentPhoto(value) => value.collect_files(output),
Self::InputStoryContentVideo(value) => value.collect_files(output),
}
}
}
impl From<InputStoryContentPhoto> for InputStoryContentUnion {
fn from(value: InputStoryContentPhoto) -> Self {
Self::InputStoryContentPhoto(Box::new(value))
}
}
impl From<InputStoryContentVideo> for InputStoryContentUnion {
fn from(value: InputStoryContentVideo) -> Self {
Self::InputStoryContentVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum MaybeInaccessibleMessageUnion {
InaccessibleMessage(Box<InaccessibleMessage>),
Message(Box<Message>),
}
impl CollectFiles for MaybeInaccessibleMessageUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InaccessibleMessage(value) => value.collect_files(output),
Self::Message(value) => value.collect_files(output),
}
}
}
impl From<InaccessibleMessage> for MaybeInaccessibleMessageUnion {
fn from(value: InaccessibleMessage) -> Self {
Self::InaccessibleMessage(Box::new(value))
}
}
impl From<Message> for MaybeInaccessibleMessageUnion {
fn from(value: Message) -> Self {
Self::Message(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum MediaUnion {
InputMediaAudio(Box<InputMediaAudio>),
InputMediaDocument(Box<InputMediaDocument>),
InputMediaLivePhoto(Box<InputMediaLivePhoto>),
InputMediaPhoto(Box<InputMediaPhoto>),
InputMediaVideo(Box<InputMediaVideo>),
}
impl CollectFiles for MediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::InputMediaAudio(value) => value.collect_files(output),
Self::InputMediaDocument(value) => value.collect_files(output),
Self::InputMediaLivePhoto(value) => value.collect_files(output),
Self::InputMediaPhoto(value) => value.collect_files(output),
Self::InputMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<InputMediaAudio> for MediaUnion {
fn from(value: InputMediaAudio) -> Self {
Self::InputMediaAudio(Box::new(value))
}
}
impl From<InputMediaDocument> for MediaUnion {
fn from(value: InputMediaDocument) -> Self {
Self::InputMediaDocument(Box::new(value))
}
}
impl From<InputMediaLivePhoto> for MediaUnion {
fn from(value: InputMediaLivePhoto) -> Self {
Self::InputMediaLivePhoto(Box::new(value))
}
}
impl From<InputMediaPhoto> for MediaUnion {
fn from(value: InputMediaPhoto) -> Self {
Self::InputMediaPhoto(Box::new(value))
}
}
impl From<InputMediaVideo> for MediaUnion {
fn from(value: InputMediaVideo) -> Self {
Self::InputMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum MenuButtonUnion {
MenuButtonCommands(Box<MenuButtonCommands>),
MenuButtonDefault(Box<MenuButtonDefault>),
MenuButtonWebApp(Box<MenuButtonWebApp>),
}
impl CollectFiles for MenuButtonUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::MenuButtonCommands(value) => value.collect_files(output),
Self::MenuButtonDefault(value) => value.collect_files(output),
Self::MenuButtonWebApp(value) => value.collect_files(output),
}
}
}
impl From<MenuButtonCommands> for MenuButtonUnion {
fn from(value: MenuButtonCommands) -> Self {
Self::MenuButtonCommands(Box::new(value))
}
}
impl From<MenuButtonDefault> for MenuButtonUnion {
fn from(value: MenuButtonDefault) -> Self {
Self::MenuButtonDefault(Box::new(value))
}
}
impl From<MenuButtonWebApp> for MenuButtonUnion {
fn from(value: MenuButtonWebApp) -> Self {
Self::MenuButtonWebApp(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum MessageOriginUnion {
MessageOriginChannel(Box<MessageOriginChannel>),
MessageOriginChat(Box<MessageOriginChat>),
MessageOriginHiddenUser(Box<MessageOriginHiddenUser>),
MessageOriginUser(Box<MessageOriginUser>),
}
impl Serialize for MessageOriginUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::MessageOriginChannel(value) => value.serialize(serializer),
Self::MessageOriginChat(value) => value.serialize(serializer),
Self::MessageOriginHiddenUser(value) => value.serialize(serializer),
Self::MessageOriginUser(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for MessageOriginUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"channel" => serde_json::from_value::<MessageOriginChannel>(value)
.map(|value| Self::MessageOriginChannel(Box::new(value)))
.map_err(serde::de::Error::custom),
"chat" => serde_json::from_value::<MessageOriginChat>(value)
.map(|value| Self::MessageOriginChat(Box::new(value)))
.map_err(serde::de::Error::custom),
"hidden_user" => serde_json::from_value::<MessageOriginHiddenUser>(value)
.map(|value| Self::MessageOriginHiddenUser(Box::new(value)))
.map_err(serde::de::Error::custom),
"user" => serde_json::from_value::<MessageOriginUser>(value)
.map(|value| Self::MessageOriginUser(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for MessageOriginUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::MessageOriginChannel(value) => value.collect_files(output),
Self::MessageOriginChat(value) => value.collect_files(output),
Self::MessageOriginHiddenUser(value) => value.collect_files(output),
Self::MessageOriginUser(value) => value.collect_files(output),
}
}
}
impl From<MessageOriginChannel> for MessageOriginUnion {
fn from(value: MessageOriginChannel) -> Self {
Self::MessageOriginChannel(Box::new(value))
}
}
impl From<MessageOriginChat> for MessageOriginUnion {
fn from(value: MessageOriginChat) -> Self {
Self::MessageOriginChat(Box::new(value))
}
}
impl From<MessageOriginHiddenUser> for MessageOriginUnion {
fn from(value: MessageOriginHiddenUser) -> Self {
Self::MessageOriginHiddenUser(Box::new(value))
}
}
impl From<MessageOriginUser> for MessageOriginUnion {
fn from(value: MessageOriginUser) -> Self {
Self::MessageOriginUser(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum OwnedGiftUnion {
OwnedGiftRegular(Box<OwnedGiftRegular>),
OwnedGiftUnique(Box<OwnedGiftUnique>),
}
impl Serialize for OwnedGiftUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::OwnedGiftRegular(value) => value.serialize(serializer),
Self::OwnedGiftUnique(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for OwnedGiftUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"regular" => serde_json::from_value::<OwnedGiftRegular>(value)
.map(|value| Self::OwnedGiftRegular(Box::new(value)))
.map_err(serde::de::Error::custom),
"unique" => serde_json::from_value::<OwnedGiftUnique>(value)
.map(|value| Self::OwnedGiftUnique(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for OwnedGiftUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::OwnedGiftRegular(value) => value.collect_files(output),
Self::OwnedGiftUnique(value) => value.collect_files(output),
}
}
}
impl From<OwnedGiftRegular> for OwnedGiftUnion {
fn from(value: OwnedGiftRegular) -> Self {
Self::OwnedGiftRegular(Box::new(value))
}
}
impl From<OwnedGiftUnique> for OwnedGiftUnion {
fn from(value: OwnedGiftUnique) -> Self {
Self::OwnedGiftUnique(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum PaidMediaUnion {
PaidMediaLivePhoto(Box<PaidMediaLivePhoto>),
PaidMediaPhoto(Box<PaidMediaPhoto>),
PaidMediaPreview(Box<PaidMediaPreview>),
PaidMediaVideo(Box<PaidMediaVideo>),
}
impl Serialize for PaidMediaUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::PaidMediaLivePhoto(value) => value.serialize(serializer),
Self::PaidMediaPhoto(value) => value.serialize(serializer),
Self::PaidMediaPreview(value) => value.serialize(serializer),
Self::PaidMediaVideo(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for PaidMediaUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"live_photo" => serde_json::from_value::<PaidMediaLivePhoto>(value)
.map(|value| Self::PaidMediaLivePhoto(Box::new(value)))
.map_err(serde::de::Error::custom),
"photo" => serde_json::from_value::<PaidMediaPhoto>(value)
.map(|value| Self::PaidMediaPhoto(Box::new(value)))
.map_err(serde::de::Error::custom),
"preview" => serde_json::from_value::<PaidMediaPreview>(value)
.map(|value| Self::PaidMediaPreview(Box::new(value)))
.map_err(serde::de::Error::custom),
"video" => serde_json::from_value::<PaidMediaVideo>(value)
.map(|value| Self::PaidMediaVideo(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for PaidMediaUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::PaidMediaLivePhoto(value) => value.collect_files(output),
Self::PaidMediaPhoto(value) => value.collect_files(output),
Self::PaidMediaPreview(value) => value.collect_files(output),
Self::PaidMediaVideo(value) => value.collect_files(output),
}
}
}
impl From<PaidMediaLivePhoto> for PaidMediaUnion {
fn from(value: PaidMediaLivePhoto) -> Self {
Self::PaidMediaLivePhoto(Box::new(value))
}
}
impl From<PaidMediaPhoto> for PaidMediaUnion {
fn from(value: PaidMediaPhoto) -> Self {
Self::PaidMediaPhoto(Box::new(value))
}
}
impl From<PaidMediaPreview> for PaidMediaUnion {
fn from(value: PaidMediaPreview) -> Self {
Self::PaidMediaPreview(Box::new(value))
}
}
impl From<PaidMediaVideo> for PaidMediaUnion {
fn from(value: PaidMediaVideo) -> Self {
Self::PaidMediaVideo(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum PassportElementErrorUnion {
PassportElementErrorDataField(Box<PassportElementErrorDataField>),
PassportElementErrorFile(Box<PassportElementErrorFile>),
PassportElementErrorFiles(Box<PassportElementErrorFiles>),
PassportElementErrorFrontSide(Box<PassportElementErrorFrontSide>),
PassportElementErrorReverseSide(Box<PassportElementErrorReverseSide>),
PassportElementErrorSelfie(Box<PassportElementErrorSelfie>),
PassportElementErrorTranslationFile(Box<PassportElementErrorTranslationFile>),
PassportElementErrorTranslationFiles(Box<PassportElementErrorTranslationFiles>),
PassportElementErrorUnspecified(Box<PassportElementErrorUnspecified>),
}
impl CollectFiles for PassportElementErrorUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::PassportElementErrorDataField(value) => value.collect_files(output),
Self::PassportElementErrorFile(value) => value.collect_files(output),
Self::PassportElementErrorFiles(value) => value.collect_files(output),
Self::PassportElementErrorFrontSide(value) => value.collect_files(output),
Self::PassportElementErrorReverseSide(value) => value.collect_files(output),
Self::PassportElementErrorSelfie(value) => value.collect_files(output),
Self::PassportElementErrorTranslationFile(value) => value.collect_files(output),
Self::PassportElementErrorTranslationFiles(value) => value.collect_files(output),
Self::PassportElementErrorUnspecified(value) => value.collect_files(output),
}
}
}
impl From<PassportElementErrorDataField> for PassportElementErrorUnion {
fn from(value: PassportElementErrorDataField) -> Self {
Self::PassportElementErrorDataField(Box::new(value))
}
}
impl From<PassportElementErrorFile> for PassportElementErrorUnion {
fn from(value: PassportElementErrorFile) -> Self {
Self::PassportElementErrorFile(Box::new(value))
}
}
impl From<PassportElementErrorFiles> for PassportElementErrorUnion {
fn from(value: PassportElementErrorFiles) -> Self {
Self::PassportElementErrorFiles(Box::new(value))
}
}
impl From<PassportElementErrorFrontSide> for PassportElementErrorUnion {
fn from(value: PassportElementErrorFrontSide) -> Self {
Self::PassportElementErrorFrontSide(Box::new(value))
}
}
impl From<PassportElementErrorReverseSide> for PassportElementErrorUnion {
fn from(value: PassportElementErrorReverseSide) -> Self {
Self::PassportElementErrorReverseSide(Box::new(value))
}
}
impl From<PassportElementErrorSelfie> for PassportElementErrorUnion {
fn from(value: PassportElementErrorSelfie) -> Self {
Self::PassportElementErrorSelfie(Box::new(value))
}
}
impl From<PassportElementErrorTranslationFile> for PassportElementErrorUnion {
fn from(value: PassportElementErrorTranslationFile) -> Self {
Self::PassportElementErrorTranslationFile(Box::new(value))
}
}
impl From<PassportElementErrorTranslationFiles> for PassportElementErrorUnion {
fn from(value: PassportElementErrorTranslationFiles) -> Self {
Self::PassportElementErrorTranslationFiles(Box::new(value))
}
}
impl From<PassportElementErrorUnspecified> for PassportElementErrorUnion {
fn from(value: PassportElementErrorUnspecified) -> Self {
Self::PassportElementErrorUnspecified(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ReactionTypeUnion {
ReactionTypeCustomEmoji(Box<ReactionTypeCustomEmoji>),
ReactionTypeEmoji(Box<ReactionTypeEmoji>),
ReactionTypePaid(Box<ReactionTypePaid>),
}
impl Serialize for ReactionTypeUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::ReactionTypeCustomEmoji(value) => value.serialize(serializer),
Self::ReactionTypeEmoji(value) => value.serialize(serializer),
Self::ReactionTypePaid(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for ReactionTypeUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"custom_emoji" => serde_json::from_value::<ReactionTypeCustomEmoji>(value)
.map(|value| Self::ReactionTypeCustomEmoji(Box::new(value)))
.map_err(serde::de::Error::custom),
"emoji" => serde_json::from_value::<ReactionTypeEmoji>(value)
.map(|value| Self::ReactionTypeEmoji(Box::new(value)))
.map_err(serde::de::Error::custom),
"paid" => serde_json::from_value::<ReactionTypePaid>(value)
.map(|value| Self::ReactionTypePaid(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for ReactionTypeUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::ReactionTypeCustomEmoji(value) => value.collect_files(output),
Self::ReactionTypeEmoji(value) => value.collect_files(output),
Self::ReactionTypePaid(value) => value.collect_files(output),
}
}
}
impl From<ReactionTypeCustomEmoji> for ReactionTypeUnion {
fn from(value: ReactionTypeCustomEmoji) -> Self {
Self::ReactionTypeCustomEmoji(Box::new(value))
}
}
impl From<ReactionTypeEmoji> for ReactionTypeUnion {
fn from(value: ReactionTypeEmoji) -> Self {
Self::ReactionTypeEmoji(Box::new(value))
}
}
impl From<ReactionTypePaid> for ReactionTypeUnion {
fn from(value: ReactionTypePaid) -> Self {
Self::ReactionTypePaid(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum ReplyMarkupUnion {
ForceReply(Box<ForceReply>),
InlineKeyboardMarkup(Box<InlineKeyboardMarkup>),
ReplyKeyboardMarkup(Box<ReplyKeyboardMarkup>),
ReplyKeyboardRemove(Box<ReplyKeyboardRemove>),
}
impl CollectFiles for ReplyMarkupUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::ForceReply(value) => value.collect_files(output),
Self::InlineKeyboardMarkup(value) => value.collect_files(output),
Self::ReplyKeyboardMarkup(value) => value.collect_files(output),
Self::ReplyKeyboardRemove(value) => value.collect_files(output),
}
}
}
impl From<ForceReply> for ReplyMarkupUnion {
fn from(value: ForceReply) -> Self {
Self::ForceReply(Box::new(value))
}
}
impl From<InlineKeyboardMarkup> for ReplyMarkupUnion {
fn from(value: InlineKeyboardMarkup) -> Self {
Self::InlineKeyboardMarkup(Box::new(value))
}
}
impl From<ReplyKeyboardMarkup> for ReplyMarkupUnion {
fn from(value: ReplyKeyboardMarkup) -> Self {
Self::ReplyKeyboardMarkup(Box::new(value))
}
}
impl From<ReplyKeyboardRemove> for ReplyMarkupUnion {
fn from(value: ReplyKeyboardRemove) -> Self {
Self::ReplyKeyboardRemove(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum ResultChatMemberUnion {
ChatMemberAdministrator(Box<ChatMemberAdministrator>),
ChatMemberBanned(Box<ChatMemberBanned>),
ChatMemberLeft(Box<ChatMemberLeft>),
ChatMemberMember(Box<ChatMemberMember>),
ChatMemberOwner(Box<ChatMemberOwner>),
ChatMemberRestricted(Box<ChatMemberRestricted>),
}
impl Serialize for ResultChatMemberUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::ChatMemberAdministrator(value) => value.serialize(serializer),
Self::ChatMemberBanned(value) => value.serialize(serializer),
Self::ChatMemberLeft(value) => value.serialize(serializer),
Self::ChatMemberMember(value) => value.serialize(serializer),
Self::ChatMemberOwner(value) => value.serialize(serializer),
Self::ChatMemberRestricted(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for ResultChatMemberUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("status")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"administrator" => serde_json::from_value::<ChatMemberAdministrator>(value)
.map(|value| Self::ChatMemberAdministrator(Box::new(value)))
.map_err(serde::de::Error::custom),
"kicked" => serde_json::from_value::<ChatMemberBanned>(value)
.map(|value| Self::ChatMemberBanned(Box::new(value)))
.map_err(serde::de::Error::custom),
"left" => serde_json::from_value::<ChatMemberLeft>(value)
.map(|value| Self::ChatMemberLeft(Box::new(value)))
.map_err(serde::de::Error::custom),
"member" => serde_json::from_value::<ChatMemberMember>(value)
.map(|value| Self::ChatMemberMember(Box::new(value)))
.map_err(serde::de::Error::custom),
"creator" => serde_json::from_value::<ChatMemberOwner>(value)
.map(|value| Self::ChatMemberOwner(Box::new(value)))
.map_err(serde::de::Error::custom),
"restricted" => serde_json::from_value::<ChatMemberRestricted>(value)
.map(|value| Self::ChatMemberRestricted(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for ResultChatMemberUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::ChatMemberAdministrator(value) => value.collect_files(output),
Self::ChatMemberBanned(value) => value.collect_files(output),
Self::ChatMemberLeft(value) => value.collect_files(output),
Self::ChatMemberMember(value) => value.collect_files(output),
Self::ChatMemberOwner(value) => value.collect_files(output),
Self::ChatMemberRestricted(value) => value.collect_files(output),
}
}
}
impl From<ChatMemberAdministrator> for ResultChatMemberUnion {
fn from(value: ChatMemberAdministrator) -> Self {
Self::ChatMemberAdministrator(Box::new(value))
}
}
impl From<ChatMemberBanned> for ResultChatMemberUnion {
fn from(value: ChatMemberBanned) -> Self {
Self::ChatMemberBanned(Box::new(value))
}
}
impl From<ChatMemberLeft> for ResultChatMemberUnion {
fn from(value: ChatMemberLeft) -> Self {
Self::ChatMemberLeft(Box::new(value))
}
}
impl From<ChatMemberMember> for ResultChatMemberUnion {
fn from(value: ChatMemberMember) -> Self {
Self::ChatMemberMember(Box::new(value))
}
}
impl From<ChatMemberOwner> for ResultChatMemberUnion {
fn from(value: ChatMemberOwner) -> Self {
Self::ChatMemberOwner(Box::new(value))
}
}
impl From<ChatMemberRestricted> for ResultChatMemberUnion {
fn from(value: ChatMemberRestricted) -> Self {
Self::ChatMemberRestricted(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum ResultMenuButtonUnion {
MenuButtonCommands(Box<MenuButtonCommands>),
MenuButtonDefault(Box<MenuButtonDefault>),
MenuButtonWebApp(Box<MenuButtonWebApp>),
}
impl CollectFiles for ResultMenuButtonUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::MenuButtonCommands(value) => value.collect_files(output),
Self::MenuButtonDefault(value) => value.collect_files(output),
Self::MenuButtonWebApp(value) => value.collect_files(output),
}
}
}
impl From<MenuButtonCommands> for ResultMenuButtonUnion {
fn from(value: MenuButtonCommands) -> Self {
Self::MenuButtonCommands(Box::new(value))
}
}
impl From<MenuButtonDefault> for ResultMenuButtonUnion {
fn from(value: MenuButtonDefault) -> Self {
Self::MenuButtonDefault(Box::new(value))
}
}
impl From<MenuButtonWebApp> for ResultMenuButtonUnion {
fn from(value: MenuButtonWebApp) -> Self {
Self::MenuButtonWebApp(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum RevenueWithdrawalStateUnion {
RevenueWithdrawalStateFailed(Box<RevenueWithdrawalStateFailed>),
RevenueWithdrawalStatePending(Box<RevenueWithdrawalStatePending>),
RevenueWithdrawalStateSucceeded(Box<RevenueWithdrawalStateSucceeded>),
}
impl Serialize for RevenueWithdrawalStateUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::RevenueWithdrawalStateFailed(value) => value.serialize(serializer),
Self::RevenueWithdrawalStatePending(value) => value.serialize(serializer),
Self::RevenueWithdrawalStateSucceeded(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for RevenueWithdrawalStateUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"failed" => serde_json::from_value::<RevenueWithdrawalStateFailed>(value)
.map(|value| Self::RevenueWithdrawalStateFailed(Box::new(value)))
.map_err(serde::de::Error::custom),
"pending" => serde_json::from_value::<RevenueWithdrawalStatePending>(value)
.map(|value| Self::RevenueWithdrawalStatePending(Box::new(value)))
.map_err(serde::de::Error::custom),
"succeeded" => serde_json::from_value::<RevenueWithdrawalStateSucceeded>(value)
.map(|value| Self::RevenueWithdrawalStateSucceeded(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for RevenueWithdrawalStateUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::RevenueWithdrawalStateFailed(value) => value.collect_files(output),
Self::RevenueWithdrawalStatePending(value) => value.collect_files(output),
Self::RevenueWithdrawalStateSucceeded(value) => value.collect_files(output),
}
}
}
impl From<RevenueWithdrawalStateFailed> for RevenueWithdrawalStateUnion {
fn from(value: RevenueWithdrawalStateFailed) -> Self {
Self::RevenueWithdrawalStateFailed(Box::new(value))
}
}
impl From<RevenueWithdrawalStatePending> for RevenueWithdrawalStateUnion {
fn from(value: RevenueWithdrawalStatePending) -> Self {
Self::RevenueWithdrawalStatePending(Box::new(value))
}
}
impl From<RevenueWithdrawalStateSucceeded> for RevenueWithdrawalStateUnion {
fn from(value: RevenueWithdrawalStateSucceeded) -> Self {
Self::RevenueWithdrawalStateSucceeded(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum RichBlockUnion {
RichBlockAnchor(Box<RichBlockAnchor>),
RichBlockAnimation(Box<RichBlockAnimation>),
RichBlockAudio(Box<RichBlockAudio>),
RichBlockBlockQuotation(Box<RichBlockBlockQuotation>),
RichBlockCollage(Box<RichBlockCollage>),
RichBlockDetails(Box<RichBlockDetails>),
RichBlockDivider(Box<RichBlockDivider>),
RichBlockFooter(Box<RichBlockFooter>),
RichBlockList(Box<RichBlockList>),
RichBlockMap(Box<RichBlockMap>),
RichBlockMathematicalExpression(Box<RichBlockMathematicalExpression>),
RichBlockParagraph(Box<RichBlockParagraph>),
RichBlockPhoto(Box<RichBlockPhoto>),
RichBlockPreformatted(Box<RichBlockPreformatted>),
RichBlockPullQuotation(Box<RichBlockPullQuotation>),
RichBlockSectionHeading(Box<RichBlockSectionHeading>),
RichBlockSlideshow(Box<RichBlockSlideshow>),
RichBlockTable(Box<RichBlockTable>),
RichBlockThinking(Box<RichBlockThinking>),
RichBlockVideo(Box<RichBlockVideo>),
RichBlockVoiceNote(Box<RichBlockVoiceNote>),
}
impl Serialize for RichBlockUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::RichBlockAnchor(value) => value.serialize(serializer),
Self::RichBlockAnimation(value) => value.serialize(serializer),
Self::RichBlockAudio(value) => value.serialize(serializer),
Self::RichBlockBlockQuotation(value) => value.serialize(serializer),
Self::RichBlockCollage(value) => value.serialize(serializer),
Self::RichBlockDetails(value) => value.serialize(serializer),
Self::RichBlockDivider(value) => value.serialize(serializer),
Self::RichBlockFooter(value) => value.serialize(serializer),
Self::RichBlockList(value) => value.serialize(serializer),
Self::RichBlockMap(value) => value.serialize(serializer),
Self::RichBlockMathematicalExpression(value) => value.serialize(serializer),
Self::RichBlockParagraph(value) => value.serialize(serializer),
Self::RichBlockPhoto(value) => value.serialize(serializer),
Self::RichBlockPreformatted(value) => value.serialize(serializer),
Self::RichBlockPullQuotation(value) => value.serialize(serializer),
Self::RichBlockSectionHeading(value) => value.serialize(serializer),
Self::RichBlockSlideshow(value) => value.serialize(serializer),
Self::RichBlockTable(value) => value.serialize(serializer),
Self::RichBlockThinking(value) => value.serialize(serializer),
Self::RichBlockVideo(value) => value.serialize(serializer),
Self::RichBlockVoiceNote(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for RichBlockUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"anchor" => serde_json::from_value::<RichBlockAnchor>(value)
.map(|value| Self::RichBlockAnchor(Box::new(value)))
.map_err(serde::de::Error::custom),
"animation" => serde_json::from_value::<RichBlockAnimation>(value)
.map(|value| Self::RichBlockAnimation(Box::new(value)))
.map_err(serde::de::Error::custom),
"audio" => serde_json::from_value::<RichBlockAudio>(value)
.map(|value| Self::RichBlockAudio(Box::new(value)))
.map_err(serde::de::Error::custom),
"blockquote" => serde_json::from_value::<RichBlockBlockQuotation>(value)
.map(|value| Self::RichBlockBlockQuotation(Box::new(value)))
.map_err(serde::de::Error::custom),
"collage" => serde_json::from_value::<RichBlockCollage>(value)
.map(|value| Self::RichBlockCollage(Box::new(value)))
.map_err(serde::de::Error::custom),
"details" => serde_json::from_value::<RichBlockDetails>(value)
.map(|value| Self::RichBlockDetails(Box::new(value)))
.map_err(serde::de::Error::custom),
"divider" => serde_json::from_value::<RichBlockDivider>(value)
.map(|value| Self::RichBlockDivider(Box::new(value)))
.map_err(serde::de::Error::custom),
"footer" => serde_json::from_value::<RichBlockFooter>(value)
.map(|value| Self::RichBlockFooter(Box::new(value)))
.map_err(serde::de::Error::custom),
"list" => serde_json::from_value::<RichBlockList>(value)
.map(|value| Self::RichBlockList(Box::new(value)))
.map_err(serde::de::Error::custom),
"map" => serde_json::from_value::<RichBlockMap>(value)
.map(|value| Self::RichBlockMap(Box::new(value)))
.map_err(serde::de::Error::custom),
"mathematical_expression" => {
serde_json::from_value::<RichBlockMathematicalExpression>(value)
.map(|value| Self::RichBlockMathematicalExpression(Box::new(value)))
.map_err(serde::de::Error::custom)
}
"paragraph" => serde_json::from_value::<RichBlockParagraph>(value)
.map(|value| Self::RichBlockParagraph(Box::new(value)))
.map_err(serde::de::Error::custom),
"photo" => serde_json::from_value::<RichBlockPhoto>(value)
.map(|value| Self::RichBlockPhoto(Box::new(value)))
.map_err(serde::de::Error::custom),
"pre" => serde_json::from_value::<RichBlockPreformatted>(value)
.map(|value| Self::RichBlockPreformatted(Box::new(value)))
.map_err(serde::de::Error::custom),
"pullquote" => serde_json::from_value::<RichBlockPullQuotation>(value)
.map(|value| Self::RichBlockPullQuotation(Box::new(value)))
.map_err(serde::de::Error::custom),
"heading" => serde_json::from_value::<RichBlockSectionHeading>(value)
.map(|value| Self::RichBlockSectionHeading(Box::new(value)))
.map_err(serde::de::Error::custom),
"slideshow" => serde_json::from_value::<RichBlockSlideshow>(value)
.map(|value| Self::RichBlockSlideshow(Box::new(value)))
.map_err(serde::de::Error::custom),
"table" => serde_json::from_value::<RichBlockTable>(value)
.map(|value| Self::RichBlockTable(Box::new(value)))
.map_err(serde::de::Error::custom),
"thinking" => serde_json::from_value::<RichBlockThinking>(value)
.map(|value| Self::RichBlockThinking(Box::new(value)))
.map_err(serde::de::Error::custom),
"video" => serde_json::from_value::<RichBlockVideo>(value)
.map(|value| Self::RichBlockVideo(Box::new(value)))
.map_err(serde::de::Error::custom),
"voice_note" => serde_json::from_value::<RichBlockVoiceNote>(value)
.map(|value| Self::RichBlockVoiceNote(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for RichBlockUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::RichBlockAnchor(value) => value.collect_files(output),
Self::RichBlockAnimation(value) => value.collect_files(output),
Self::RichBlockAudio(value) => value.collect_files(output),
Self::RichBlockBlockQuotation(value) => value.collect_files(output),
Self::RichBlockCollage(value) => value.collect_files(output),
Self::RichBlockDetails(value) => value.collect_files(output),
Self::RichBlockDivider(value) => value.collect_files(output),
Self::RichBlockFooter(value) => value.collect_files(output),
Self::RichBlockList(value) => value.collect_files(output),
Self::RichBlockMap(value) => value.collect_files(output),
Self::RichBlockMathematicalExpression(value) => value.collect_files(output),
Self::RichBlockParagraph(value) => value.collect_files(output),
Self::RichBlockPhoto(value) => value.collect_files(output),
Self::RichBlockPreformatted(value) => value.collect_files(output),
Self::RichBlockPullQuotation(value) => value.collect_files(output),
Self::RichBlockSectionHeading(value) => value.collect_files(output),
Self::RichBlockSlideshow(value) => value.collect_files(output),
Self::RichBlockTable(value) => value.collect_files(output),
Self::RichBlockThinking(value) => value.collect_files(output),
Self::RichBlockVideo(value) => value.collect_files(output),
Self::RichBlockVoiceNote(value) => value.collect_files(output),
}
}
}
impl From<RichBlockAnchor> for RichBlockUnion {
fn from(value: RichBlockAnchor) -> Self {
Self::RichBlockAnchor(Box::new(value))
}
}
impl From<RichBlockAnimation> for RichBlockUnion {
fn from(value: RichBlockAnimation) -> Self {
Self::RichBlockAnimation(Box::new(value))
}
}
impl From<RichBlockAudio> for RichBlockUnion {
fn from(value: RichBlockAudio) -> Self {
Self::RichBlockAudio(Box::new(value))
}
}
impl From<RichBlockBlockQuotation> for RichBlockUnion {
fn from(value: RichBlockBlockQuotation) -> Self {
Self::RichBlockBlockQuotation(Box::new(value))
}
}
impl From<RichBlockCollage> for RichBlockUnion {
fn from(value: RichBlockCollage) -> Self {
Self::RichBlockCollage(Box::new(value))
}
}
impl From<RichBlockDetails> for RichBlockUnion {
fn from(value: RichBlockDetails) -> Self {
Self::RichBlockDetails(Box::new(value))
}
}
impl From<RichBlockDivider> for RichBlockUnion {
fn from(value: RichBlockDivider) -> Self {
Self::RichBlockDivider(Box::new(value))
}
}
impl From<RichBlockFooter> for RichBlockUnion {
fn from(value: RichBlockFooter) -> Self {
Self::RichBlockFooter(Box::new(value))
}
}
impl From<RichBlockList> for RichBlockUnion {
fn from(value: RichBlockList) -> Self {
Self::RichBlockList(Box::new(value))
}
}
impl From<RichBlockMap> for RichBlockUnion {
fn from(value: RichBlockMap) -> Self {
Self::RichBlockMap(Box::new(value))
}
}
impl From<RichBlockMathematicalExpression> for RichBlockUnion {
fn from(value: RichBlockMathematicalExpression) -> Self {
Self::RichBlockMathematicalExpression(Box::new(value))
}
}
impl From<RichBlockParagraph> for RichBlockUnion {
fn from(value: RichBlockParagraph) -> Self {
Self::RichBlockParagraph(Box::new(value))
}
}
impl From<RichBlockPhoto> for RichBlockUnion {
fn from(value: RichBlockPhoto) -> Self {
Self::RichBlockPhoto(Box::new(value))
}
}
impl From<RichBlockPreformatted> for RichBlockUnion {
fn from(value: RichBlockPreformatted) -> Self {
Self::RichBlockPreformatted(Box::new(value))
}
}
impl From<RichBlockPullQuotation> for RichBlockUnion {
fn from(value: RichBlockPullQuotation) -> Self {
Self::RichBlockPullQuotation(Box::new(value))
}
}
impl From<RichBlockSectionHeading> for RichBlockUnion {
fn from(value: RichBlockSectionHeading) -> Self {
Self::RichBlockSectionHeading(Box::new(value))
}
}
impl From<RichBlockSlideshow> for RichBlockUnion {
fn from(value: RichBlockSlideshow) -> Self {
Self::RichBlockSlideshow(Box::new(value))
}
}
impl From<RichBlockTable> for RichBlockUnion {
fn from(value: RichBlockTable) -> Self {
Self::RichBlockTable(Box::new(value))
}
}
impl From<RichBlockThinking> for RichBlockUnion {
fn from(value: RichBlockThinking) -> Self {
Self::RichBlockThinking(Box::new(value))
}
}
impl From<RichBlockVideo> for RichBlockUnion {
fn from(value: RichBlockVideo) -> Self {
Self::RichBlockVideo(Box::new(value))
}
}
impl From<RichBlockVoiceNote> for RichBlockUnion {
fn from(value: RichBlockVoiceNote) -> Self {
Self::RichBlockVoiceNote(Box::new(value))
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum RichTextUnion {
Text(String),
List(Vec<RichTextUnion>),
RichTextAnchor(Box<RichTextAnchor>),
RichTextAnchorLink(Box<RichTextAnchorLink>),
RichTextBankCardNumber(Box<RichTextBankCardNumber>),
RichTextBold(Box<RichTextBold>),
RichTextBotCommand(Box<RichTextBotCommand>),
RichTextCashtag(Box<RichTextCashtag>),
RichTextCode(Box<RichTextCode>),
RichTextCustomEmoji(Box<RichTextCustomEmoji>),
RichTextDateTime(Box<RichTextDateTime>),
RichTextEmailAddress(Box<RichTextEmailAddress>),
RichTextHashtag(Box<RichTextHashtag>),
RichTextItalic(Box<RichTextItalic>),
RichTextMarked(Box<RichTextMarked>),
RichTextMathematicalExpression(Box<RichTextMathematicalExpression>),
RichTextMention(Box<RichTextMention>),
RichTextPhoneNumber(Box<RichTextPhoneNumber>),
RichTextReference(Box<RichTextReference>),
RichTextReferenceLink(Box<RichTextReferenceLink>),
RichTextSpoiler(Box<RichTextSpoiler>),
RichTextStrikethrough(Box<RichTextStrikethrough>),
RichTextSubscript(Box<RichTextSubscript>),
RichTextSuperscript(Box<RichTextSuperscript>),
RichTextTextMention(Box<RichTextTextMention>),
RichTextUnderline(Box<RichTextUnderline>),
RichTextUrl(Box<RichTextUrl>),
}
impl CollectFiles for RichTextUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::Text(value) => value.collect_files(output),
Self::List(value) => value.collect_files(output),
Self::RichTextAnchor(value) => value.collect_files(output),
Self::RichTextAnchorLink(value) => value.collect_files(output),
Self::RichTextBankCardNumber(value) => value.collect_files(output),
Self::RichTextBold(value) => value.collect_files(output),
Self::RichTextBotCommand(value) => value.collect_files(output),
Self::RichTextCashtag(value) => value.collect_files(output),
Self::RichTextCode(value) => value.collect_files(output),
Self::RichTextCustomEmoji(value) => value.collect_files(output),
Self::RichTextDateTime(value) => value.collect_files(output),
Self::RichTextEmailAddress(value) => value.collect_files(output),
Self::RichTextHashtag(value) => value.collect_files(output),
Self::RichTextItalic(value) => value.collect_files(output),
Self::RichTextMarked(value) => value.collect_files(output),
Self::RichTextMathematicalExpression(value) => value.collect_files(output),
Self::RichTextMention(value) => value.collect_files(output),
Self::RichTextPhoneNumber(value) => value.collect_files(output),
Self::RichTextReference(value) => value.collect_files(output),
Self::RichTextReferenceLink(value) => value.collect_files(output),
Self::RichTextSpoiler(value) => value.collect_files(output),
Self::RichTextStrikethrough(value) => value.collect_files(output),
Self::RichTextSubscript(value) => value.collect_files(output),
Self::RichTextSuperscript(value) => value.collect_files(output),
Self::RichTextTextMention(value) => value.collect_files(output),
Self::RichTextUnderline(value) => value.collect_files(output),
Self::RichTextUrl(value) => value.collect_files(output),
}
}
}
impl From<RichTextAnchor> for RichTextUnion {
fn from(value: RichTextAnchor) -> Self {
Self::RichTextAnchor(Box::new(value))
}
}
impl From<RichTextAnchorLink> for RichTextUnion {
fn from(value: RichTextAnchorLink) -> Self {
Self::RichTextAnchorLink(Box::new(value))
}
}
impl From<RichTextBankCardNumber> for RichTextUnion {
fn from(value: RichTextBankCardNumber) -> Self {
Self::RichTextBankCardNumber(Box::new(value))
}
}
impl From<RichTextBold> for RichTextUnion {
fn from(value: RichTextBold) -> Self {
Self::RichTextBold(Box::new(value))
}
}
impl From<RichTextBotCommand> for RichTextUnion {
fn from(value: RichTextBotCommand) -> Self {
Self::RichTextBotCommand(Box::new(value))
}
}
impl From<RichTextCashtag> for RichTextUnion {
fn from(value: RichTextCashtag) -> Self {
Self::RichTextCashtag(Box::new(value))
}
}
impl From<RichTextCode> for RichTextUnion {
fn from(value: RichTextCode) -> Self {
Self::RichTextCode(Box::new(value))
}
}
impl From<RichTextCustomEmoji> for RichTextUnion {
fn from(value: RichTextCustomEmoji) -> Self {
Self::RichTextCustomEmoji(Box::new(value))
}
}
impl From<RichTextDateTime> for RichTextUnion {
fn from(value: RichTextDateTime) -> Self {
Self::RichTextDateTime(Box::new(value))
}
}
impl From<RichTextEmailAddress> for RichTextUnion {
fn from(value: RichTextEmailAddress) -> Self {
Self::RichTextEmailAddress(Box::new(value))
}
}
impl From<RichTextHashtag> for RichTextUnion {
fn from(value: RichTextHashtag) -> Self {
Self::RichTextHashtag(Box::new(value))
}
}
impl From<RichTextItalic> for RichTextUnion {
fn from(value: RichTextItalic) -> Self {
Self::RichTextItalic(Box::new(value))
}
}
impl From<RichTextMarked> for RichTextUnion {
fn from(value: RichTextMarked) -> Self {
Self::RichTextMarked(Box::new(value))
}
}
impl From<RichTextMathematicalExpression> for RichTextUnion {
fn from(value: RichTextMathematicalExpression) -> Self {
Self::RichTextMathematicalExpression(Box::new(value))
}
}
impl From<RichTextMention> for RichTextUnion {
fn from(value: RichTextMention) -> Self {
Self::RichTextMention(Box::new(value))
}
}
impl From<RichTextPhoneNumber> for RichTextUnion {
fn from(value: RichTextPhoneNumber) -> Self {
Self::RichTextPhoneNumber(Box::new(value))
}
}
impl From<RichTextReference> for RichTextUnion {
fn from(value: RichTextReference) -> Self {
Self::RichTextReference(Box::new(value))
}
}
impl From<RichTextReferenceLink> for RichTextUnion {
fn from(value: RichTextReferenceLink) -> Self {
Self::RichTextReferenceLink(Box::new(value))
}
}
impl From<RichTextSpoiler> for RichTextUnion {
fn from(value: RichTextSpoiler) -> Self {
Self::RichTextSpoiler(Box::new(value))
}
}
impl From<RichTextStrikethrough> for RichTextUnion {
fn from(value: RichTextStrikethrough) -> Self {
Self::RichTextStrikethrough(Box::new(value))
}
}
impl From<RichTextSubscript> for RichTextUnion {
fn from(value: RichTextSubscript) -> Self {
Self::RichTextSubscript(Box::new(value))
}
}
impl From<RichTextSuperscript> for RichTextUnion {
fn from(value: RichTextSuperscript) -> Self {
Self::RichTextSuperscript(Box::new(value))
}
}
impl From<RichTextTextMention> for RichTextUnion {
fn from(value: RichTextTextMention) -> Self {
Self::RichTextTextMention(Box::new(value))
}
}
impl From<RichTextUnderline> for RichTextUnion {
fn from(value: RichTextUnderline) -> Self {
Self::RichTextUnderline(Box::new(value))
}
}
impl From<RichTextUrl> for RichTextUnion {
fn from(value: RichTextUrl) -> Self {
Self::RichTextUrl(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum StoryAreaTypeUnion {
StoryAreaTypeLink(Box<StoryAreaTypeLink>),
StoryAreaTypeLocation(Box<StoryAreaTypeLocation>),
StoryAreaTypeSuggestedReaction(Box<StoryAreaTypeSuggestedReaction>),
StoryAreaTypeUniqueGift(Box<StoryAreaTypeUniqueGift>),
StoryAreaTypeWeather(Box<StoryAreaTypeWeather>),
}
impl Serialize for StoryAreaTypeUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::StoryAreaTypeLink(value) => value.serialize(serializer),
Self::StoryAreaTypeLocation(value) => value.serialize(serializer),
Self::StoryAreaTypeSuggestedReaction(value) => value.serialize(serializer),
Self::StoryAreaTypeUniqueGift(value) => value.serialize(serializer),
Self::StoryAreaTypeWeather(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for StoryAreaTypeUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"link" => serde_json::from_value::<StoryAreaTypeLink>(value)
.map(|value| Self::StoryAreaTypeLink(Box::new(value)))
.map_err(serde::de::Error::custom),
"location" => serde_json::from_value::<StoryAreaTypeLocation>(value)
.map(|value| Self::StoryAreaTypeLocation(Box::new(value)))
.map_err(serde::de::Error::custom),
"suggested_reaction" => serde_json::from_value::<StoryAreaTypeSuggestedReaction>(value)
.map(|value| Self::StoryAreaTypeSuggestedReaction(Box::new(value)))
.map_err(serde::de::Error::custom),
"unique_gift" => serde_json::from_value::<StoryAreaTypeUniqueGift>(value)
.map(|value| Self::StoryAreaTypeUniqueGift(Box::new(value)))
.map_err(serde::de::Error::custom),
"weather" => serde_json::from_value::<StoryAreaTypeWeather>(value)
.map(|value| Self::StoryAreaTypeWeather(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for StoryAreaTypeUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::StoryAreaTypeLink(value) => value.collect_files(output),
Self::StoryAreaTypeLocation(value) => value.collect_files(output),
Self::StoryAreaTypeSuggestedReaction(value) => value.collect_files(output),
Self::StoryAreaTypeUniqueGift(value) => value.collect_files(output),
Self::StoryAreaTypeWeather(value) => value.collect_files(output),
}
}
}
impl From<StoryAreaTypeLink> for StoryAreaTypeUnion {
fn from(value: StoryAreaTypeLink) -> Self {
Self::StoryAreaTypeLink(Box::new(value))
}
}
impl From<StoryAreaTypeLocation> for StoryAreaTypeUnion {
fn from(value: StoryAreaTypeLocation) -> Self {
Self::StoryAreaTypeLocation(Box::new(value))
}
}
impl From<StoryAreaTypeSuggestedReaction> for StoryAreaTypeUnion {
fn from(value: StoryAreaTypeSuggestedReaction) -> Self {
Self::StoryAreaTypeSuggestedReaction(Box::new(value))
}
}
impl From<StoryAreaTypeUniqueGift> for StoryAreaTypeUnion {
fn from(value: StoryAreaTypeUniqueGift) -> Self {
Self::StoryAreaTypeUniqueGift(Box::new(value))
}
}
impl From<StoryAreaTypeWeather> for StoryAreaTypeUnion {
fn from(value: StoryAreaTypeWeather) -> Self {
Self::StoryAreaTypeWeather(Box::new(value))
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum TransactionPartnerUnion {
TransactionPartnerAffiliateProgram(Box<TransactionPartnerAffiliateProgram>),
TransactionPartnerChat(Box<TransactionPartnerChat>),
TransactionPartnerFragment(Box<TransactionPartnerFragment>),
TransactionPartnerOther(Box<TransactionPartnerOther>),
TransactionPartnerTelegramAds(Box<TransactionPartnerTelegramAds>),
TransactionPartnerTelegramApi(Box<TransactionPartnerTelegramApi>),
TransactionPartnerUser(Box<TransactionPartnerUser>),
}
impl Serialize for TransactionPartnerUnion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::TransactionPartnerAffiliateProgram(value) => value.serialize(serializer),
Self::TransactionPartnerChat(value) => value.serialize(serializer),
Self::TransactionPartnerFragment(value) => value.serialize(serializer),
Self::TransactionPartnerOther(value) => value.serialize(serializer),
Self::TransactionPartnerTelegramAds(value) => value.serialize(serializer),
Self::TransactionPartnerTelegramApi(value) => value.serialize(serializer),
Self::TransactionPartnerUser(value) => value.serialize(serializer),
}
}
}
impl<'de> Deserialize<'de> for TransactionPartnerUnion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let value = Value::deserialize(deserializer)?;
let tag = value
.get("type")
.and_then(Value::as_str)
.ok_or_else(|| serde::de::Error::custom("missing union discriminator"))?;
match tag {
"affiliate_program" => {
serde_json::from_value::<TransactionPartnerAffiliateProgram>(value)
.map(|value| Self::TransactionPartnerAffiliateProgram(Box::new(value)))
.map_err(serde::de::Error::custom)
}
"chat" => serde_json::from_value::<TransactionPartnerChat>(value)
.map(|value| Self::TransactionPartnerChat(Box::new(value)))
.map_err(serde::de::Error::custom),
"fragment" => serde_json::from_value::<TransactionPartnerFragment>(value)
.map(|value| Self::TransactionPartnerFragment(Box::new(value)))
.map_err(serde::de::Error::custom),
"other" => serde_json::from_value::<TransactionPartnerOther>(value)
.map(|value| Self::TransactionPartnerOther(Box::new(value)))
.map_err(serde::de::Error::custom),
"telegram_ads" => serde_json::from_value::<TransactionPartnerTelegramAds>(value)
.map(|value| Self::TransactionPartnerTelegramAds(Box::new(value)))
.map_err(serde::de::Error::custom),
"telegram_api" => serde_json::from_value::<TransactionPartnerTelegramApi>(value)
.map(|value| Self::TransactionPartnerTelegramApi(Box::new(value)))
.map_err(serde::de::Error::custom),
"user" => serde_json::from_value::<TransactionPartnerUser>(value)
.map(|value| Self::TransactionPartnerUser(Box::new(value)))
.map_err(serde::de::Error::custom),
_ => Err(serde::de::Error::custom(format!(
"unknown union discriminator: {tag}"
))),
}
}
}
impl CollectFiles for TransactionPartnerUnion {
fn collect_files(&self, output: &mut Vec<InputFileUpload>) {
match self {
Self::TransactionPartnerAffiliateProgram(value) => value.collect_files(output),
Self::TransactionPartnerChat(value) => value.collect_files(output),
Self::TransactionPartnerFragment(value) => value.collect_files(output),
Self::TransactionPartnerOther(value) => value.collect_files(output),
Self::TransactionPartnerTelegramAds(value) => value.collect_files(output),
Self::TransactionPartnerTelegramApi(value) => value.collect_files(output),
Self::TransactionPartnerUser(value) => value.collect_files(output),
}
}
}
impl From<TransactionPartnerAffiliateProgram> for TransactionPartnerUnion {
fn from(value: TransactionPartnerAffiliateProgram) -> Self {
Self::TransactionPartnerAffiliateProgram(Box::new(value))
}
}
impl From<TransactionPartnerChat> for TransactionPartnerUnion {
fn from(value: TransactionPartnerChat) -> Self {
Self::TransactionPartnerChat(Box::new(value))
}
}
impl From<TransactionPartnerFragment> for TransactionPartnerUnion {
fn from(value: TransactionPartnerFragment) -> Self {
Self::TransactionPartnerFragment(Box::new(value))
}
}
impl From<TransactionPartnerOther> for TransactionPartnerUnion {
fn from(value: TransactionPartnerOther) -> Self {
Self::TransactionPartnerOther(Box::new(value))
}
}
impl From<TransactionPartnerTelegramAds> for TransactionPartnerUnion {
fn from(value: TransactionPartnerTelegramAds) -> Self {
Self::TransactionPartnerTelegramAds(Box::new(value))
}
}
impl From<TransactionPartnerTelegramApi> for TransactionPartnerUnion {
fn from(value: TransactionPartnerTelegramApi) -> Self {
Self::TransactionPartnerTelegramApi(Box::new(value))
}
}
impl From<TransactionPartnerUser> for TransactionPartnerUnion {
fn from(value: TransactionPartnerUser) -> Self {
Self::TransactionPartnerUser(Box::new(value))
}
}