// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Text.Json.Serialization; using EpicGames.Slack.Elements; namespace EpicGames.Slack.Blocks { /// /// Displays message context, which can include both images and text. /// public class ContextBlock : Block { /// /// An array of image elements and text objects. Maximum number of items is 10. /// [JsonPropertyName("elements")] public List Elements { get; } = new List(); /// /// Constructor /// public ContextBlock() : base("context") { } } /// /// Extension methods for /// public static class ContextBlockExtensions { /// /// Add an to the list of blocks /// /// Block container /// Configuration callback for the block public static void AddContext(this ISlackBlockContainer container, Action configure) { ContextBlock block = new ContextBlock(); configure(block); container.Blocks.Add(block); } /// /// Add an to the list of blocks /// /// Block container /// Configuration callback for the block public static ContextBlock AddContext(this ISlackBlockContainer container, TextObject text) { ContextBlock block = new ContextBlock(); block.Elements.Add(text); container.Blocks.Add(block); return block; } } }