/// <summary>
        /// Create a new Service to hold the number pool and configuration.
        /// </summary>
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(CreateServiceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
示例#2
0
        /// <summary>
        /// Create a new Service to hold the number pool and configuration.
        /// </summary>
        ///
        /// <param name="friendlyName"> A human readable description of this resource </param>
        /// <param name="autoCreate"> Boolean flag specifying whether to auto-create threads. </param>
        /// <param name="callbackUrl"> URL Twilio will request for callbacks. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(string friendlyName = null, bool?autoCreate = null, Uri callbackUrl = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions {
                FriendlyName = friendlyName, AutoCreate = autoCreate, CallbackUrl = callbackUrl
            };

            return(await CreateAsync(options, client));
        }
示例#3
0
        /// <summary>
        /// Create a new Service to hold the number pool and configuration.
        /// </summary>
        ///
        /// <param name="friendlyName"> A human readable description of this resource </param>
        /// <param name="autoCreate"> Boolean flag specifying whether to auto-create threads. </param>
        /// <param name="callbackUrl"> URL Twilio will request for callbacks. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(string friendlyName = null, bool?autoCreate = null, Uri callbackUrl = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions {
                FriendlyName = friendlyName, AutoCreate = autoCreate, CallbackUrl = callbackUrl
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/Proxy/Services",
                client.Region,
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Create a new Service to hold the number pool and configuration.
        /// </summary>
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(CreateServiceOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }