public async Task<Response> Create(Webhook webhook) { var request = new Request { Url = $"api/{client.Version}/webhooks", Method = "POST", Data = dataMapper.ToDictionary(webhook) }; var response = await requestSender.Send(request); if (response.StatusCode != HttpStatusCode.OK) throw new ResponseException(response); var updateSuppressionResponse = new Response(); LeftRight.SetValuesToMatch(updateSuppressionResponse, response); return updateSuppressionResponse; }
internal static Webhook ConvertToAWebhook(dynamic r) { var events = new List<string>(); foreach (var i in r.events) events.Add(i.ToString()); var webhook = new Webhook { Id = r.id, Name = r.name, Target = r.target, Events = events, AuthType = r.auth_type, AuthRequestDetails = r.auth_request_details, AuthCredentials = r.auth_credentials, AuthToken = r.auth_token, LastSuccessful = r.last_successful, LastFailure = r.last_failure }; return webhook; }