mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-05 10:24:32 +01:00
Clean InlineQueryResult*
structs
This commit is contained in:
parent
04d31cd785
commit
59f419f947
24 changed files with 79 additions and 92 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::types::{User, Location};
|
use crate::core::types::{User, Location};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Hash, PartialEq, Eq, Clone)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQuery {
|
pub struct InlineQuery {
|
||||||
/// Unique identifier for this query
|
/// Unique identifier for this query
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
|
@ -1,15 +1,47 @@
|
||||||
use super::inline_query_result_cached_audio::InlineQueryResultCachedAudio;
|
use crate::core::types::{
|
||||||
|
InlineQueryResultCachedAudio,
|
||||||
|
InlineQueryResultCachedDocument,
|
||||||
|
InlineQueryResultCachedGif,
|
||||||
|
InlineQueryResultCachedMpeg4Gif,
|
||||||
|
InlineQueryResultCachedPhoto,
|
||||||
|
InlineQueryResultCachedSticker,
|
||||||
|
InlineQueryResultCachedVideo,
|
||||||
|
InlineQueryResultCachedVoice,
|
||||||
|
InlineQueryResultArticle,
|
||||||
|
InlineQueryResultAudio,
|
||||||
|
InlineQueryResultContact,
|
||||||
|
InlineQueryResultGame,
|
||||||
|
InlineQueryResultDocument,
|
||||||
|
InlineQueryResultGif,
|
||||||
|
InlineQueryResultLocation,
|
||||||
|
InlineQueryResultMpeg4Gif,
|
||||||
|
InlineQueryResultPhoto,
|
||||||
|
InlineQueryResultVenue,
|
||||||
|
InlineQueryResultVideo,
|
||||||
|
InlineQueryResultVoice
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Eq, Clone, PartialEq, Hash)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
|
#[serde(tag = "type")]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum InlineQueryResult {
|
pub enum InlineQueryResult {
|
||||||
|
#[serde(rename = "audio")]
|
||||||
CachedAudio(InlineQueryResultCachedAudio),
|
CachedAudio(InlineQueryResultCachedAudio),
|
||||||
|
#[serde(rename = "document")]
|
||||||
CachedDocument(InlineQueryResultCachedDocument),
|
CachedDocument(InlineQueryResultCachedDocument),
|
||||||
|
#[serde(rename = "gif")]
|
||||||
CachedGif(InlineQueryResultCachedGif),
|
CachedGif(InlineQueryResultCachedGif),
|
||||||
|
#[serde(rename = "mpeg4_gif")]
|
||||||
CachedMpeg4Gif(InlineQueryResultCachedMpeg4Gif),
|
CachedMpeg4Gif(InlineQueryResultCachedMpeg4Gif),
|
||||||
|
#[serde(rename = "photo")]
|
||||||
CachedPhoto(InlineQueryResultCachedPhoto),
|
CachedPhoto(InlineQueryResultCachedPhoto),
|
||||||
|
#[serde(rename = "sticker")]
|
||||||
CachedSticker(InlineQueryResultCachedSticker),
|
CachedSticker(InlineQueryResultCachedSticker),
|
||||||
|
#[serde(rename = "video")]
|
||||||
CachedVideo(InlineQueryResultCachedVideo),
|
CachedVideo(InlineQueryResultCachedVideo),
|
||||||
|
#[serde(rename = "voice")]
|
||||||
CachedVoice(InlineQueryResultCachedVoice),
|
CachedVoice(InlineQueryResultCachedVoice),
|
||||||
|
|
||||||
Article(InlineQueryResultArticle),
|
Article(InlineQueryResultArticle),
|
||||||
Audio(InlineQueryResultAudio),
|
Audio(InlineQueryResultAudio),
|
||||||
Contact(InlineQueryResultContact),
|
Contact(InlineQueryResultContact),
|
||||||
|
@ -17,6 +49,7 @@ pub enum InlineQueryResult {
|
||||||
Document(InlineQueryResultDocument),
|
Document(InlineQueryResultDocument),
|
||||||
Gif(InlineQueryResultGif),
|
Gif(InlineQueryResultGif),
|
||||||
Location(InlineQueryResultLocation),
|
Location(InlineQueryResultLocation),
|
||||||
|
#[serde(rename = "mpeg4_gif")]
|
||||||
Mpeg4Gif(InlineQueryResultMpeg4Gif),
|
Mpeg4Gif(InlineQueryResultMpeg4Gif),
|
||||||
Photo(InlineQueryResultPhoto),
|
Photo(InlineQueryResultPhoto),
|
||||||
Venue(InlineQueryResultVenue),
|
Venue(InlineQueryResultVenue),
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Hash, PartialEq, Eq, Clone)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultArticle {
|
pub struct InlineQueryResultArticle {
|
||||||
// Type of the result, must be article
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
|
|
||||||
/// Unique identifier for this result, 1-64 Bytes
|
/// Unique identifier for this result, 1-64 Bytes
|
||||||
pub id: String,
|
pub id: String,
|
||||||
/// Title of the result
|
/// Title of the result
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{ParseMode, InlineKeyboardMarkup, InputMessageContent};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultAudio {
|
pub struct InlineQueryResultAudio {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub audio_url: String,
|
pub audio_url: String,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedAudio {
|
pub struct InlineQueryResultCachedAudio {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub audio_file_id: String,
|
pub audio_file_id: String,
|
||||||
pub caption: Option<String>,
|
pub caption: Option<String>,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedDocument {
|
pub struct InlineQueryResultCachedDocument {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub document_file_id: String,
|
pub document_file_id: String,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedGif {
|
pub struct InlineQueryResultCachedGif {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub gif_file_id: String,
|
pub gif_file_id: String,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedMpeg4Gif {
|
pub struct InlineQueryResultCachedMpeg4Gif {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub mpeg4_file_id: String,
|
pub mpeg4_file_id: String,
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedPhoto {
|
pub struct InlineQueryResultCachedPhoto {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub photo_file_id: String,
|
pub photo_file_id: String,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedSticker {
|
pub struct InlineQueryResultCachedSticker {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub sticker_file_id: String,
|
pub sticker_file_id: String,
|
||||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedVideo {
|
pub struct InlineQueryResultCachedVideo {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub video_file_id: String,
|
pub video_file_id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultCachedVoice {
|
pub struct InlineQueryResultCachedVoice {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub voice_file_id: String,
|
pub voice_file_id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultContact {
|
pub struct InlineQueryResultContact {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub phone_number: String,
|
pub phone_number: String,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultDocument {
|
pub struct InlineQueryResultDocument {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Hash, PartialEq, Eq, Clone)]
|
||||||
pub struct InlineQueryResultGame {
|
pub struct InlineQueryResultGame {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub game_short_name: String,
|
pub game_short_name: String,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultGif {
|
pub struct InlineQueryResultGif {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub gif_url: String,
|
pub gif_url: String,
|
||||||
pub gif_width: Option<i32>,
|
pub gif_width: Option<i32>,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultLocation {
|
pub struct InlineQueryResultLocation {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub latitude: f64,
|
pub latitude: f64,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultMpeg4Gif {
|
pub struct InlineQueryResultMpeg4Gif {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub mpeg4_url: String,
|
pub mpeg4_url: String,
|
||||||
pub mpeg4_width: Option<i32>,
|
pub mpeg4_width: Option<i32>,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultPhoto {
|
pub struct InlineQueryResultPhoto {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub photo_url: String,
|
pub photo_url: String,
|
||||||
pub thumb_url: String,
|
pub thumb_url: String,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup, ParseMode};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
use crate::core::types::parse_mode::ParseMode;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultVenue {
|
pub struct InlineQueryResultVenue {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub latitude: f64,
|
pub latitude: f64,
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultVideo {
|
pub struct InlineQueryResultVideo {
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub query_type: String,
|
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub video_url: String,
|
pub video_url: String,
|
||||||
pub mime_type: String,
|
pub mime_type: String,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use super::inline_keyboard_markup::InlineKeyboardMarkup;
|
use crate::core::types::{InputMessageContent, InlineKeyboardMarkup};
|
||||||
use super::input_message_content::InputMessageContent;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, PartialEq, Clone)]
|
||||||
pub struct InlineQueryResultVoice {
|
pub struct InlineQueryResultVoice {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub voice_url: String,
|
pub voice_url: String,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use serde::Serialize;
|
||||||
|
|
||||||
use crate::core::types::ParseMode;
|
use crate::core::types::ParseMode;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone)]
|
#[derive(Debug, Serialize, Clone, PartialEq)]
|
||||||
#[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.
|
||||||
|
|
|
@ -47,6 +47,8 @@ pub use self::{
|
||||||
video_note::VideoNote,
|
video_note::VideoNote,
|
||||||
voice::Voice,
|
voice::Voice,
|
||||||
file::File,
|
file::File,
|
||||||
|
input_message_content::InputMessageContent,
|
||||||
|
|
||||||
inline_query::InlineQuery,
|
inline_query::InlineQuery,
|
||||||
inline_query_result::InlineQueryResult,
|
inline_query_result::InlineQueryResult,
|
||||||
inline_query_result_cached_audio::InlineQueryResultCachedAudio,
|
inline_query_result_cached_audio::InlineQueryResultCachedAudio,
|
||||||
|
@ -117,6 +119,7 @@ mod video;
|
||||||
mod video_note;
|
mod video_note;
|
||||||
mod voice;
|
mod voice;
|
||||||
mod file;
|
mod file;
|
||||||
|
mod input_message_content;
|
||||||
|
|
||||||
mod inline_query;
|
mod inline_query;
|
||||||
mod inline_query_result;
|
mod inline_query_result;
|
||||||
|
|
Loading…
Reference in a new issue