Create all interaction models

This commit is contained in:
Daan Boerlage 2021-09-20 01:28:26 +02:00
parent 209887e237
commit 60547140ea
Signed by: daan
GPG key ID: FCE070E1E4956606
59 changed files with 1589 additions and 222 deletions

View file

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object" />
public record Embed
{
/// <summary>
/// title of embed
/// </summary>
[JsonPropertyName("title")]
public string Title { get; set; }
/// <summary>
/// type of embed (always "rich" for webhook embeds)
/// </summary>
[JsonPropertyName("type")]
public EmbedTypes Type { get; set; }
/// <summary>
/// description of embed
/// </summary>
[JsonPropertyName("description")]
public string Description { get; set; }
/// <summary>
/// url of embed
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
/// <summary>
/// timestamp of embed content
/// </summary>
[JsonPropertyName("timestamp")]
public DateTime? Timestamp { get; set; }
/// <summary>
/// color code of the embed
/// </summary>
[JsonPropertyName("color")]
public int Color { get; set; }
/// <summary>
/// footer information
/// </summary>
[JsonPropertyName("footer")]
public EmbedFooter Footer { get; set; }
/// <summary>
/// image information
/// </summary>
[JsonPropertyName("image")]
public EmbedImage Image { get; set; }
/// <summary>
/// thumbnail information
/// </summary>
[JsonPropertyName("thumbnail")]
public EmbedThumbnail Thumbnail { get; set; }
/// <summary>
/// video information
/// </summary>
[JsonPropertyName("video")]
public EmbedVideo Video { get; set; }
/// <summary>
/// provider information
/// </summary>
[JsonPropertyName("provider")]
public EmbedProvider Provider { get; set; }
/// <summary>
/// author information
/// </summary>
[JsonPropertyName("author")]
public EmbedAuthor Author { get; set; }
/// <summary>
/// fields information
/// </summary>
[JsonPropertyName("fields")]
public List<EmbedField> Fields { get; set; }
}
}

View file

@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
public record EmbedAuthor
{
/// <summary>
/// name of author
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// url of author
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
/// <summary>
/// url of author icon (only supports http(s) and attachments)
/// </summary>
[JsonPropertyName("icon_url")]
public string IconUrl { get; set; }
/// <summary>
/// a proxied url of author icon
/// </summary>
[JsonPropertyName("proxy_icon_url")]
public string ProxyIconUrl { get; set; }
}
}

View file

@ -0,0 +1,26 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure" />
public record EmbedField
{
/// <summary>
/// name of the field
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// value of the field
/// </summary>
[JsonPropertyName("value")]
public string Value { get; set; }
/// <summary>
/// whether or not this field should display inline
/// </summary>
[JsonPropertyName("inline")]
public bool Inline { get; set; }
}
}

View file

@ -0,0 +1,27 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure" />
public record EmbedFooter
{
/// <summary>
/// footer text
/// </summary>
[JsonPropertyName("text")]
public string Text { get; set; }
/// <summary>
/// url of footer icon (only supports http(s) and attachments)
/// </summary>
[JsonPropertyName("icon_url")]
public string IconUrl { get; set; }
/// <summary>
/// a proxied url of footer icon
/// </summary>
[JsonPropertyName("proxy_icon_url")]
public string ProxyIconUrl { get; set; }
}
}

View file

@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure" />
public record EmbedImage
{
/// <summary>
/// source url of image (only supports http(s) and attachments)
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
/// <summary>
/// a proxied url of the image
/// </summary>
[JsonPropertyName("proxy_url")]
public string ProxyUrl { get; set; }
/// <summary>
/// height of image
/// </summary>
[JsonPropertyName("height")]
public int Height { get; set; }
/// <summary>
/// width of image
/// </summary>
[JsonPropertyName("width")]
public int Width { get; set; }
}
}

View file

@ -0,0 +1,20 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure" />
public record EmbedProvider
{
/// <summary>
/// name of provider
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// url of provider
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
}
}

View file

@ -0,0 +1,33 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure" />
public record EmbedThumbnail
{
/// <summary>
/// source url of thumbnail (only supports http(s) and attachments)
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
/// <summary>
/// a proxied url of the thumbnail
/// </summary>
[JsonPropertyName("proxy_url")]
public string ProxyUrl { get; set; }
/// <summary>
/// height of thumbnail
/// </summary>
[JsonPropertyName("height")]
public int Height { get; set; }
/// <summary>
/// width of thumbnail
/// </summary>
[JsonPropertyName("width")]
public int Width { get; set; }
}
}

View file

@ -0,0 +1,49 @@
using System.Runtime.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <summary>
/// Embed types are "loosely defined" and, for the most part, are not used by our clients for rendering.
/// Embed attributes power what is rendered.
/// Embed types should be considered deprecated and might be removed in a future API version.
/// </summary>
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-types" />
public enum EmbedTypes
{
/// <summary>
/// generic embed rendered from embed attributes
/// </summary>
[EnumMember(Value = "rich")]
Rich,
/// <summary>
/// image embed
/// </summary>
[EnumMember(Value = "image")]
Image,
/// <summary>
/// video embed
/// </summary>
[EnumMember(Value = "video")]
Video,
/// <summary>
/// animated gif image embed rendered as a video embed
/// </summary>
[EnumMember(Value = "gifv")]
Gifv,
/// <summary>
/// article embed
/// </summary>
[EnumMember(Value = "article")]
Article,
/// <summary>
/// link embed
/// </summary>
[EnumMember(Value = "link")]
Link,
}
}

View file

@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
namespace Geekbot.Core.Interactions.Embed
{
/// <see href="https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure" />
public record EmbedVideo
{
/// <summary>
/// source url of video
/// </summary>
[JsonPropertyName("url")]
public string Url { get; set; }
/// <summary>
/// a proxied url of the video
/// </summary>
[JsonPropertyName("proxy_url")]
public string ProxyUrl { get; set; }
/// <summary>
/// height of video
/// </summary>
[JsonPropertyName("height")]
public int Height { get; set; }
/// <summary>
/// width of video
/// </summary>
[JsonPropertyName("width")]
public int Width { get; set; }
}
}