using System.Text.Json.Serialization; namespace Discord.Net.Models { /// /// Represents a webhook object. /// public record Webhook { /// /// Creates a with the provided parameters. /// /// The id of the webhook. /// The type of the webhook. /// The guild id this webhook is for, if any. /// The channel id this webhook is for, if any. /// The user this webhook was created by (not returned when getting a webhook with its token). /// The default name of the webhook. /// The default user avatar hash of the webhook. /// The secure token of the webhook (returned for Incoming Webhooks). /// The bot/OAuth2 application that created this webhook. /// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks). /// The channel that this webhook is following (returned for Channel Follower Webhooks). /// The url used for executing the webhook (returned by the webhooks OAuth2 flow). [JsonConstructor] public Webhook(Snowflake id, WebhookType type, Optional guildId, Snowflake? channelId, Optional user, string? name, string? avatar, Optional token, Snowflake? applicationId, Optional sourceGuild, Optional sourceChannel, Optional url) { Id = id; Type = type; GuildId = guildId; ChannelId = channelId; User = user; Name = name; Avatar = avatar; Token = token; ApplicationId = applicationId; SourceGuild = sourceGuild; SourceChannel = sourceChannel; Url = url; } /// /// The id of the webhook. /// [JsonPropertyName("id")] public Snowflake Id { get; } /// /// The type of the webhook. /// [JsonPropertyName("type")] public WebhookType Type { get; } /// /// The guild id this webhook is for, if any. /// [JsonPropertyName("guild_id")] public Optional GuildId { get; } /// /// The channel id this webhook is for, if any. /// [JsonPropertyName("channel_id")] public Snowflake? ChannelId { get; } /// /// The user this webhook was created by (not returned when getting a webhook with its token). /// [JsonPropertyName("user")] public Optional User { get; } /// /// The default name of the webhook. /// [JsonPropertyName("name")] public string? Name { get; } /// /// The default user avatar hash of the webhook. /// [JsonPropertyName("avatar")] public string? Avatar { get; } /// /// The secure token of the webhook (returned for Incoming Webhooks). /// [JsonPropertyName("token")] public Optional Token { get; } /// /// The bot/OAuth2 application that created this webhook. /// [JsonPropertyName("application_id")] public Snowflake? ApplicationId { get; } /// /// The guild of the channel that this webhook is following (returned for Channel Follower Webhooks). /// [JsonPropertyName("source_guild")] public Optional SourceGuild { get; } /// /// The channel that this webhook is following (returned for Channel Follower Webhooks). /// [JsonPropertyName("source_channel")] public Optional SourceChannel { get; } /// /// The url used for executing the webhook (returned by the webhooks OAuth2 flow). /// [JsonPropertyName("url")] public Optional Url { get; } } }