diff --git a/src/adaptors/auto_send.rs b/src/adaptors/auto_send.rs index c496d899..b1312b95 100644 --- a/src/adaptors/auto_send.rs +++ b/src/adaptors/auto_send.rs @@ -106,8 +106,7 @@ where set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => f, fty + approve_chat_join_request, decline_chat_join_request => f, fty } } diff --git a/src/adaptors/cache_me.rs b/src/adaptors/cache_me.rs index 99f8c5d5..65fd207e 100644 --- a/src/adaptors/cache_me.rs +++ b/src/adaptors/cache_me.rs @@ -113,8 +113,7 @@ where set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => f, fty + approve_chat_join_request, decline_chat_join_request => f, fty } } diff --git a/src/adaptors/erased.rs b/src/adaptors/erased.rs index 585f199e..65f89f2f 100644 --- a/src/adaptors/erased.rs +++ b/src/adaptors/erased.rs @@ -182,8 +182,7 @@ where set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => fwd_erased, fty + approve_chat_join_request, decline_chat_join_request => fwd_erased, fty } } @@ -692,8 +691,6 @@ trait ErasableRequester<'a> { user_id: i64, target: TargetMessage, ) -> ErasedRequest<'a, GetGameHighScores, Self::Err>; - - fn get_updates_fault_tolerant(&self) -> ErasedRequest<'a, GetUpdatesFaultTolerant, Self::Err>; } impl<'a, B> ErasableRequester<'a> for B @@ -1401,8 +1398,4 @@ where ) -> ErasedRequest<'a, GetGameHighScores, Self::Err> { Requester::get_game_high_scores(self, user_id, target).erase() } - - fn get_updates_fault_tolerant(&self) -> ErasedRequest<'a, GetUpdatesFaultTolerant, Self::Err> { - Requester::get_updates_fault_tolerant(self).erase() - } } diff --git a/src/adaptors/parse_mode.rs b/src/adaptors/parse_mode.rs index c347c428..2433765e 100644 --- a/src/adaptors/parse_mode.rs +++ b/src/adaptors/parse_mode.rs @@ -117,8 +117,7 @@ impl Requester for DefaultParseMode { set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => fid, fty + approve_chat_join_request, decline_chat_join_request => fid, fty } } diff --git a/src/adaptors/throttle.rs b/src/adaptors/throttle.rs index 291e389a..3e8ef88b 100644 --- a/src/adaptors/throttle.rs +++ b/src/adaptors/throttle.rs @@ -621,7 +621,7 @@ where set_sticker_set_thumb, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, approve_chat_join_request, decline_chat_join_request, - get_game_high_scores, get_updates_fault_tolerant => fid, ftyid + get_game_high_scores => fid, ftyid } } diff --git a/src/adaptors/trace.rs b/src/adaptors/trace.rs index 6139070c..eedeea3f 100644 --- a/src/adaptors/trace.rs +++ b/src/adaptors/trace.rs @@ -138,8 +138,7 @@ where set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => fwd_inner, fty + approve_chat_join_request, decline_chat_join_request => fwd_inner, fty } } diff --git a/src/bot/api.rs b/src/bot/api.rs index 750a8f1a..580fc0db 100644 --- a/src/bot/api.rs +++ b/src/bot/api.rs @@ -1106,13 +1106,4 @@ impl Requester for Bot { { Self::UnpinAllChatMessages::new(self.clone(), payloads::UnpinAllChatMessages::new(chat_id)) } - - type GetUpdatesFaultTolerant = JsonRequest; - - fn get_updates_fault_tolerant(&self) -> Self::GetUpdatesFaultTolerant { - Self::GetUpdatesFaultTolerant::new( - self.clone(), - payloads::GetUpdatesFaultTolerant(payloads::GetUpdates::new()), - ) - } } diff --git a/src/local_macros.rs b/src/local_macros.rs index 626789de..dd26e196 100644 --- a/src/local_macros.rs +++ b/src/local_macros.rs @@ -1195,13 +1195,4 @@ macro_rules! requester_forward { $body!(get_game_high_scores this (user_id: i64, target: T)) } }; - (@method get_updates_fault_tolerant $body:ident $ty:ident) => { - type GetUpdatesFaultTolerant = $ty![GetUpdatesFaultTolerant]; - - fn get_updates_fault_tolerant(&self) -> Self::GetUpdatesFaultTolerant { - let this = self; - $body!(get_updates_fault_tolerant this ()) - } - }; - } diff --git a/src/payloads.rs b/src/payloads.rs index d069ce5f..5e8d33cb 100644 --- a/src/payloads.rs +++ b/src/payloads.rs @@ -213,7 +213,3 @@ pub use unpin_chat_message::{UnpinChatMessage, UnpinChatMessageSetters}; pub use upload_sticker_file::{UploadStickerFile, UploadStickerFileSetters}; // end of auto generated block - -mod get_updates_fault_tolerant; - -pub use get_updates_fault_tolerant::GetUpdatesFaultTolerant; diff --git a/src/payloads/get_updates_fault_tolerant.rs b/src/payloads/get_updates_fault_tolerant.rs deleted file mode 100644 index 1d3276e0..00000000 --- a/src/payloads/get_updates_fault_tolerant.rs +++ /dev/null @@ -1,18 +0,0 @@ -use serde::Serialize; - -use crate::{ - payloads::GetUpdates, - requests::Payload, - types::{SemiparsedVec, Update}, -}; - -/// The fault tolerant version of [`GetUpdates`]. -#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)] -#[serde(transparent)] -pub struct GetUpdatesFaultTolerant(pub GetUpdates); - -impl Payload for GetUpdatesFaultTolerant { - type Output = SemiparsedVec; - - const NAME: &'static str = GetUpdates::NAME; -} diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 342e1fb4..899342ed 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -856,11 +856,6 @@ pub trait Requester { fn get_game_high_scores(&self, user_id: i64, target: T) -> Self::GetGameHighScores where T: Into; - - type GetUpdatesFaultTolerant: Request; - - /// For Telegram documentation see [`GetUpdatesFaultTolerant`]. - fn get_updates_fault_tolerant(&self) -> Self::GetUpdatesFaultTolerant; } macro_rules! fty { @@ -901,8 +896,7 @@ macro_rules! forward_all { set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => fwd_deref, fty + approve_chat_join_request, decline_chat_join_request => fwd_deref, fty } }; } @@ -998,7 +992,6 @@ where set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors, send_game, set_game_score, set_game_score_inline, get_game_high_scores, - approve_chat_join_request, decline_chat_join_request, - get_updates_fault_tolerant => fwd_either, fty_either + approve_chat_join_request, decline_chat_join_request => fwd_either, fty_either } } diff --git a/src/types.rs b/src/types.rs index 06fdf594..d4ba801e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -214,12 +214,11 @@ mod passport_data; mod passport_element_error; mod passport_file; -pub use non_telegram_types::{country_code::*, currency::*, semiparsed_vec::*, until_date::*}; +pub use non_telegram_types::{country_code::*, currency::*, until_date::*}; mod non_telegram_types { pub(super) mod country_code; pub(super) mod currency; pub(crate) mod mime; - pub(super) mod semiparsed_vec; pub(super) mod until_date; } diff --git a/src/types/non_telegram_types/semiparsed_vec.rs b/src/types/non_telegram_types/semiparsed_vec.rs deleted file mode 100644 index 6d2e5916..00000000 --- a/src/types/non_telegram_types/semiparsed_vec.rs +++ /dev/null @@ -1,55 +0,0 @@ -use serde::de::DeserializeOwned; -use serde_json::{from_value, Value}; - -/// A vector of possibly unparsed JSON objects. -/// -/// Similar to `Vec` but if it fails to deserialize element, it just saves -/// `Err((serde_json::Value, serde_json::Error))`. -#[derive(Debug, serde::Deserialize)] -#[serde(from = "Vec")] -#[serde(bound = "T: DeserializeOwned")] -pub struct SemiparsedVec(pub Vec>); - -impl From> for SemiparsedVec { - fn from(vec: Vec) -> Self { - Self( - vec.into_iter() - .map(|val| from_value(val.clone()).map_err(|e| (val, e))) - .collect(), - ) - } -} - -#[test] -fn test() { - use crate::types::Update; - - let x: SemiparsedVec = serde_json::from_str( - r#"[{ - "update_id": 923808447, - "message": { - "message_id": 361678, - "from": { - "id": 218485655, - "is_bot": false, - "first_name": "вафель", - "last_name": "🧇", - "username": "WaffleLapkin", - "language_code": "en" - }, - "chat": { - "id": 218485655, - "first_name": "вафель", - "last_name": "🧇", - "username": "WaffleLapkin", - "type": "private" - }, - "date": 1595860067, - "text": "s" - } - }]"#, - ) - .unwrap(); - - assert!(x.0.first().unwrap().is_ok()) -}