twilight_model/channel/message/component/container.rs
1use serde::{Deserialize, Serialize};
2
3use super::Component;
4
5/// A Container is a top-level layout component that holds up to 10
6/// [`Component`]s. Containers are visually distinct from surrounding
7/// [`Component`]s and have an optional customizable color bar.
8///
9/// Containers are only available in messages.
10#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)]
11pub struct Container {
12 /// Color for the accent on the container as RGB from `0x000000` to `0xFFFFFF`.
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub accent_color: Option<Option<u32>>,
15 /// Up to 10 components of the type action row, text display,
16 /// section, media gallery, separator, or file.
17 pub components: Vec<Component>,
18 /// Optional identifier for the container.
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub id: Option<i32>,
21 /// Whether the container should be a spoiler (or blurred out). Defaults to `false`.
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub spoiler: Option<bool>,
24}