ActiveCampaign / postmark-dotnet

A .NET library for the Postmark API
http://developer.postmarkapp.com/
Other
50 stars 46 forks source link

WebhookConfigurationTriggers does not contain configuration for subscription change event #110

Closed sstuber closed 8 months ago

sstuber commented 2 years ago

WebhookConfigurationTriggers is missing configuration for subscription change. This is available in the api according to https://postmarkapp.com/developer/api/webhooks-api#create-a-webhook. If you could add this in a new version, I would greatly appreciate it

juliancarrivick commented 8 months ago

I worked around this when creating a webhook by subclassing WebhookConfigurationTriggers and using it like so:

public class PatchedWebhookConfigurationTriggers : WebhookConfigurationTriggers
{
    public WebhookConfigurationSubscriptionChangeTrigger? SubscriptionChange { get; set; }
}

public class WebhookConfigurationSubscriptionChangeTrigger
{
    public bool Enabled { get; set; }
}

...

await client.CreateWebhookConfigurationAsync(..., triggers: new PatchedWebhookConfigurationTriggers
{
    SubscriptionChange = new WebhookConfigurationSubscriptionChangeTrigger { Enabled = true },
});

This doesn't however help you if you want to retrieve the configuration using client.GetWebhookConfigurationsAsync(), but that was OK in my use case.

If I get a chance I might create a PR for this, but the repo doesn't look very active :(