// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Text.Json.Serialization; using EpicGames.Slack.Elements; namespace EpicGames.Slack.Blocks { /// /// A simple image block, designed to make those cat photos really pop. /// public class ImageBlock : Block { /// /// The URL of the image to be displayed.Maximum length for this field is 3000 characters. /// [JsonPropertyName("image_url"), JsonPropertyOrder(1)] public Uri ImageUrl { get; set; } /// /// A plain-text summary of the image.This should not contain any markup.Maximum length for this field is 2000 characters. /// [JsonPropertyName("alt_text"), JsonPropertyOrder(2)] public string AltText { get; set; } /// /// An optional title for the image in the form of a text object that can only be of type: plain_text. Maximum length for the text in this field is 2000 characters. /// [JsonPropertyName("title"), JsonPropertyOrder(3)] public PlainTextObject? Title { get; set; } /// /// Constructor /// public ImageBlock(Uri imageUrl, string altText, PlainTextObject? title = null) : base("image") { ImageUrl = imageUrl; AltText = altText; Title = title; } } /// /// Extension methods for /// public static class ImageBlockExtensions { /// /// Add an to the list of blocks /// public static void AddImage(this ISlackBlockContainer container, Uri imageUrl, string altText, PlainTextObject? title = null) { ImageBlock block = new ImageBlock(imageUrl, altText, title); container.Blocks.Add(block); } } }