mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Added dummy types into core/types/not_implemented_types.rs; Added MessageEntity
This commit is contained in:
parent
f304fd6a6b
commit
5e57abf676
6 changed files with 113 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
use serde::Deserialize;
|
use crate::core::types::PhotoSize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
||||||
pub struct Document {
|
pub struct Document {
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
use serde::Deserialize;
|
// use serde::Deserialize;
|
||||||
|
|
||||||
use crate::core::types::{Chat, Document, Invoice, SuccessfulPayment, User};
|
use crate::core::types::{
|
||||||
|
Animation, Audio, Chat, Contact,
|
||||||
|
Document, Game, Invoice, InlineKeyboardMarkup,
|
||||||
|
PhotoSize, MessageEntity, Location, PassportData, Poll,
|
||||||
|
Sticker, SuccessfulPayment,
|
||||||
|
User, Video, VideoNote, Venue, Voice,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
||||||
pub struct Message {
|
pub struct Message {
|
||||||
|
@ -26,7 +32,7 @@ pub struct Message {
|
||||||
pub animation: Option<Animation>,
|
pub animation: Option<Animation>,
|
||||||
pub game: Option<Game>,
|
pub game: Option<Game>,
|
||||||
pub photo: Option<Vec<PhotoSize>>,
|
pub photo: Option<Vec<PhotoSize>>,
|
||||||
pub sticker: Option<Stickers>,
|
pub sticker: Option<Sticker>,
|
||||||
pub video: Option<Video>,
|
pub video: Option<Video>,
|
||||||
pub voice: Option<Voice>,
|
pub voice: Option<Voice>,
|
||||||
pub video_note: Option<VideoNote>,
|
pub video_note: Option<VideoNote>,
|
||||||
|
|
36
src/core/types/message_entity.rs
Normal file
36
src/core/types/message_entity.rs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
use crate::core::types::User;
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, PartialEq, Hash, Eq)]
|
||||||
|
pub struct MessageEntity {
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub kind: MessageEntityKind,
|
||||||
|
pub offset: usize,
|
||||||
|
pub length: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, PartialEq, Hash, Eq)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
#[serde(tag = "type")]
|
||||||
|
enum MessageEntityKind {
|
||||||
|
Mention, Hashtag, Cashtag, BotCommand, Url, Email, PhoneNumber,
|
||||||
|
Bold, Italic, Code, Pre,
|
||||||
|
TextLink { url: String },
|
||||||
|
TextMention { user: User }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn test() {
|
||||||
|
use serde_json::from_str;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
MessageEntity {
|
||||||
|
kind: MessageEntityKind::TextLink { url: "ya.ru".into() },
|
||||||
|
offset: 1,
|
||||||
|
length: 2
|
||||||
|
},
|
||||||
|
from_str::<MessageEntity>(
|
||||||
|
r#"{"type":"text_link","url":"ya.ru","offset":1,"length":2}"#
|
||||||
|
).unwrap()
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,10 +1,27 @@
|
||||||
|
mod not_implemented_types;
|
||||||
|
use self::not_implemented_types::*;
|
||||||
|
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
answer_pre_checkout_query::AnswerPreCheckoutQuery, answer_shipping_query::AnswerShippingQuery,
|
answer_pre_checkout_query::AnswerPreCheckoutQuery,
|
||||||
chat::Chat, chat_permissions::ChatPermissions, chat_photo::ChatPhoto, document::Document,
|
answer_shipping_query::AnswerShippingQuery,
|
||||||
invoice::Invoice, label_price::LabeledPrice, message::Message, order_info::OrderInfo,
|
chat::Chat,
|
||||||
pre_checkout_query::PreCheckoutQuery, send_invoice::SendInvoice,
|
chat_permissions::ChatPermissions,
|
||||||
shipping_address::ShippingAddress, shipping_option::ShippingOption,
|
chat_photo::ChatPhoto,
|
||||||
shipping_query::ShippingQuery, successful_payment::SuccessfulPayment, user::User,
|
document::Document,
|
||||||
|
invoice::Invoice,
|
||||||
|
label_price::LabeledPrice,
|
||||||
|
message::Message,
|
||||||
|
message_entity::MessageEntity,
|
||||||
|
order_info::OrderInfo,
|
||||||
|
pre_checkout_query::PreCheckoutQuery,
|
||||||
|
send_invoice::SendInvoice,
|
||||||
|
shipping_address::ShippingAddress,
|
||||||
|
shipping_option::ShippingOption,
|
||||||
|
shipping_query::ShippingQuery,
|
||||||
|
sticker::Sticker,
|
||||||
|
successful_payment::SuccessfulPayment,
|
||||||
|
user::User,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod answer_pre_checkout_query;
|
mod answer_pre_checkout_query;
|
||||||
|
@ -16,11 +33,13 @@ mod document;
|
||||||
mod invoice;
|
mod invoice;
|
||||||
mod label_price;
|
mod label_price;
|
||||||
mod message;
|
mod message;
|
||||||
|
mod message_entity;
|
||||||
mod order_info;
|
mod order_info;
|
||||||
mod pre_checkout_query;
|
mod pre_checkout_query;
|
||||||
mod send_invoice;
|
mod send_invoice;
|
||||||
mod shipping_address;
|
mod shipping_address;
|
||||||
mod shipping_option;
|
mod shipping_option;
|
||||||
mod shipping_query;
|
mod shipping_query;
|
||||||
|
mod sticker;
|
||||||
mod successful_payment;
|
mod successful_payment;
|
||||||
mod user;
|
mod user;
|
||||||
|
|
41
src/core/types/not_implemented_types.rs
Normal file
41
src/core/types/not_implemented_types.rs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct PhotoSize;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Location;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct InlineKeyboardMarkup;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct PassportData;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Poll;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Animation;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Audio;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Game;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Contact;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Video;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct VideoNote;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Venue;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct Voice;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
|
||||||
|
pub struct MaskPosition;
|
|
@ -1,6 +1,4 @@
|
||||||
use serde::Deserialize;
|
use crate::core::types::{InlineKeyboardMarkup, LabeledPrice};
|
||||||
|
|
||||||
use crate::core::types::LabeledPrice;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
|
||||||
pub struct SendInvoice {
|
pub struct SendInvoice {
|
||||||
|
|
Loading…
Reference in a new issue