Move AllowedUpdate into teloxide::types

This commit is contained in:
Temirkhan Myrzamadi 2020-01-02 03:31:35 +06:00
parent 7936558e54
commit 53f675c58a
5 changed files with 20 additions and 14 deletions

View file

@ -103,7 +103,9 @@
use futures::{stream, Stream, StreamExt};
use crate::{
bot::Bot, requests::payloads::AllowedUpdate, types::Update, RequestError,
bot::Bot,
types::{AllowedUpdate, Update},
RequestError,
};
use std::{convert::TryInto, time::Duration};

View file

@ -118,7 +118,7 @@ pub mod payloads {
mod set_chat_administrator_custom_title;
pub use {
get_updates::{GetUpdates, AllowedUpdate},
get_updates::GetUpdates,
set_webhook::SetWebhook,
delete_webhook::DeleteWebhook,
get_webhook_info::GetWebhookInfo,

View file

@ -4,6 +4,7 @@ use crate::{
requests::{dynamic, json, Method},
types::Update,
};
use crate::types::AllowedUpdate;
/// Use this method to receive incoming updates using long polling ([wiki]).
/// An array ([`Vec`]) of [`Update`]s is returned.
@ -60,18 +61,6 @@ pub struct GetUpdates {
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 {
type Output = Vec<Update>;

View 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,
}

View file

@ -1,5 +1,6 @@
//! API types.
pub use allowed_update::*;
pub use animation::*;
pub use audio::*;
pub use callback_game::*;
@ -83,6 +84,7 @@ pub use video_note::*;
pub use voice::*;
pub use webhook_info::*;
mod allowed_update;
mod animation;
mod audio;
mod callback_game;