2019-12-30 11:14:19 +01:00
|
|
|
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).
|
|
|
|
///
|
2019-12-11 19:07:50 +01:00
|
|
|
/// [`Bot::get_file`]: crate::Bot::get_file
|
2020-01-05 04:14:04 +01:00
|
|
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
2019-09-12 15:51:45 +02:00
|
|
|
pub struct File {
|
2019-12-11 17:27:42 +01:00
|
|
|
/// Identifier for this file.
|
2019-09-12 15:51:45 +02:00
|
|
|
pub file_id: String,
|
2019-12-11 17:19:48 +01:00
|
|
|
|
2019-12-31 18:58:01 +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.
|
2019-09-12 15:51:45 +02:00
|
|
|
pub file_size: u32,
|
2019-12-11 17:19:48 +01:00
|
|
|
|
2019-12-30 11:44:22 +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,
|
2019-09-12 15:51:45 +02:00
|
|
|
}
|