コード例 #1
0
        public void Send(Notification notification)
        {
            WebHookNotification webhookNotification = notification as WebHookNotification;
            if (webhookNotification == null)
            {
                throw new ArgumentException("Invalid type passed to web hook notification handler. Expected an instance of WebHookNotification.");
            }                        
            
            // Create Web Hook
            WebHook webhook = new WebHook();
            webhook.Description = webhookNotification.CallbackResponse;
            webhook.WebHookUri = webhookNotification.CallbackUrl;
            webhook.Id = "2";

            // Create Notification List (multiple notifications can be sent to the single web hook)
            List<NotificationDictionary> notificationList = new List<NotificationDictionary>();
            Dictionary<string, object> data = new Dictionary<string, object>
            {
                { "ID", webhookNotification.CreatedBy.ToString() },
                { "Created Date", webhookNotification.CreatedDate.ToString() },
            };
            notificationList.Add(new NotificationDictionary("customEvent", data));
            
            // Create a Work Item for processing the Web Hook
            WebHookWorkItem workItem = new WebHookWorkItem(webhook, notificationList);

            WebHookHandler webhookHandler = new WebHookHandler();
            webhookHandler.SendWebHook(workItem);
        }
コード例 #2
0
        public void Send(Notification notification)
        {

        }