@@ -121,7 +121,7 @@ namespace Discord.Rest
/// A <see cref="RestInteraction"/> that represents the incoming http interaction.
/// A <see cref="RestInteraction"/> that represents the incoming http interaction.
/// </returns>
/// </returns>
/// <exception cref="BadSignatureException">Thrown when the signature doesn't match the public key.</exception>
/// <exception cref="BadSignatureException">Thrown when the signature doesn't match the public key.</exception>
public Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, string body, bool? doApiCallOnCreation = null)
public Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, string body, Func<InteractionType, bool> doApiCallOnCreation = null)
=> ParseHttpInteractionAsync(publicKey, signature, timestamp, Encoding.UTF8.GetBytes(body), doApiCallOnCreation);
=> ParseHttpInteractionAsync(publicKey, signature, timestamp, Encoding.UTF8.GetBytes(body), doApiCallOnCreation);
/// <summary>
/// <summary>
@@ -135,7 +135,7 @@ namespace Discord.Rest
/// A <see cref="RestInteraction"/> that represents the incoming http interaction.
/// A <see cref="RestInteraction"/> that represents the incoming http interaction.
/// </returns>
/// </returns>
/// <exception cref="BadSignatureException">Thrown when the signature doesn't match the public key.</exception>
/// <exception cref="BadSignatureException">Thrown when the signature doesn't match the public key.</exception>
public async Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, byte[] body, bool? doApiCallOnCreation = null)
public async Task<RestInteraction> ParseHttpInteractionAsync(string publicKey, string signature, string timestamp, byte[] body, Func<InteractionType, bool> doApiCallOnCreation = null)
{
{
if (!IsValidHttpInteraction(publicKey, signature, timestamp, body))
if (!IsValidHttpInteraction(publicKey, signature, timestamp, body))
{
{
@@ -146,7 +146,7 @@ namespace Discord.Rest
using (var jsonReader = new JsonTextReader(textReader))
using (var jsonReader = new JsonTextReader(textReader))
{
{
var model = Serializer.Deserialize<API.Interaction>(jsonReader);
var model = Serializer.Deserialize<API.Interaction>(jsonReader);
return await RestInteraction.CreateAsync(this, model, doApiCallOnCreation ?? _apiOnCreation);
return await RestInteraction.CreateAsync(this, model, doApiCallOnCreation != null ? doApiCallOnCreation(model.Type) : _apiOnCreation);
}
}
}
}