/// <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));
        }
        /// <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));
        }
Пример #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()
                ));
 }
        /// <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));
        }
        /// <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));
        }