mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Derive Clone
on plenty of types
This commit is contained in:
parent
8ec055b0f9
commit
9b98895a60
52 changed files with 114 additions and 68 deletions
|
@ -4,7 +4,7 @@ use crate::core::requests::{
|
||||||
};
|
};
|
||||||
use crate::core::types::User;
|
use crate::core::types::User;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct GetMe<'a> {
|
pub struct GetMe<'a> {
|
||||||
info: RequestContext<'a>,
|
info: RequestContext<'a>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub trait Request<'a> {
|
||||||
|
|
||||||
pub type RequestFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
|
pub type RequestFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RequestContext<'a> {
|
pub struct RequestContext<'a> {
|
||||||
pub client: &'a Client,
|
pub client: &'a Client,
|
||||||
pub token: &'a str,
|
pub token: &'a str,
|
||||||
|
@ -53,7 +53,7 @@ pub struct RequestContext<'a> {
|
||||||
|
|
||||||
/// Unique identifier for the target chat or username of the target channel (in
|
/// Unique identifier for the target chat or username of the target channel (in
|
||||||
/// the format @channelusername)
|
/// the format @channelusername)
|
||||||
#[derive(Debug, Display, Serialize, From, PartialEq, Eq)]
|
#[derive(Debug, Display, Serialize, From, PartialEq, Eq, Clone)]
|
||||||
pub enum ChatId {
|
pub enum ChatId {
|
||||||
/// chat identifier
|
/// chat identifier
|
||||||
#[display(fmt = "{}", _0)]
|
#[display(fmt = "{}", _0)]
|
||||||
|
|
46
src/core/requests/send_media_group.rs
Normal file
46
src/core/requests/send_media_group.rs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
use crate::core::{
|
||||||
|
types::{
|
||||||
|
Message, InputMedia,
|
||||||
|
},
|
||||||
|
network::{
|
||||||
|
request, ResponseResult,
|
||||||
|
},
|
||||||
|
requests::{
|
||||||
|
form_builder::FormBuilder,
|
||||||
|
ChatId,
|
||||||
|
Request,
|
||||||
|
RequestInfo,
|
||||||
|
RequestFuture,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Use this method to send a group of photos or videos as an album.
|
||||||
|
#[derive(Debug, TypedBuilder)]
|
||||||
|
pub struct SendMediaGroup {
|
||||||
|
info: RequestInfo,
|
||||||
|
|
||||||
|
chat_id: ChatId,
|
||||||
|
media: Vec<InputMedia>,
|
||||||
|
|
||||||
|
#[builder(default)]
|
||||||
|
disable_notification: Option<bool>,
|
||||||
|
#[builder(default)]
|
||||||
|
reply_to_message_id: Option<i64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Request for SendMediaGroup {
|
||||||
|
type ReturnValue = Vec<Message>;
|
||||||
|
|
||||||
|
|
||||||
|
fn send(self) -> RequestFuture<ResponseResult<Self::ReturnValue>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let params = FormBuilder::new()
|
||||||
|
.add("chat_id", &self.chat_id)
|
||||||
|
.add("media", &self.media)
|
||||||
|
.add_if_some("disable_notification", self.disable_notification.as_ref())
|
||||||
|
.add_if_some("reply_to_message_id", self.reply_to_message_id.as_ref())
|
||||||
|
.build();
|
||||||
|
request(&self.info.client, &self.info.token, "sendMediaGroup", Some(params)).await
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ use crate::core::requests::{
|
||||||
};
|
};
|
||||||
use crate::core::{network, types::Message};
|
use crate::core::{network, types::Message};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SendMessage<'a> {
|
pub struct SendMessage<'a> {
|
||||||
info: RequestContext<'a>,
|
info: RequestContext<'a>,
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone )]
|
||||||
pub struct AnswerPreCheckoutQuery {
|
pub struct AnswerPreCheckoutQuery {
|
||||||
pub pre_checkout_query_id: String,
|
pub pre_checkout_query_id: String,
|
||||||
pub ok: bool,
|
pub ok: bool,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::ShippingOption;
|
use crate::core::types::ShippingOption;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct AnswerShippingQuery {
|
pub struct AnswerShippingQuery {
|
||||||
pub shipping_query_id: String,
|
pub shipping_query_id: String,
|
||||||
pub ok: bool,
|
pub ok: bool,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::PhotoSize;
|
use crate::core::types::PhotoSize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Audio {
|
pub struct Audio {
|
||||||
pub file_id: String,
|
pub file_id: String,
|
||||||
pub duration: u32,
|
pub duration: u32,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// This object represents an incoming callback query from a callback button in an inline keyboard.
|
/// This object represents an incoming callback query from a callback button in an inline keyboard.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct CallbackQuery {
|
pub struct CallbackQuery {
|
||||||
/// Unique identifier for this query
|
/// Unique identifier for this query
|
||||||
pub id: CallbackQueryId,
|
pub id: CallbackQueryId,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{ChatPermissions, ChatPhoto, Message};
|
use crate::core::types::{ChatPermissions, ChatPhoto, Message};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Chat {
|
pub struct Chat {
|
||||||
#[serde(rename = "chat_id")]
|
#[serde(rename = "chat_id")]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -46,7 +46,7 @@ fn serialize_private_field<S: serde::Serializer>(
|
||||||
ser.serialize_str("private")
|
ser.serialize_str("private")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum ChatType {
|
pub enum ChatType {
|
||||||
|
@ -77,7 +77,7 @@ pub enum ChatType {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum NotPrivateChatType {
|
pub enum NotPrivateChatType {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::core::types::{ChatMemberStatus, User};
|
use crate::core::types::{ChatMemberStatus, User};
|
||||||
|
|
||||||
/// This object contains information about one member of the chat.
|
/// This object contains information about one member of the chat.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ChatMember {
|
pub struct ChatMember {
|
||||||
/// Information about the user.
|
/// Information about the user.
|
||||||
pub user: User,
|
pub user: User,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize, Clone)]
|
||||||
pub struct ChatPermissions {
|
pub struct ChatPermissions {
|
||||||
pub can_send_messages: Option<bool>,
|
pub can_send_messages: Option<bool>,
|
||||||
pub can_send_media_messages: Option<bool>,
|
pub can_send_media_messages: Option<bool>,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize, Clone)]
|
||||||
pub struct ChatPhoto {
|
pub struct ChatPhoto {
|
||||||
pub small_file_id: String,
|
pub small_file_id: String,
|
||||||
pub big_file_id: String,
|
pub big_file_id: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::user::User;
|
use crate::core::types::user::User;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// Represents a result of an inline query that was chosen by the user and
|
/// Represents a result of an inline query that was chosen by the user and
|
||||||
/// sent to their chat partner.
|
/// sent to their chat partner.
|
||||||
/// https://core.telegram.org/bots/api#inputtextmessagecontent
|
/// https://core.telegram.org/bots/api#inputtextmessagecontent
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::Deserialization;
|
use serde::Deserialization;
|
||||||
|
|
||||||
#[derive(Debug, Deserialization)]
|
#[derive(Debug, Deserialization, Clone)]
|
||||||
/// This object represents a phone contact.
|
/// This object represents a phone contact.
|
||||||
struct Contact {
|
struct Contact {
|
||||||
/// Contact's phone number
|
/// Contact's phone number
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::PhotoSize;
|
use crate::core::types::PhotoSize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||||
pub struct Document {
|
pub struct Document {
|
||||||
pub file_id: String,
|
pub file_id: String,
|
||||||
pub thumb: Option<PhotoSize>,
|
pub thumb: Option<PhotoSize>,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/// selected the bot‘s message and tapped ’Reply'). This can be
|
/// selected the bot‘s message and tapped ’Reply'). This can be
|
||||||
/// extremely useful if you want to create user-friendly step-by-step
|
/// extremely useful if you want to create user-friendly step-by-step
|
||||||
/// interfaces without having to sacrifice privacy mod
|
/// interfaces without having to sacrifice privacy mod
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ForceReply {
|
pub struct ForceReply {
|
||||||
pub force_reply: True,
|
pub force_reply: True,
|
||||||
#[serde(skip_serializing_if = "Not::not")]
|
#[serde(skip_serializing_if = "Not::not")]
|
||||||
|
|
|
@ -2,7 +2,7 @@ use serde::Deserialize;
|
||||||
|
|
||||||
use crate::core::types::MessageEntity;
|
use crate::core::types::MessageEntity;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// This object represents a game. Use BotFather to create and edit games, their short names
|
/// This object represents a game. Use BotFather to create and edit games, their short names
|
||||||
/// will act as unique identifiers.
|
/// will act as unique identifiers.
|
||||||
pub struct Game {
|
pub struct Game {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use serde::Deserialize;
|
||||||
|
|
||||||
use crate::core::types::user::User;
|
use crate::core::types::user::User;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// This object represents one row of the high scores table for a game.
|
/// This object represents one row of the high scores table for a game.
|
||||||
pub struct GameHighScore {
|
pub struct GameHighScore {
|
||||||
/// Position in high score table for the game
|
/// Position in high score table for the game
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/// This object represents one button of an inline keyboard.
|
/// This object represents one button of an inline keyboard.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct InlineKeyboardButton {
|
pub struct InlineKeyboardButton {
|
||||||
pub text: String,
|
pub text: String,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub kind: InlineKeyboardButtonKind,
|
pub kind: InlineKeyboardButtonKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
|
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Clone)]
|
||||||
pub enum InlineKeyboardButtonKind {
|
pub enum InlineKeyboardButtonKind {
|
||||||
#[serde(rename = "url")]
|
#[serde(rename = "url")]
|
||||||
Url(String),
|
Url(String),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// This object represents an inline keyboard that appears right next to the message it belongs to.
|
/// This object represents an inline keyboard that appears right next to the message it belongs to.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct InlineKeyboardMarkup {
|
pub struct InlineKeyboardMarkup {
|
||||||
pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
|
pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Hash, PartialEq, Eq)]
|
#[derive(Debug, Hash, PartialEq, Eq, Clone)]
|
||||||
pub enum InputFile {
|
pub enum InputFile {
|
||||||
File(std::path::PathBuf),
|
File(std::path::PathBuf),
|
||||||
Url(String),
|
Url(String),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::core::types::{InputFile, ParseMode};
|
use crate::core::types::{InputFile, ParseMode};
|
||||||
|
|
||||||
// TODO: should variants use new-type?
|
// TODO: should variants use new-type?
|
||||||
#[derive(Debug, Serialize, PartialEq, Eq)]
|
#[derive(Debug, Serialize, PartialEq, Eq, Clone)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
/// This object represents the content of a media message to be sent.
|
/// This object represents the content of a media message to be sent.
|
||||||
|
|
|
@ -2,7 +2,7 @@ use serde::Serialize;
|
||||||
|
|
||||||
use crate::core::types::ParseMode;
|
use crate::core::types::ParseMode;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize, Clone)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
/// This object represents the content of a message to be sent as
|
/// This object represents the content of a message to be sent as
|
||||||
/// a result of an inline query.
|
/// a result of an inline query.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct Invoice {
|
pub struct Invoice {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// This object represents one button of the reply keyboard.
|
/// This object represents one button of the reply keyboard.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct KeyboardButton {
|
pub struct KeyboardButton {
|
||||||
pub text: String,
|
pub text: String,
|
||||||
#[serde(skip_serializing_if = "Not::not")]
|
#[serde(skip_serializing_if = "Not::not")]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct LabeledPrice {
|
pub struct LabeledPrice {
|
||||||
pub label: String,
|
pub label: String,
|
||||||
pub amount: i64,
|
pub amount: i64,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialization, Serialization};
|
use serde::{Deserialization, Serialization};
|
||||||
|
|
||||||
#[derive(Debug, Serialization, Deserialization)]
|
#[derive(Debug, Serialization, Deserialization, Clone)]
|
||||||
/// This object represents a point on the map.
|
/// This object represents a point on the map.
|
||||||
struct Location {
|
struct Location {
|
||||||
/// Longitude as defined by sender
|
/// Longitude as defined by sender
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct LoginUrl {
|
pub struct LoginUrl {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct MaskPosition {
|
pub struct MaskPosition {
|
||||||
pub point: String,
|
pub point: String,
|
||||||
pub x_shift: f64,
|
pub x_shift: f64,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::core::types::{
|
||||||
SuccessfulPayment, User, Venue, Video, VideoNote, Voice,
|
SuccessfulPayment, User, Venue, Video, VideoNote, Voice,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Message {
|
pub struct Message {
|
||||||
#[serde(rename = "message_id")]
|
#[serde(rename = "message_id")]
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -14,7 +14,7 @@ pub struct Message {
|
||||||
pub type_: MessageType,
|
pub type_: MessageType,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum MessageType {}
|
pub enum MessageType {}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::User;
|
use crate::core::types::User;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||||
pub struct MessageEntity {
|
pub struct MessageEntity {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub kind: MessageEntityKind,
|
pub kind: MessageEntityKind,
|
||||||
|
@ -8,7 +8,7 @@ pub struct MessageEntity {
|
||||||
pub length: usize,
|
pub length: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum MessageEntityKind {
|
pub enum MessageEntityKind {
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Location;
|
pub struct Location;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct InlineKeyboardMarkup;
|
pub struct InlineKeyboardMarkup;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct PassportData;
|
pub struct PassportData;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Poll;
|
pub struct Poll;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Animation;
|
pub struct Animation;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Game;
|
pub struct Game;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Contact;
|
pub struct Contact;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct VideoNote;
|
pub struct VideoNote;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Venue;
|
pub struct Venue;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Voice;
|
pub struct Voice;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct MaskPosition;
|
pub struct MaskPosition;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct ChatMemberStatus;
|
pub struct ChatMemberStatus;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::ShippingAddress;
|
use crate::core::types::ShippingAddress;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct OrderInfo {
|
pub struct OrderInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub phone_number: String,
|
pub phone_number: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
|
||||||
/// ## Formatting options
|
/// ## Formatting options
|
||||||
/// The Bot API supports basic formatting for messages.
|
/// The Bot API supports basic formatting for messages.
|
||||||
/// You can use **bold** and *italic* text, as well as [inline links](https://example.com) and `pre-formatted code` in
|
/// You can use **bold** and *italic* text, as well as [inline links](https://example.com) and `pre-formatted code` in
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct PhotoSize {
|
pub struct PhotoSize {
|
||||||
pub file_id: String,
|
pub file_id: String,
|
||||||
pub width: i32,
|
pub width: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{OrderInfo, User};
|
use crate::core::types::{OrderInfo, User};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct PreCheckoutQuery {
|
pub struct PreCheckoutQuery {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub from: User,
|
pub from: User,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/// This object represents a custom keyboard with reply options.
|
/// This object represents a custom keyboard with reply options.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ReplyKeyboardMarkup {
|
pub struct ReplyKeyboardMarkup {
|
||||||
pub keyboard: Vec<Vec<KeyboardButton>>,
|
pub keyboard: Vec<Vec<KeyboardButton>>,
|
||||||
#[serde(skip_serializing_if = "Not::not")]
|
#[serde(skip_serializing_if = "Not::not")]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/// By default, custom keyboards are displayed until a new keyboard is sent
|
/// 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
|
/// by a bot. An exception is made for one-time keyboards that are hidden
|
||||||
/// immediately after the user presses a button (see ReplyKeyboardMarkup).
|
/// immediately after the user presses a button (see ReplyKeyboardMarkup).
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ReplyKeyboardRemove {
|
pub struct ReplyKeyboardRemove {
|
||||||
pub remove_keyboard: True,
|
pub remove_keyboard: True,
|
||||||
#[serde(skip_serializing_if = "Not::not")]
|
#[serde(skip_serializing_if = "Not::not")]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ResponseParameters {
|
pub struct ResponseParameters {
|
||||||
pub migrate_to_chat_id: Option<i64>,
|
pub migrate_to_chat_id: Option<i64>,
|
||||||
pub retry_after: Option<i64>,
|
pub retry_after: Option<i64>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{InlineKeyboardMarkup, LabeledPrice};
|
use crate::core::types::{InlineKeyboardMarkup, LabeledPrice};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct SendInvoice {
|
pub struct SendInvoice {
|
||||||
pub chat_id: i64,
|
pub chat_id: i64,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ShippingAddress {
|
pub struct ShippingAddress {
|
||||||
pub country_code: String,
|
pub country_code: String,
|
||||||
pub state: String,
|
pub state: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::LabeledPrice;
|
use crate::core::types::LabeledPrice;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ShippingOption {
|
pub struct ShippingOption {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{ShippingAddress, User};
|
use crate::core::types::{ShippingAddress, User};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct ShippingQuery {
|
pub struct ShippingQuery {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub from: User,
|
pub from: User,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{MaskPosition, PhotoSize};
|
use crate::core::types::{MaskPosition, PhotoSize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct Sticker {
|
pub struct Sticker {
|
||||||
pub file_id: String,
|
pub file_id: String,
|
||||||
pub width: u16,
|
pub width: u16,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::Sticker;
|
use crate::core::types::Sticker;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct Sticker {
|
pub struct Sticker {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::OrderInfo;
|
use crate::core::types::OrderInfo;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct SuccessfulPayment {
|
pub struct SuccessfulPayment {
|
||||||
pub currency: String,
|
pub currency: String,
|
||||||
pub total_amount: i64,
|
pub total_amount: i64,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub is_bot: bool,
|
pub is_bot: bool,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::Location;
|
use crate::core::types::Location;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Venue {
|
pub struct Venue {
|
||||||
pub location: Location,
|
pub location: Location,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::PhotoSize;
|
use crate::core::types::PhotoSize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||||
pub struct Video {
|
pub struct Video {
|
||||||
pub file_id: String,
|
pub file_id: String,
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope)
|
/// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope)
|
||||||
/// (available in Telegram apps as of v.4.0).
|
/// (available in Telegram apps as of v.4.0).
|
||||||
struct VideoNote {
|
struct VideoNote {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// This object represents a voice note.
|
/// This object represents a voice note.
|
||||||
struct Voice {
|
struct Voice {
|
||||||
/// Identifier for this file
|
/// Identifier for this file
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
/// Contains information about the current status of a webhook.
|
/// Contains information about the current status of a webhook.
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct WebhookInfo {
|
pub struct WebhookInfo {
|
||||||
/// Webhook URL, may be empty if webhook is not set up
|
/// Webhook URL, may be empty if webhook is not set up
|
||||||
pub url: String,
|
pub url: String,
|
||||||
|
|
Loading…
Reference in a new issue