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

            return(FromJson(response.Content));
        }
Esempio n. 2
0
 private static Request BuildCreateRequest(CreateOriginationUrlOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Trunking,
                "/v1/Trunks/" + options.PathTrunkSid + "/OriginationUrls",
                postParams: options.GetParams()
                ));
 }
Esempio n. 3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathTrunkSid"> The SID of the Trunk to associate the resource with </param>
        /// <param name="weight"> The value that determines the relative load the URI should receive compared to others with
        ///              the same priority </param>
        /// <param name="priority"> The relative importance of the URI </param>
        /// <param name="enabled"> Whether the URL is enabled </param>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="sipUrl"> The SIP address you want Twilio to route your Origination calls to </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of OriginationUrl </returns>
        public static async System.Threading.Tasks.Task <OriginationUrlResource> CreateAsync(string pathTrunkSid,
                                                                                             int?weight,
                                                                                             int?priority,
                                                                                             bool?enabled,
                                                                                             string friendlyName,
                                                                                             Uri sipUrl,
                                                                                             ITwilioRestClient client = null)
        {
            var options = new CreateOriginationUrlOptions(pathTrunkSid, weight, priority, enabled, friendlyName, sipUrl);

            return(await CreateAsync(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathTrunkSid"> The SID of the Trunk to associate the resource with </param>
        /// <param name="weight"> The value that determines the relative load the URI should receive compared to others with
        ///              the same priority </param>
        /// <param name="priority"> The relative importance of the URI </param>
        /// <param name="enabled"> Whether the URL is enabled </param>
        /// <param name="friendlyName"> A string to describe the resource </param>
        /// <param name="sipUrl"> The SIP address you want Twilio to route your Origination calls to </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of OriginationUrl </returns>
        public static OriginationUrlResource Create(string pathTrunkSid,
                                                    int?weight,
                                                    int?priority,
                                                    bool?enabled,
                                                    string friendlyName,
                                                    Uri sipUrl,
                                                    ITwilioRestClient client = null)
        {
            var options = new CreateOriginationUrlOptions(pathTrunkSid, weight, priority, enabled, friendlyName, sipUrl);

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

            return(FromJson(response.Content));
        }