diff --git a/src/types.rs b/src/types.rs index d352caac..3b69e827 100644 --- a/src/types.rs +++ b/src/types.rs @@ -142,7 +142,6 @@ mod reply_keyboard_markup; mod reply_keyboard_remove; mod reply_markup; mod response_parameters; -mod send_invoice; mod shipping_address; mod shipping_option; mod shipping_query; diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index e9742921..444f45ec 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -69,7 +69,7 @@ pub enum MessageEntityKind { mod tests { use super::*; use crate::types::{ - Chat, ChatKind, ChatPrivate, ForwardKind, ForwardOrigin, MediaKind, MediaText, + Chat, ChatKind, ChatPrivate, ForwardKind, ForwardOrigin, MediaKind, MediaText, Message, MessageCommon, MessageKind, }; @@ -111,15 +111,6 @@ mod tests { ); } - #[test] - fn text_from() { - let message = message(); - let expected = Some("yes".to_string()); - let entity = message.entities().unwrap()[0].clone(); - let actual = entity.text_from(&message); - assert_eq!(actual, expected); - } - fn message() -> Message { Message { via_bot: None, diff --git a/src/types/send_invoice.rs b/src/types/send_invoice.rs deleted file mode 100644 index c2aedb61..00000000 --- a/src/types/send_invoice.rs +++ /dev/null @@ -1,228 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::types::{ChatId, InlineKeyboardMarkup, LabeledPrice}; - -// TODO: missing docs -#[serde_with_macros::skip_serializing_none] -#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct SendInvoice { - pub chat_id: ChatId, - pub title: String, - pub description: String, - pub payload: String, - pub provider_token: String, - pub start_parameter: String, - pub currency: String, - pub prices: Vec, - pub provider_data: Option, - pub photo_url: Option, - pub photo_size: Option, - pub photo_width: Option, - pub photo_height: Option, - pub need_name: Option, - pub need_phone_number: Option, - pub need_email: Option, - pub need_shipping_address: Option, - pub send_phone_number_to_provider: Option, - pub send_email_to_provider: Option, - pub is_flexible: Option, - pub disable_notification: Option, - pub reply_to_message_id: Option, - pub reply_markup: Option, -} - -impl SendInvoice { - #[allow(clippy::too_many_arguments)] - pub fn new( - chat_id: C, - title: S1, - description: S2, - payload: S3, - provider_token: S4, - start_parameter: S5, - currency: S6, - prices: P, - ) -> Self - where - C: Into, - S1: Into, - S2: Into, - S3: Into, - S4: Into, - S5: Into, - S6: Into, - P: Into>, - { - Self { - chat_id: chat_id.into(), - title: title.into(), - description: description.into(), - payload: payload.into(), - provider_token: provider_token.into(), - start_parameter: start_parameter.into(), - currency: currency.into(), - prices: prices.into(), - provider_data: None, - photo_url: None, - photo_size: None, - photo_width: None, - photo_height: None, - need_name: None, - need_phone_number: None, - need_email: None, - need_shipping_address: None, - send_phone_number_to_provider: None, - send_email_to_provider: None, - is_flexible: None, - disable_notification: None, - reply_to_message_id: None, - reply_markup: None, - } - } - - pub fn chat_id(mut self, val: C) -> Self - where - C: Into, - { - self.chat_id = val.into(); - self - } - - pub fn title(mut self, val: S) -> Self - where - S: Into, - { - self.title = val.into(); - self - } - - pub fn description(mut self, val: S) -> Self - where - S: Into, - { - self.description = val.into(); - self - } - - pub fn payload(mut self, val: S) -> Self - where - S: Into, - { - self.payload = val.into(); - self - } - - pub fn provider_token(mut self, val: S) -> Self - where - S: Into, - { - self.provider_token = val.into(); - self - } - - pub fn start_parameter(mut self, val: S) -> Self - where - S: Into, - { - self.start_parameter = val.into(); - self - } - - pub fn currency(mut self, val: S) -> Self - where - S: Into, - { - self.currency = val.into(); - self - } - - pub fn prices

(mut self, val: P) -> Self - where - P: Into>, - { - self.prices = val.into(); - self - } - - pub fn provider_data(mut self, val: S) -> Self - where - S: Into, - { - self.provider_data = Some(val.into()); - self - } - - pub fn photo_url(mut self, val: S) -> Self - where - S: Into, - { - self.photo_url = Some(val.into()); - self - } - - pub fn photo_size(mut self, val: i32) -> Self { - self.photo_size = Some(val); - self - } - - pub fn photo_width(mut self, val: i32) -> Self { - self.photo_width = Some(val); - self - } - - pub fn photo_height(mut self, val: i32) -> Self { - self.photo_height = Some(val); - self - } - - pub fn need_name(mut self, val: bool) -> Self { - self.need_name = Some(val); - self - } - - pub fn need_phone_number(mut self, val: bool) -> Self { - self.need_phone_number = Some(val); - self - } - - pub fn need_email(mut self, val: bool) -> Self { - self.need_email = Some(val); - self - } - - pub fn need_shipping_address(mut self, val: bool) -> Self { - self.need_shipping_address = Some(val); - self - } - - pub fn send_phone_number_to_provider(mut self, val: bool) -> Self { - self.send_phone_number_to_provider = Some(val); - self - } - - pub fn send_email_to_provider(mut self, val: bool) -> Self { - self.send_email_to_provider = Some(val); - self - } - - #[allow(clippy::wrong_self_convention)] - pub fn is_flexible(mut self, val: bool) -> Self { - self.is_flexible = Some(val); - self - } - - pub fn disable_notification(mut self, val: bool) -> Self { - self.disable_notification = Some(val); - self - } - - pub fn reply_to_message_id(mut self, value: i32) -> Self { - self.reply_to_message_id = Some(value); - self - } - - pub fn reply_markup(mut self, val: InlineKeyboardMarkup) -> Self { - self.reply_markup = Some(val); - self - } -}