Beispiel #1
0
 private static SlackAttachmentField MapAttachmentField(AttachmentField attachmentField)
 {
     return(new SlackAttachmentField
     {
         Title = attachmentField.Title,
         Value = attachmentField.Value,
         IsShort = attachmentField.IsShort
     });
 }
Beispiel #2
0
        /// <summary>
        /// Converts this <see cref="AttachmentField" /> into a dictionary suitable for JSON serialization.
        /// </summary>
        /// <param name="attachmentField">The attachment field.</param>
        /// <returns>
        /// The dictionary.
        /// </returns>
        public static Dictionary <string, object> ToJson(this AttachmentField attachmentField)
        {
            if (attachmentField == null)
            {
                throw new ArgumentNullException("attachmentField");
            }

            var o = new Dictionary <string, object>();

            o.Add("title", attachmentField.Title);
            o.Add("value", attachmentField.Value);
            if (attachmentField.IsShort)
            {
                o.Add("short", true);
            }
            return(o);
        }