Skip to content

Commit a452f86

Browse files
feat(Webhook): add optional headers parameter to CreateWebhook method (#26)
1 parent 80c953c commit a452f86

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Pluggy.SDK/PluggyAPI.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,16 @@ public async Task<Webhook> FetchWebhook(Guid id)
301301
/// </summary>
302302
/// <param name="url">Webhook url</param>
303303
/// <param name="event">Webhook event</param>
304+
/// <param name="headers">Optional headers for webhook notifications</param>
304305
/// <returns></returns>
305-
public async Task<Webhook> CreateWebhook(string url, WebhookEvent _event)
306+
public async Task<Webhook> CreateWebhook(string url, WebhookEvent _event, Dictionary<string, string> headers = null)
306307
{
307-
var body = new Dictionary<string, string>
308+
var body = new Dictionary<string, object>
308309
{
309310
{ "url", url },
310-
{ "event", _event.Value }
311-
};
311+
{ "event", _event.Value },
312+
{ "headers", headers }
313+
}.RemoveNulls();
312314
return await httpService.PostAsync<Webhook>(URL_WEBHOOKS, body);
313315
}
314316

0 commit comments

Comments
 (0)