Build JSON payload for actionable message cards easily with IntelliSense or similar systems. Skip the tedious looking up of documentation just to figure out how they spelled that field this time around.
Uses Json.NET as the rest of the C# world does when JSON is involved. Other than that, nothing.
- Because I hate referencing documentation continuously.
- Because I didn't look for any existing projects.
- Because it's not 1998, so string concatenation can die in a fire.
- Because I haven't found a decent templating library.
- Because creating dynamic objects and serializing fell down hard when a field
wanted to include an
@
, which C# decided should be removed. - Because.
var card = new Cardyff.MessageCard
{
Summary = "Someone set up us the bomb",
Title = "All your base are belong to us",
ThemeColor = "0078d7",
Sections = new[]
{
new Section()
{
ActivityTitle = "",
ActivitySubtitle = "CATS",
ActivityImage = "https://upload.wikimedia.org/wikipedia/en/0/03/Aybabtu.png",
Text = "All your base are belong to us",
Facts = new[]
{
new Fact()
{
Name = "Section:",
Value = "Introduction"
},
new Fact()
{
Name = "Location:",
Value = "Zero Wing"
}
}
}
},
Actions = new[]
{
new OpenUriAction()
{
Name = "View on Wikipedia",
Type = "OpenUri",
Targets = new[]
{
new OpenUriTarget()
{
OS = "default",
Uri = "https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"
}
}
}
}
};
JsonConvert.SerializeObject(card);
Card formatter functionality.
Also, I'm funny.
MIT. Always.