Added PhotoSize, removed use serde::... in **/types/*

This commit is contained in:
Mr-Andersen 2019-09-03 21:11:39 +03:00
parent e41d62a27f
commit 2d074e73e2
36 changed files with 18 additions and 65 deletions

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct AnswerPreCheckoutQuery { pub struct AnswerPreCheckoutQuery {
pub pre_checkout_query_id: String, pub pre_checkout_query_id: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::ShippingOption; use crate::core::types::ShippingOption;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,7 +1,7 @@
use crate::core::types::PhotoSize; use crate::core::types::PhotoSize;
#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Audio { pub struct Audio {
pub file_id: String, pub file_id: String,
pub duration: u32, pub duration: u32,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// This object represents an incoming callback query from a callback button in an inline keyboard. /// This object represents an incoming callback query from a callback button in an inline keyboard.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct CallbackQuery { pub struct CallbackQuery {

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::{ChatPermissions, ChatPhoto, Message}; use crate::core::types::{ChatPermissions, ChatPhoto, Message};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ChatPermissions { pub struct ChatPermissions {
pub can_send_messages: Option<bool>, pub can_send_messages: Option<bool>,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ChatPhoto { pub struct ChatPhoto {
pub small_file_id: String, pub small_file_id: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::user::User; use crate::core::types::user::User;
#[derive(Debug, Deserealize)] #[derive(Debug, Deserealize)]

View file

@ -1,6 +1,7 @@
use crate::core::types::{PhotoSize, UnsignedInteger}; use crate::core::types::{PhotoSize, UnsignedInteger};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
pub struct Document { pub struct Document {
pub file_id: String, pub file_id: String,
pub thumb: Option<PhotoSize>, pub thumb: Option<PhotoSize>,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// Upon receiving a message with this object, Telegram clients will /// Upon receiving a message with this object, Telegram clients will
/// display a reply interface to the user (act as if the user has /// display a reply interface to the user (act as if the user has
/// selected the bots message and tapped Reply'). This can be /// selected the bots message and tapped Reply'). This can be

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// This object represents one button of an inline keyboard. /// This object represents one button of an inline keyboard.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct InlineKeyboardButton { pub struct InlineKeyboardButton {

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// This object represents an inline keyboard that appears right next to the message it belongs to. /// This object represents an inline keyboard that appears right next to the message it belongs to.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct InlineKeyboardMarkup { pub struct InlineKeyboardMarkup {

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Hash, PartialEq, Eq)] #[derive(Debug, Hash, PartialEq, Eq)]
pub enum InputFile { pub enum InputFile {
File(std::path::PathBuf), File(std::path::PathBuf),

View file

@ -1,4 +1,3 @@
use serde::Deserialize;
use crate::core::types::{InputFile, ParseMode}; use crate::core::types::{InputFile, ParseMode};
// TODO: should variants use new-type? // TODO: should variants use new-type?

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Invoice { pub struct Invoice {
pub title: String, pub title: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// This object represents one button of the reply keyboard. /// This object represents one button of the reply keyboard.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct KeyboardButton { pub struct KeyboardButton {

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct LabeledPrice { pub struct LabeledPrice {
pub label: String, pub label: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct LoginUrl { pub struct LoginUrl {
url: String, url: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct MaskPosition { pub struct MaskPosition {
pub point: String, pub point: String,

View file

@ -1,5 +1,3 @@
// use serde::Deserialize;
use crate::core::types::{ use crate::core::types::{
Animation, Audio, Chat, Contact, Document, Game, InlineKeyboardMarkup, Invoice, Location, Animation, Audio, Chat, Contact, Document, Game, InlineKeyboardMarkup, Invoice, Location,
MessageEntity, PassportData, PhotoSize, Poll, Sticker, SuccessfulPayment, User, Venue, Video, MessageEntity, PassportData, PhotoSize, Poll, Sticker, SuccessfulPayment, User, Venue, Video,

View file

@ -1,6 +1,7 @@
use crate::core::types::User; use crate::core::types::User;
#[derive(Deserialize, Debug, PartialEq, Hash, Eq)]
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
pub struct MessageEntity { pub struct MessageEntity {
#[serde(flatten)] #[serde(flatten)]
pub kind: MessageEntityKind, pub kind: MessageEntityKind,
@ -8,6 +9,7 @@ pub struct MessageEntity {
pub length: usize, pub length: usize,
} }
#[derive(Deserialize, Debug, PartialEq, Hash, Eq)] #[derive(Deserialize, Debug, PartialEq, Hash, Eq)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
#[serde(tag = "type")] #[serde(tag = "type")]

View file

@ -19,6 +19,7 @@ pub use self::{
message::Message, message::Message,
message_entity::MessageEntity, message_entity::MessageEntity,
order_info::OrderInfo, order_info::OrderInfo,
photo_size::PhotoSize,
pre_checkout_query::PreCheckoutQuery, pre_checkout_query::PreCheckoutQuery,
send_invoice::SendInvoice, send_invoice::SendInvoice,
shipping_address::ShippingAddress, shipping_address::ShippingAddress,
@ -46,6 +47,7 @@ mod message;
mod message_entity; mod message_entity;
mod not_implemented_types; mod not_implemented_types;
mod order_info; mod order_info;
mod photo_size;
mod pre_checkout_query; mod pre_checkout_query;
mod send_invoice; mod send_invoice;
mod shipping_address; mod shipping_address;

View file

@ -1,6 +1,3 @@
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
pub struct PhotoSize;
#[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)] #[derive(Debug, Deserialize, Serialize, PartialEq, Hash, Eq)]
pub struct Location; pub struct Location;

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::ShippingAddress; use crate::core::types::ShippingAddress;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -0,0 +1,10 @@
use crate::core::types::{Integer, UnsignedInteger};
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct PhotoSize {
pub file_id: String,
pub width: Integer,
pub heigth: Integer,
pub file_size: Option<UnsignedInteger>
}

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::{OrderInfo, User}; use crate::core::types::{OrderInfo, User};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// This object represents a custom keyboard with reply options. /// This object represents a custom keyboard with reply options.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ReplyKeyboardMarkup { pub struct ReplyKeyboardMarkup {

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
/// Upon receiving a message with this object, Telegram clients will remove /// Upon receiving a message with this object, Telegram clients will remove
/// the current custom keyboard and display the default letter-keyboard. /// the current custom keyboard and display the default letter-keyboard.
/// By default, custom keyboards are displayed until a new keyboard is sent /// By default, custom keyboards are displayed until a new keyboard is sent

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ResponseParameters { pub struct ResponseParameters {
migrate_to_chat_id: Option<i64>, migrate_to_chat_id: Option<i64>,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ShippingAddress { pub struct ShippingAddress {
pub country_code: String, pub country_code: String,

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::LabeledPrice; use crate::core::types::LabeledPrice;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::{ShippingAddress, User}; use crate::core::types::{ShippingAddress, User};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::{MaskPosition, PhotoSize}; use crate::core::types::{MaskPosition, PhotoSize};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::Sticker; use crate::core::types::Sticker;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
use crate::core::types::OrderInfo; use crate::core::types::OrderInfo;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]

View file

@ -1,5 +1,3 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct User { pub struct User {
pub id: i64, pub id: i64,