Пример #1
0
        /// <summary>
        /// Create a new Service for the Account
        /// </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 for the Account
        /// </summary>
        /// <param name="friendlyName"> A human readable description of this resource. </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,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(friendlyName);

            return(await CreateAsync(options, client));
        }
Пример #3
0
        /// <summary>
        /// Create a new Service for the Account
        /// </summary>
        /// <param name="friendlyName"> A human readable description of this resource. </param>
        /// <param name="push"> Optional service level push factors configuration </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(string friendlyName, string push = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(friendlyName)
            {
                Push = push
            };

            return(Create(options, client));
        }
Пример #4
0
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Authy,
                "/v1/Services",
                postParams: options.GetParams()
                ));
 }
Пример #5
0
        /// <summary>
        /// Create a new Service for the Account
        /// </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));
        }