use serde::{Deserialize, Serialize};
pub use self::{animation::*, audio::*, document::*, photo::*, video::*, video_note::*, voice::*};
use crate::{
api::{Method, Payload, PayloadError},
types::Integer,
};
mod animation;
mod audio;
mod document;
mod photo;
mod video;
mod video_note;
mod voice;
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
pub struct File {
pub file_id: String,
pub file_unique_id: String,
pub file_size: Option<Integer>,
pub file_path: Option<String>,
}
#[derive(Clone, Debug, Serialize)]
pub struct GetFile {
file_id: String,
}
impl GetFile {
pub fn new<T>(file_id: T) -> Self
where
T: Into<String>,
{
GetFile {
file_id: file_id.into(),
}
}
}
impl Method for GetFile {
type Response = File;
fn into_payload(self) -> Result<Payload, PayloadError> {
Payload::json("getFile", self)
}
}