diff --git a/src/types/send_invoice.rs b/src/types/send_invoice.rs index e5ba0414..bc527b45 100644 --- a/src/types/send_invoice.rs +++ b/src/types/send_invoice.rs @@ -31,3 +31,199 @@ pub struct SendInvoice { 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 + } +}