// update an existing Webhook public LapostaWebhook Update(string webhookId, LapostaWebhook webhook) { // only add changed webhooks Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("list_id", this.listId); if (webhook.Event != null) { data.Add("event", webhook.Event); } if (webhook.Url != null) { data.Add("url", webhook.Url); } if (webhook.Blocked != null) { data.Add("blocked", LapostaUtil.convertBool(webhook.Blocked)); } List <string> path = new List <string>(); path.Add(webhookId); var response = base.Connect("POST", path, this.parameters, data); return(Mapper <LapostaWebhook> .MapFromJson(response, "webhook")); }
// create a new Webhook public LapostaWebhook Create(LapostaWebhook webhook) { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("list_id", this.listId); data.Add("event", webhook.Event); data.Add("url", webhook.Url); data.Add("blocked", LapostaUtil.convertBool(webhook.Blocked)); var response = base.Connect("POST", null, this.parameters, data); return(Mapper <LapostaWebhook> .MapFromJson(response, "webhook")); }