Browse Source

rest: add webhook model (#1435)

next
Patrick Michallet Christopher F 5 years ago
parent
commit
68f89bf2fc
2 changed files with 41 additions and 0 deletions
  1. +33
    -0
      src/Discord.Net/Rest/Models/Webhook/Webhook.cs
  2. +8
    -0
      src/Discord.Net/Rest/Models/Webhook/WebhookType.cs

+ 33
- 0
src/Discord.Net/Rest/Models/Webhook/Webhook.cs View File

@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;

namespace Discord.Models
{
public class Webhook
{
public const int MinWebhookNameLength = 2;
public const int MaxWebhookNameLength = 32;

public const int MinMessageContentLength = 0;
public const int MaxMessageContentLength = 2000;

public const int MinEmbedLimit = 0;
public const int MaxEmbedLimit = 10;

[JsonPropertyName("id")]
public Snowflake Id { get; set; }
[JsonPropertyName("type")]
public WebhookType Type { get; set; }
[JsonPropertyName("guild_id")]
public Optional<Snowflake> GuildId { get; set; }
[JsonPropertyName("channel_id")]
public Snowflake ChannelId { get; set; }
[JsonPropertyName("user")]
public Optional<User> Creator { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
[JsonPropertyName("avatar")]
public string? AvatarId { get; set; }
[JsonPropertyName("token")]
public Optional<string> Token { get; set; }
}
}

+ 8
- 0
src/Discord.Net/Rest/Models/Webhook/WebhookType.cs View File

@@ -0,0 +1,8 @@
namespace Discord.Models
{
public enum WebhookType : byte
{
Incoming = 1,
ChannelFollower = 2
}
}

Loading…
Cancel
Save