/// <summary>
        /// Create a new application within your account
        /// </summary>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="apiVersion"> The API version to use to start a new TwiML session </param>
        /// <param name="voiceUrl"> The URL to call when the phone number receives a call </param>
        /// <param name="voiceMethod"> The HTTP method to use with the voice_url </param>
        /// <param name="voiceFallbackUrl"> The URL to call when a TwiML error occurs </param>
        /// <param name="voiceFallbackMethod"> The HTTP method to use with voice_fallback_url </param>
        /// <param name="statusCallback"> The URL to send status information to your application </param>
        /// <param name="statusCallbackMethod"> The HTTP method to use to call status_callback </param>
        /// <param name="voiceCallerIdLookup"> Whether to lookup the caller's name </param>
        /// <param name="smsUrl"> The URL to call when the phone number receives an incoming SMS message </param>
        /// <param name="smsMethod"> The HTTP method to use with sms_url </param>
        /// <param name="smsFallbackUrl"> The URL to call when an error occurs while retrieving or executing the TwiML </param>
        /// <param name="smsFallbackMethod"> The HTTP method to use with sms_fallback_url </param>
        /// <param name="smsStatusCallback"> The URL to send status information to your application </param>
        /// <param name="messageStatusCallback"> The URL to send message status information to your application </param>
        /// <param name="friendlyName"> A string to describe the new resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Application </returns>
        public static ApplicationResource Create(string pathAccountSid = null,
                                                 string apiVersion     = null,
                                                 Uri voiceUrl          = null,
                                                 Twilio.Http.HttpMethod voiceMethod = null,
                                                 Uri voiceFallbackUrl = null,
                                                 Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                                 Uri statusCallback = null,
                                                 Twilio.Http.HttpMethod statusCallbackMethod = null,
                                                 bool?voiceCallerIdLookup = null,
                                                 Uri smsUrl = null,
                                                 Twilio.Http.HttpMethod smsMethod = null,
                                                 Uri smsFallbackUrl = null,
                                                 Twilio.Http.HttpMethod smsFallbackMethod = null,
                                                 Uri smsStatusCallback     = null,
                                                 Uri messageStatusCallback = null,
                                                 string friendlyName       = null,
                                                 ITwilioRestClient client  = null)
        {
            var options = new CreateApplicationOptions()
            {
                PathAccountSid = pathAccountSid, ApiVersion = apiVersion, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceCallerIdLookup = voiceCallerIdLookup, SmsUrl = smsUrl, SmsMethod = smsMethod, SmsFallbackUrl = smsFallbackUrl, SmsFallbackMethod = smsFallbackMethod, SmsStatusCallback = smsStatusCallback, MessageStatusCallback = messageStatusCallback, FriendlyName = friendlyName
            };

            return(Create(options, client));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new application within your account
        /// </summary>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="apiVersion"> The API version to use </param>
        /// <param name="voiceUrl"> URL Twilio will make requests to when relieving a call </param>
        /// <param name="voiceMethod"> HTTP method to use with the URL </param>
        /// <param name="voiceFallbackUrl"> Fallback URL </param>
        /// <param name="voiceFallbackMethod"> HTTP method to use with the fallback url </param>
        /// <param name="statusCallback"> URL to hit with status updates </param>
        /// <param name="statusCallbackMethod"> HTTP method to use with the status callback </param>
        /// <param name="voiceCallerIdLookup"> True or False </param>
        /// <param name="smsUrl"> URL Twilio will request when receiving an SMS </param>
        /// <param name="smsMethod"> HTTP method to use with sms_url </param>
        /// <param name="smsFallbackUrl"> Fallback URL if there's an error parsing TwiML </param>
        /// <param name="smsFallbackMethod"> HTTP method to use with sms_fallback_method </param>
        /// <param name="smsStatusCallback"> URL Twilio with request with status updates </param>
        /// <param name="messageStatusCallback"> URL to make requests to with status updates </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Application </returns>
        public static async System.Threading.Tasks.Task <ApplicationResource> CreateAsync(string friendlyName,
                                                                                          string pathAccountSid = null,
                                                                                          string apiVersion     = null,
                                                                                          Uri voiceUrl          = null,
                                                                                          Twilio.Http.HttpMethod voiceMethod = null,
                                                                                          Uri voiceFallbackUrl = null,
                                                                                          Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                                                                          Uri statusCallback = null,
                                                                                          Twilio.Http.HttpMethod statusCallbackMethod = null,
                                                                                          bool?voiceCallerIdLookup = null,
                                                                                          Uri smsUrl = null,
                                                                                          Twilio.Http.HttpMethod smsMethod = null,
                                                                                          Uri smsFallbackUrl = null,
                                                                                          Twilio.Http.HttpMethod smsFallbackMethod = null,
                                                                                          Uri smsStatusCallback     = null,
                                                                                          Uri messageStatusCallback = null,
                                                                                          ITwilioRestClient client  = null)
        {
            var options = new CreateApplicationOptions(friendlyName)
            {
                PathAccountSid = pathAccountSid, ApiVersion = apiVersion, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceCallerIdLookup = voiceCallerIdLookup, SmsUrl = smsUrl, SmsMethod = smsMethod, SmsFallbackUrl = smsFallbackUrl, SmsFallbackMethod = smsFallbackMethod, SmsStatusCallback = smsStatusCallback, MessageStatusCallback = messageStatusCallback
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Create a new application within your account
        /// </summary>
        /// <param name="options"> Create Application parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Application </returns>
        public static ApplicationResource Create(CreateApplicationOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 4
0
 private static Request BuildCreateRequest(CreateApplicationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Applications.json",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Create a new application within your account
        /// </summary>
        /// <param name="options"> Create Application parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Application </returns>
        public static async System.Threading.Tasks.Task <ApplicationResource> CreateAsync(CreateApplicationOptions options,
                                                                                          ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }