Replace i64 with i32

This commit is contained in:
Waffle 2019-09-17 20:43:31 +03:00
parent 2bc2ce5663
commit 5124750be9
17 changed files with 32 additions and 31 deletions

View file

@ -92,7 +92,7 @@ impl Bot {
where
C: Into<ChatId>,
F: Into<ChatId>,
M: Into<i64>,
M: Into<i32>,
{
ForwardMessage::new(
self.ctx(),

View file

@ -23,7 +23,7 @@ pub struct EditMessageLiveLocation<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
/// Required if inline_message_id is not specified. Identifier of the
/// message to edit
message_id: Option<i64>,
message_id: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
/// Required if chat_id and message_id are not specified. Identifier of
/// the inline message
@ -75,7 +75,7 @@ impl<'a> EditMessageLiveLocation<'a> {
self
}
pub fn message_id<T: Into<i64>>(mut self, message_id: T) -> Self {
pub fn message_id<T: Into<i32>>(mut self, message_id: T) -> Self {
self.message_id = Some(message_id.into());
self
}

View file

@ -24,7 +24,7 @@ pub struct ForwardMessage<'a> {
/// (in the format @channelusername)
pub from_chat_id: ChatId,
/// Message identifier in the chat specified in from_chat_id
pub message_id: i64,
pub message_id: i32,
/// Sends the message silently. Users will receive a notification with no
/// sound.
@ -53,7 +53,7 @@ impl<'a> ForwardMessage<'a> {
ctx: RequestContext<'a>,
chat_id: ChatId,
from_chat_id: ChatId,
message_id: i64,
message_id: i32,
) -> Self {
Self {
ctx,
@ -74,7 +74,7 @@ impl<'a> ForwardMessage<'a> {
self
}
pub fn message_id<T: Into<i64>>(mut self, val: T) -> Self {
pub fn message_id<T: Into<i32>>(mut self, val: T) -> Self {
self.message_id = val.into();
self
}

View file

@ -55,7 +55,7 @@ pub struct SendAudio<'a> {
/// sound.
pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: Option<i64>,
pub reply_to_message_id: Option<i32>,
pub reply_markup: Option<ReplyMarkup>,
}
@ -174,7 +174,7 @@ impl<'a> SendAudio<'a> {
self
}
pub fn reply_to_message_id<T: Into<i64>>(
pub fn reply_to_message_id<T: Into<i32>>(
mut self,
reply_to_message_id: T,
) -> Self {

View file

@ -33,7 +33,7 @@ pub struct SendLocation<'a> {
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
/// If the message is a reply, ID of the original message
reply_to_message_id: Option<i64>,
reply_to_message_id: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<ReplyMarkup>,
}
@ -98,7 +98,7 @@ impl<'a> SendLocation<'a> {
self
}
pub fn reply_to_message_id<T: Into<i64>>(mut self, val: T) -> Self {
pub fn reply_to_message_id<T: Into<i32>>(mut self, val: T) -> Self {
self.reply_to_message_id = Some(val.into());
self
}

View file

@ -17,7 +17,7 @@ pub struct SendMediaGroup<'a> {
pub media: Vec<InputMedia>,
pub disable_notification: Option<bool>,
pub reply_to_message_id: Option<i64>,
pub reply_to_message_id: Option<i32>,
}
impl<'a> Request<'a> for SendMediaGroup<'a> {
@ -96,7 +96,7 @@ impl<'a> SendMediaGroup<'a> {
self
}
pub fn reply_to_message_id<T: Into<i64>>(mut self, val: T) -> Self {
pub fn reply_to_message_id<T: Into<i32>>(mut self, val: T) -> Self {
self.reply_to_message_id = Some(val.into());
self
}

View file

@ -42,7 +42,7 @@ pub struct SendMessage<'a> {
pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_to_message_id: Option<i64>,
pub reply_to_message_id: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<ReplyMarkup>,
}
@ -106,7 +106,7 @@ impl<'a> SendMessage<'a> {
self
}
pub fn reply_to_message_id<T: Into<i64>>(mut self, val: T) -> Self {
pub fn reply_to_message_id<T: Into<i32>>(mut self, val: T) -> Self {
self.reply_to_message_id = Some(val.into());
self
}

View file

@ -39,7 +39,7 @@ pub struct SendPhoto<'a> {
/// sound.
pub disable_notification: Option<bool>,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: Option<i64>,
pub reply_to_message_id: Option<i32>,
pub reply_markup: Option<ReplyMarkup>,
}
@ -125,7 +125,7 @@ impl<'a> SendPhoto<'a> {
self
}
pub fn reply_to_message_id<T: Into<i64>>(
pub fn reply_to_message_id<T: Into<i32>>(
mut self,
reply_to_message_id: T,
) -> Self {

View file

@ -8,7 +8,7 @@ pub struct Contact {
/// Optional. Contact's last name
pub last_name: Option<String>,
/// Optional. Contact's user identifier in Telegram
pub user_id: Option<i64>,
pub user_id: Option<i32>,
/// Optional. Additional data about the contact in the form of a
/// [vCard](https://en.wikipedia.org/wiki/VCard)
pub vcard: Option<String>,

View file

@ -4,5 +4,5 @@ pub struct Invoice {
pub description: String,
pub start_parameter: String,
pub currency: String,
pub total_amount: i64,
pub total_amount: i32,
}

View file

@ -9,7 +9,7 @@ pub struct LabeledPrice {
/// amount = 145. See the exp parameter in [`currencies.json`](https://core.telegram.org/bots/payments/currencies.json),
/// it shows the number of digits past the decimal point for each currency
/// (2 for the majority of currencies).
pub amount: i64,
pub amount: i32,
}
#[cfg(test)]

View file

@ -7,7 +7,7 @@ use crate::core::types::{
#[derive(Debug, Deserialize, PartialEq, Clone)]
pub struct Message {
#[serde(rename = "message_id")]
pub id: i64,
pub id: i32,
pub date: i32,
pub chat: Chat,
#[serde(flatten)]
@ -91,7 +91,7 @@ pub enum ForwardKind {
#[serde(rename = "forward_from_chat")]
chat: Chat,
#[serde(rename = "forward_from_message_id")]
message_id: i64,
message_id: i32,
#[serde(rename = "forward_signature")]
signature: Option<String>,
},

View file

@ -5,7 +5,7 @@ pub struct PreCheckoutQuery {
pub id: String,
pub from: User,
pub currency: String,
pub total_amount: i64,
pub total_amount: i32,
pub invoice_payload: String,
pub shipping_option_id: Option<String>,
pub order_info: Option<OrderInfo>,

View file

@ -2,7 +2,7 @@
#[serde(rename_all = "snake_case")]
pub enum ResponseParameters {
MigrateToChatId(i64),
RetryAfter(i64),
RetryAfter(i32),
}
#[cfg(test)]

View file

@ -1,8 +1,9 @@
use crate::core::types::{InlineKeyboardMarkup, LabeledPrice};
use crate::core::requests::ChatId;
#[derive(Debug, Hash, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct SendInvoice {
pub chat_id: i64,
pub chat_id: ChatId,
pub title: String,
pub description: String,
pub payload: String,
@ -12,9 +13,9 @@ pub struct SendInvoice {
pub prices: Vec<LabeledPrice>,
pub provider_data: Option<String>,
pub photo_url: Option<String>,
pub photo_size: Option<i64>,
pub photo_width: Option<i64>,
pub photo_height: Option<i64>,
pub photo_size: Option<i32>,
pub photo_width: Option<i32>,
pub photo_height: Option<i32>,
pub need_name: Option<bool>,
pub need_phone_number: Option<bool>,
pub need_email: Option<bool>,
@ -23,6 +24,6 @@ pub struct SendInvoice {
pub send_email_to_provider: Option<bool>,
pub is_flexible: Option<bool>,
pub disable_notification: Option<bool>,
pub reply_to_message_id: Option<i64>,
pub reply_to_message_id: Option<i32>,
pub reply_markup: Option<InlineKeyboardMarkup>,
}

View file

@ -3,7 +3,7 @@ use crate::core::types::OrderInfo;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
pub struct SuccessfulPayment {
pub currency: String,
pub total_amount: i64,
pub total_amount: i32,
pub invoice_payload: String,
pub shipping_option_id: Option<String>,
pub order_info: Option<OrderInfo>,

View file

@ -1,6 +1,6 @@
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
pub struct User {
pub id: i64,
pub id: i32,
pub is_bot: bool,
pub first_name: String,
pub last_name: Option<String>,