diff --git a/src/Postmark/IPostmarkClient.cs b/src/Postmark/IPostmarkClient.cs new file mode 100644 index 0000000..c7091e9 --- /dev/null +++ b/src/Postmark/IPostmarkClient.cs @@ -0,0 +1,76 @@ +using Postmark.Model.MessageStreams; +using Postmark.Model.Suppressions; +using PostmarkDotNet.Model; +using PostmarkDotNet.Model.Webhooks; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace PostmarkDotNet +{ + interface IPostmarkClient + { + Task ActivateBounceAsync(long bounceId); + Task ArchiveMessageStream(string id); + Task BypassBlockedInboundMessage(string messageid); + Task CreateInboundRuleTriggerAsync(string rule); + Task CreateMessageStream(string id, MessageStreamType type, string name, string description = null); + Task CreateSuppressions(IEnumerable suppressionChanges, string messageStream = "outbound"); + Task CreateTemplateAsync(string name, string subject, string htmlBody = null, string textBody = null, string alias = null, TemplateType templateType = TemplateType.Standard, string layoutTemplate = null); + Task CreateWebhookConfigurationAsync(string url, string messageStream = null, HttpAuth httpAuth = null, IEnumerable httpHeaders = null, WebhookConfigurationTriggers triggers = null); + Task DeleteInboundRuleTrigger(int triggerId); + Task DeleteSuppressions(IEnumerable suppressionChanges, string messageStream = "outbound"); + Task DeleteTemplateAsync(long templateId); + Task DeleteTemplateAsync(string templateAlias); + Task DeleteWebhookConfigurationAsync(long configurationId); + Task EditMessageStream(string id, string name = null, string description = null); + Task EditServerAsync(string name = null, string color = null, bool? rawEmailEnabled = null, bool? smtpApiActivated = null, string inboundHookUrl = null, string bounceHookUrl = null, string openHookUrl = null, bool? postFirstOpenOnly = null, bool? trackOpens = null, string inboundDomain = null, int? inboundSpamThreshold = null, LinkTrackingOptions? trackLinks = null, string clickHookUrl = null, string deliveryHookUrl = null); + Task EditTemplateAsync(long templateId, string name = null, string subject = null, string htmlBody = null, string textBody = null, string alias = null, string layoutTemplate = null); + Task EditTemplateAsync(string alias, string name = null, string subject = null, string htmlBody = null, string textBody = null, string layoutTemplate = null); + Task EditWebhookConfigurationAsync(long configurationId, string url, HttpAuth httpAuth = null, IEnumerable httpHeaders = null, WebhookConfigurationTriggers triggers = null); + Task GetAllInboundRuleTriggers(int offset = 0, int count = 100); + Task GetBounceAsync(long bounceId); + Task GetBounceDumpAsync(long bounceId); + Task GetBouncesAsync(int offset = 0, int count = 100, PostmarkBounceType? type = null, bool? inactive = null, string emailFilter = null, string tag = null, string messageID = null, string fromDate = null, string toDate = null); + Task> GetBounceTagsAsync(); + Task GetClickEventsForMessageAsync(string messageId, int offset = 0, int count = 100); + Task GetClickEventsForMessagesAsync(int offset = 0, int count = 100, string recipient = null, string tag = null, string clientName = null, string clientCompany = null, string clientFamily = null, string operatingSystemName = null, string operatingSystemFamily = null, string operatingSystemCompany = null, string platform = null, string country = null, string region = null, string city = null); + Task GetDeliveryStatsAsync(); + Task GetInboundMessageDetailsAsync(string messageID); + Task GetInboundMessagesAsync(int offset = 0, int count = 100, string recipient = null, string fromemail = null, string subject = null, string mailboxhash = null, InboundMessageStatus? status = InboundMessageStatus.Processed, string toDate = null, string fromDate = null); + Task GetMessageStream(string id); + Task GetOpenEventsForMessageAsync(string messageId, int offset = 0, int count = 100); + Task GetOpenEventsForMessagesAsync(int offset = 0, int count = 100, string recipient = null, string tag = null, string clientName = null, string clientCompany = null, string clientFamily = null, string operatingSystemName = null, string operatingSystemFamily = null, string operatingSystemCompany = null, string platform = null, string country = null, string region = null, string city = null); + Task GetOutboundBounceCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundClientUsageCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundMessageDetailsAsync(string messageID); + Task GetOutboundMessageDumpAsync(string messageID); + Task GetOutboundMessagesAsync(int offset = 0, int count = 100, string recipient = null, string fromemail = null, string tag = null, string subject = null, OutboundMessageStatus status = OutboundMessageStatus.Sent, string toDate = null, string fromDate = null, IDictionary metadata = null); + Task GetOutboundOpenCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundOverviewStatsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundPlatformCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundReadtimeStatsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundSentCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundSpamComplaintCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetOutboundTrackingCountsAsync(string tag = null, DateTime? fromDate = null, DateTime? toDate = null); + Task GetServerAsync(); + Task GetTemplateAsync(string alias); + Task GetTemplateAsync(long templateId); + Task GetTemplatesAsync(int offset = 0, int count = 100, TemplateTypeFilter templateType = TemplateTypeFilter.All, string layoutTemplate = null); + Task GetWebhookConfigurationAsync(long configurationId); + Task GetWebhookConfigurationsAsync(string messageStream = null); + Task ListMessageStreams(MessageStreamTypeFilter messageStreamType = MessageStreamTypeFilter.All, bool includeArchivedStreams = false); + Task ListSuppressions(PostmarkSuppressionQuery query, string messageStream = "outbound"); + Task RetryInboundHookForMessage(string messageId); + Task> SendEmailsWithTemplateAsync(params TemplatedPostmarkMessage[] messages); + Task SendEmailWithTemplateAsync(long templateId, T templateModel, string to, string from, bool? inlineCss = null, string cc = null, string bcc = null, string replyTo = null, bool? trackOpens = null, IDictionary headers = null, IDictionary metadata = null, string messageStream = null, params PostmarkMessageAttachment[] attachments); + Task SendEmailWithTemplateAsync(string templateAlias, T templateModel, string to, string from, bool? inlineCss = null, string cc = null, string bcc = null, string replyTo = null, bool? trackOpens = null, IDictionary headers = null, IDictionary metadata = null, string messageStream = null, params PostmarkMessageAttachment[] attachments); + Task SendEmailWithTemplateAsync(TemplatedPostmarkMessage emailToSend); + Task SendMessageAsync(TemplatedPostmarkMessage emailToSend); + Task SendMessageAsync(PostmarkMessage message); + Task> SendMessagesAsync(params TemplatedPostmarkMessage[] messages); + Task> SendMessagesAsync(params PostmarkMessage[] messages); + Task UnArchiveMessageStream(string id); + Task ValidateTemplateAsync(string subject = null, string htmlBody = null, string textBody = null, T testRenderModel = default, bool inlineCssForHtmlTestRender = true, TemplateType templateType = TemplateType.Standard, string layoutTemplate = null); + } +} diff --git a/src/Postmark/PostmarkClient.cs b/src/Postmark/PostmarkClient.cs index 8004c3f..02a5a54 100644 --- a/src/Postmark/PostmarkClient.cs +++ b/src/Postmark/PostmarkClient.cs @@ -18,7 +18,7 @@ namespace PostmarkDotNet /// /// Make sure to include "using PostmarkDotNet;" in your class file, which will include extension methods on the base client. /// - public class PostmarkClient : PostmarkClientBase + public class PostmarkClient : PostmarkClientBase, IPostmarkClient { /// /// The authorization header required, in this case, "X-Postmark-Server-Token"