mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 17:52:12 +01:00
Move AllowedUpdate into teloxide::types
This commit is contained in:
parent
7936558e54
commit
53f675c58a
5 changed files with 20 additions and 14 deletions
|
@ -103,7 +103,9 @@
|
||||||
use futures::{stream, Stream, StreamExt};
|
use futures::{stream, Stream, StreamExt};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bot::Bot, requests::payloads::AllowedUpdate, types::Update, RequestError,
|
bot::Bot,
|
||||||
|
types::{AllowedUpdate, Update},
|
||||||
|
RequestError,
|
||||||
};
|
};
|
||||||
use std::{convert::TryInto, time::Duration};
|
use std::{convert::TryInto, time::Duration};
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ pub mod payloads {
|
||||||
mod set_chat_administrator_custom_title;
|
mod set_chat_administrator_custom_title;
|
||||||
|
|
||||||
pub use {
|
pub use {
|
||||||
get_updates::{GetUpdates, AllowedUpdate},
|
get_updates::GetUpdates,
|
||||||
set_webhook::SetWebhook,
|
set_webhook::SetWebhook,
|
||||||
delete_webhook::DeleteWebhook,
|
delete_webhook::DeleteWebhook,
|
||||||
get_webhook_info::GetWebhookInfo,
|
get_webhook_info::GetWebhookInfo,
|
||||||
|
|
|
@ -4,6 +4,7 @@ use crate::{
|
||||||
requests::{dynamic, json, Method},
|
requests::{dynamic, json, Method},
|
||||||
types::Update,
|
types::Update,
|
||||||
};
|
};
|
||||||
|
use crate::types::AllowedUpdate;
|
||||||
|
|
||||||
/// Use this method to receive incoming updates using long polling ([wiki]).
|
/// Use this method to receive incoming updates using long polling ([wiki]).
|
||||||
/// An array ([`Vec`]) of [`Update`]s is returned.
|
/// An array ([`Vec`]) of [`Update`]s is returned.
|
||||||
|
@ -60,18 +61,6 @@ pub struct GetUpdates {
|
||||||
pub allowed_updates: Option<Vec<AllowedUpdate>>,
|
pub allowed_updates: Option<Vec<AllowedUpdate>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Deserialize, Serialize)]
|
|
||||||
#[serde(rename_all = "snake_case")]
|
|
||||||
pub enum AllowedUpdate {
|
|
||||||
Message,
|
|
||||||
EditedMessage,
|
|
||||||
ChannelPost,
|
|
||||||
EditedChannelPost,
|
|
||||||
InlineQuery,
|
|
||||||
ChosenInlineResult,
|
|
||||||
CallbackQuery,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Method for GetUpdates {
|
impl Method for GetUpdates {
|
||||||
type Output = Vec<Update>;
|
type Output = Vec<Update>;
|
||||||
|
|
||||||
|
|
13
src/types/allowed_update.rs
Normal file
13
src/types/allowed_update.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum AllowedUpdate {
|
||||||
|
Message,
|
||||||
|
EditedMessage,
|
||||||
|
ChannelPost,
|
||||||
|
EditedChannelPost,
|
||||||
|
InlineQuery,
|
||||||
|
ChosenInlineResult,
|
||||||
|
CallbackQuery,
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
//! API types.
|
//! API types.
|
||||||
|
|
||||||
|
pub use allowed_update::*;
|
||||||
pub use animation::*;
|
pub use animation::*;
|
||||||
pub use audio::*;
|
pub use audio::*;
|
||||||
pub use callback_game::*;
|
pub use callback_game::*;
|
||||||
|
@ -83,6 +84,7 @@ pub use video_note::*;
|
||||||
pub use voice::*;
|
pub use voice::*;
|
||||||
pub use webhook_info::*;
|
pub use webhook_info::*;
|
||||||
|
|
||||||
|
mod allowed_update;
|
||||||
mod animation;
|
mod animation;
|
||||||
mod audio;
|
mod audio;
|
||||||
mod callback_game;
|
mod callback_game;
|
||||||
|
|
Loading…
Reference in a new issue