System.Web.Http.TrelloWebHookClientExtensions.CreateAsync C# (CSharp) Method

CreateAsync() public static method

Creates a WebHook subscription for Trello to send WebHooks when changes happen to a given Trello modelId.
public static CreateAsync ( this client, System.Web.Http.Routing.UrlHelper urlHelper, string modelId, string description ) : Task
client this The implementation.
urlHelper System.Web.Http.Routing.UrlHelper A used to compute the URI where WebHooks for the given will be received.
modelId string The ID of a model to watch. This can be the ID of a member, card, board, or anything that actions apply to. Any event involving this model will trigger the WebHook. An example model ID is 4d5ea62fd76aa1136000000c.
description string A description of the WebHook, for example My Trello WebHook!.
return Task
        public static Task<string> CreateAsync(this TrelloWebHookClient client, UrlHelper urlHelper, string modelId, string description)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (urlHelper == null)
            {
                throw new ArgumentNullException(nameof(urlHelper));
            }

            Dictionary<string, object> parameters = new Dictionary<string, object> { { "webHookReceiver", TrelloWebHookReceiver.ReceiverName } };
            string receiver = urlHelper.Link(WebHookReceiverRouteNames.ReceiversAction, parameters);
            Uri callback = new Uri(receiver);
            return client.CreateAsync(callback, modelId, description);
        }
    }
TrelloWebHookClientExtensions