1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
//! File block.
//!
//! <https://api.slack.com/reference/block-kit/blocks#file>
use crate::{BlockId, ExternalId};
use derive_new::new;
use serde::Serialize;
/// File block.
///
/// <https://api.slack.com/reference/block-kit/blocks#file>
#[derive(Serialize, Debug, Clone, new)]
#[serde(rename_all = "snake_case")]
pub struct FileBlock {
/// The external unique ID for this file.
pub external_id: ExternalId,
/// At the moment, `source` will always be `remote` for a remote file.
#[new(default)]
pub source: FileBlockSource,
/// A unique identifier for a block.
#[new(value = "None")]
#[serde(skip_serializing_if = "Option::is_none")]
pub block_id: Option<BlockId>,
}
/// A `source` field in File block.
///
/// <https://api.slack.com/reference/block-kit/blocks#file_fields>
#[derive(Serialize, Debug, Clone, Default)]
#[serde(rename_all = "snake_case")]
pub enum FileBlockSource {
/// The `source` will always be `remote`.
#[default]
Remote,
}