/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create ByocTrunk parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ByocTrunk </returns>
        public static ByocTrunkResource Create(CreateByocTrunkOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateByocTrunkOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Voice,
                "/v1/ByocTrunks",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="voiceUrl"> The URL we should call when receiving a call </param>
        /// <param name="voiceMethod"> The HTTP method to use with voice_url </param>
        /// <param name="voiceFallbackUrl"> The URL we should call when an error occurs in executing TwiML </param>
        /// <param name="voiceFallbackMethod"> The HTTP method to use with voice_fallback_url </param>
        /// <param name="statusCallbackUrl"> The URL that we should call to pass status updates </param>
        /// <param name="statusCallbackMethod"> The HTTP method we should use to call `status_callback_url` </param>
        /// <param name="cnamLookupEnabled"> Whether Caller ID Name (CNAM) lookup is enabled for the trunk </param>
        /// <param name="connectionPolicySid"> Origination Connection Policy (to your Carrier) </param>
        /// <param name="fromDomainSid"> The SID of the SIP Domain that should be used in the `From` header of originating
        ///                     calls </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of ByocTrunk </returns>
        public static ByocTrunkResource Create(string friendlyName = null,
                                               Uri voiceUrl        = null,
                                               Twilio.Http.HttpMethod voiceMethod = null,
                                               Uri voiceFallbackUrl = null,
                                               Twilio.Http.HttpMethod voiceFallbackMethod = null,
                                               Uri statusCallbackUrl = null,
                                               Twilio.Http.HttpMethod statusCallbackMethod = null,
                                               bool?cnamLookupEnabled     = null,
                                               string connectionPolicySid = null,
                                               string fromDomainSid       = null,
                                               ITwilioRestClient client   = null)
        {
            var options = new CreateByocTrunkOptions()
            {
                FriendlyName = friendlyName, VoiceUrl = voiceUrl, VoiceMethod = voiceMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceFallbackMethod = voiceFallbackMethod, StatusCallbackUrl = statusCallbackUrl, StatusCallbackMethod = statusCallbackMethod, CnamLookupEnabled = cnamLookupEnabled, ConnectionPolicySid = connectionPolicySid, FromDomainSid = fromDomainSid
            };

            return(Create(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create ByocTrunk parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of ByocTrunk </returns>
        public static async System.Threading.Tasks.Task <ByocTrunkResource> CreateAsync(CreateByocTrunkOptions options,
                                                                                        ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }