Ejemplo n.º 1
0
        /// <summary>
        /// Create a new Function resource.
        /// </summary>
        /// <param name="options"> Create Function parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Function </returns>
        public static FunctionResource Create(CreateFunctionOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new Function resource.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Function resource under </param>
        /// <param name="friendlyName"> A string to describe the Function resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Function </returns>
        public static async System.Threading.Tasks.Task <FunctionResource> CreateAsync(string pathServiceSid,
                                                                                       string friendlyName,
                                                                                       ITwilioRestClient client = null)
        {
            var options = new CreateFunctionOptions(pathServiceSid, friendlyName);

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 3
0
 private static Request BuildCreateRequest(CreateFunctionOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Functions",
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new Function resource.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Function resource under </param>
        /// <param name="friendlyName"> A string to describe the Function resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Function </returns>
        public static FunctionResource Create(string pathServiceSid, string friendlyName, ITwilioRestClient client = null)
        {
            var options = new CreateFunctionOptions(pathServiceSid, friendlyName);

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

            return(FromJson(response.Content));
        }