/// <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));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="phoneNumberSid"> Phone Number SID for the Phone Number being added to the Service. </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 phoneNumberSid,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreatePhoneNumberOptions(pathServiceSid, phoneNumberSid);

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="phoneNumberSid"> Phone Number SID for the Phone Number being added to the Service. </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 phoneNumberSid,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreatePhoneNumberOptions(pathServiceSid, phoneNumberSid);

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreatePhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Messaging,
                "/v1/Services/" + options.PathServiceSid + "/PhoneNumbers",
                postParams: options.GetParams()
                ));
 }
        /// <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));
        }