Add missing REST Webhook implemenation (#843)

* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Add Webhook API models, REST implementation, and Socket bridges.

* Remove token overrides from REST.

Leaving that as a Webhook package only feature.

* Webhook core implementation.

* Webhook REST implementation.

* Webhook client implementation.

* Add channel bucket id.
This commit is contained in:
Alex Gravely
2017-12-23 15:17:20 -05:00
committed by Christopher F
parent a19ff188e9
commit 7b2ddd027c
27 changed files with 680 additions and 41 deletions

View File

@@ -254,6 +254,20 @@ namespace Discord.Rest
return model.Pruned;
}
//Webhooks
public static async Task<RestWebhook> GetWebhookAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options)
{
var model = await client.ApiClient.GetWebhookAsync(id, options: options).ConfigureAwait(false);
if (model == null)
return null;
return RestWebhook.Create(client, guild, model);
}
public static async Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(IGuild guild, BaseDiscordClient client, RequestOptions options)
{
var models = await client.ApiClient.GetGuildWebhooksAsync(guild.Id, options).ConfigureAwait(false);
return models.Select(x => RestWebhook.Create(client, guild, x)).ToImmutableArray();
}
//Emotes
public static async Task<GuildEmote> GetEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options)
{