teloxide/src/types/file.rs

30 lines
1 KiB
Rust
Raw Normal View History

use serde::{Deserialize, Serialize};
2020-02-02 17:03:18 +01:00
/// This object represents a file ready to be downloaded.
///
/// The file can be downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`.
2019-12-11 17:19:48 +01:00
/// It is guaranteed that the link will be valid for at least 1 hour. When the
/// link expires, a new one can be requested by calling [`Bot::get_file`].
///
/// [The official docs](https://core.telegram.org/bots/api#file).
///
/// [`Bot::get_file`]: crate::Bot::get_file
2020-01-05 04:14:04 +01:00
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct File {
2019-12-11 17:27:42 +01:00
/// Identifier for this file.
pub file_id: String,
2019-12-11 17:19:48 +01:00
/// Unique identifier for this file, which is supposed to be the same over
/// time and for different bots. Can't be used to download or reuse the
/// file.
pub file_unique_id: String,
2019-12-11 17:19:48 +01:00
/// File size, if known.
pub file_size: u32,
2019-12-11 17:19:48 +01:00
// TODO: chacge "Use ..." to use bot.download...
2019-12-11 17:19:48 +01:00
/// File path. Use `https://api.telegram.org/file/bot<token>/<file_path>`
/// to get the file.
2019-09-19 00:30:30 +02:00
pub file_path: String,
}