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 /// Optional identifier for the container.
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub id: Option<i32>,
15 /// Color for the accent on the container as RGB from `0x000000` to `0xFFFFFF`.
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub accent_color: Option<Option<u32>>,
18 /// Whether the container should be a spoiler (or blurred out). Defaults to `false`.
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub spoiler: Option<bool>,
21 /// Up to 10 components of the type action row, text display,
22 /// section, media gallery, separator, or file.
23 pub components: Vec<Component>,
24}