コード例 #1
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create PhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static PhoneNumberResource Create(CreatePhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
コード例 #2
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathTrunkSid"> The SID of the Trunk to associate the phone number with </param>
        /// <param name="phoneNumberSid"> The SID of the Incoming Phone Number that you want to associate with the trunk
        ///                      </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <PhoneNumberResource> CreateAsync(string pathTrunkSid,
                                                                                          string phoneNumberSid,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreatePhoneNumberOptions(pathTrunkSid, phoneNumberSid);

            return(await CreateAsync(options, client));
        }
コード例 #3
0
 private static Request BuildCreateRequest(CreatePhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Trunking,
                "/v1/Trunks/" + options.PathTrunkSid + "/PhoneNumbers",
                postParams: options.GetParams()
                ));
 }
コード例 #4
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathTrunkSid"> The trunk_sid </param>
        /// <param name="phoneNumberSid"> The phone_number_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static PhoneNumberResource Create(string pathTrunkSid, string phoneNumberSid, ITwilioRestClient client = null)
        {
            var options = new CreatePhoneNumberOptions(pathTrunkSid, phoneNumberSid);

            return(Create(options, client));
        }
コード例 #5
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="options"> Create PhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <PhoneNumberResource> CreateAsync(CreatePhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }