/// <summary>
        /// Add a Phone Number to the Service's Proxy Number Pool.
        /// </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));
        }
 private static Request BuildCreateRequest(CreatePhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Proxy,
                "/v1/Services/" + options.PathServiceSid + "/PhoneNumbers",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Add a Phone Number to the Service's Proxy Number Pool.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="sid"> A string that uniquely identifies this Phone Number. </param>
        /// <param name="phoneNumber"> The phone_number </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 pathServiceSid,
                                                                                          string sid = null,
                                                                                          Types.PhoneNumber phoneNumber = null,
                                                                                          ITwilioRestClient client      = null)
        {
            var options = new CreatePhoneNumberOptions(pathServiceSid)
            {
                Sid = sid, PhoneNumber = phoneNumber
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Add a Phone Number to the Service's Proxy Number Pool.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="sid"> A string that uniquely identifies this Phone Number. </param>
        /// <param name="phoneNumber"> The phone_number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static PhoneNumberResource Create(string pathServiceSid,
                                                 string sid = null,
                                                 Types.PhoneNumber phoneNumber = null,
                                                 ITwilioRestClient client      = null)
        {
            var options = new CreatePhoneNumberOptions(pathServiceSid)
            {
                Sid = sid, PhoneNumber = phoneNumber
            };

            return(Create(options, client));
        }
        /// <summary>
        /// Add a Phone Number to the Service's Proxy Number Pool.
        /// </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));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add a Phone Number to the Service's Proxy Number Pool.
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="sid"> A string that uniquely identifies this Phone Number. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static PhoneNumberResource Create(string pathServiceSid, string sid, ITwilioRestClient client = null)
        {
            var options = new CreatePhoneNumberOptions(pathServiceSid, sid);

            return(Create(options, client));
        }