示例#1
0
 /// <summary>
 /// Construct a new CreateWebhookOptions
 /// </summary>
 /// <param name="pathServiceSid"> The SID of the Service with the Channel to create the resource under </param>
 /// <param name="pathChannelSid"> The SID of the Channel the new resource belongs to </param>
 /// <param name="type"> The type of webhook </param>
 public CreateWebhookOptions(string pathServiceSid, string pathChannelSid, WebhookResource.TypeEnum type)
 {
     PathServiceSid        = pathServiceSid;
     PathChannelSid        = pathChannelSid;
     Type                  = type;
     ConfigurationFilters  = new List <string>();
     ConfigurationTriggers = new List <string>();
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service with the Channel to create the resource under </param>
        /// <param name="pathChannelSid"> The SID of the Channel the new resource belongs to </param>
        /// <param name="type"> The type of webhook </param>
        /// <param name="configurationUrl"> The URL of the webhook to call </param>
        /// <param name="configurationMethod"> The HTTP method used to call `configuration.url` </param>
        /// <param name="configurationFilters"> The events that cause us to call the Channel Webhook </param>
        /// <param name="configurationTriggers"> A string that will cause us to call the webhook when it is found in a message
        ///                             body </param>
        /// <param name="configurationFlowSid"> The SID of the Studio Flow to call when an event occurs </param>
        /// <param name="configurationRetryCount"> The number of times to retry the webhook if the first attempt fails </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Webhook </returns>
        public static WebhookResource Create(string pathServiceSid,
                                             string pathChannelSid,
                                             WebhookResource.TypeEnum type,
                                             string configurationUrl = null,
                                             WebhookResource.MethodEnum configurationMethod = null,
                                             List <string> configurationFilters             = null,
                                             List <string> configurationTriggers            = null,
                                             string configurationFlowSid = null,
                                             int?configurationRetryCount = null,
                                             ITwilioRestClient client    = null)
        {
            var options = new CreateWebhookOptions(pathServiceSid, pathChannelSid, type)
            {
                ConfigurationUrl = configurationUrl, ConfigurationMethod = configurationMethod, ConfigurationFilters = configurationFilters, ConfigurationTriggers = configurationTriggers, ConfigurationFlowSid = configurationFlowSid, ConfigurationRetryCount = configurationRetryCount
            };

            return(Create(options, client));
        }