Exemplo n.º 1
0
        /// <summary>
        /// Create a new Service resource.
        /// </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));
        }
Exemplo n.º 2
0
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Serverless,
                "/v1/Services",
                postParams: options.GetParams()
                ));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new Service resource.
        /// </summary>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the Service resource </param>
        /// <param name="friendlyName"> A string to describe the Service resource </param>
        /// <param name="includeCredentials"> Whether to inject Account credentials into a function invocation context </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 uniqueName,
                                                                                      string friendlyName,
                                                                                      bool?includeCredentials  = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(uniqueName, friendlyName)
            {
                IncludeCredentials = includeCredentials
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create a new Service resource.
        /// </summary>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the Service resource </param>
        /// <param name="friendlyName"> A string to describe the Service resource </param>
        /// <param name="includeCredentials"> Whether to inject Account credentials into a function invocation context </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(string uniqueName,
                                             string friendlyName,
                                             bool?includeCredentials  = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(uniqueName, friendlyName)
            {
                IncludeCredentials = includeCredentials
            };

            return(Create(options, client));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Create a new Service resource.
        /// </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));
        }