mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-09 11:43:57 +01:00
Add setters to SendInvoice
This commit is contained in:
parent
48471e6938
commit
0c6c567146
1 changed files with 196 additions and 0 deletions
|
@ -31,3 +31,199 @@ pub struct SendInvoice {
|
|||
pub reply_to_message_id: Option<i32>,
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
}
|
||||
|
||||
impl SendInvoice {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new<C, S1, S2, S3, S4, S5, S6, P>(
|
||||
chat_id: C,
|
||||
title: S1,
|
||||
description: S2,
|
||||
payload: S3,
|
||||
provider_token: S4,
|
||||
start_parameter: S5,
|
||||
currency: S6,
|
||||
prices: P,
|
||||
) -> Self
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
S1: Into<String>,
|
||||
S2: Into<String>,
|
||||
S3: Into<String>,
|
||||
S4: Into<String>,
|
||||
S5: Into<String>,
|
||||
S6: Into<String>,
|
||||
P: Into<Vec<LabeledPrice>>,
|
||||
{
|
||||
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<C>(mut self, val: C) -> Self
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
self.chat_id = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn title<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.title = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn description<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.description = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn payload<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.payload = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn provider_token<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.provider_token = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn start_parameter<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.start_parameter = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn currency<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.currency = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn prices<P>(mut self, val: P) -> Self
|
||||
where
|
||||
P: Into<Vec<LabeledPrice>>,
|
||||
{
|
||||
self.prices = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn provider_data<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.provider_data = Some(val.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn photo_url<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue