/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Field parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Field </returns>
        public static FieldResource Create(CreateFieldOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Field parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Field </returns>
        public static async System.Threading.Tasks.Task <FieldResource> CreateAsync(CreateFieldOptions options,
                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Esempio n. 3
0
 private static Request BuildCreateRequest(CreateFieldOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/understand/Assistants/" + options.PathAssistantSid + "/Tasks/" + options.PathTaskSid + "/Fields",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The unique ID of the parent Assistant. </param>
        /// <param name="pathTaskSid"> The unique ID of the Task associated with this Field. </param>
        /// <param name="fieldType"> The unique name or sid of the FieldType. It can be any Built-in Field Type or the
        ///                 unique_name or sid of a custom Field Type. </param>
        /// <param name="uniqueName"> A user-provided string that uniquely identifies this resource as an alternative to the
        ///                  sid. Unique up to 64 characters long. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Field </returns>
        public static async System.Threading.Tasks.Task <FieldResource> CreateAsync(string pathAssistantSid,
                                                                                    string pathTaskSid,
                                                                                    string fieldType,
                                                                                    string uniqueName,
                                                                                    ITwilioRestClient client = null)
        {
            var options = new CreateFieldOptions(pathAssistantSid, pathTaskSid, fieldType, uniqueName);

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The unique ID of the parent Assistant. </param>
        /// <param name="pathTaskSid"> The unique ID of the Task associated with this Field. </param>
        /// <param name="fieldType"> The unique name or sid of the FieldType. It can be any Built-in Field Type or the
        ///                 unique_name or sid of a custom Field Type. </param>
        /// <param name="uniqueName"> A user-provided string that uniquely identifies this resource as an alternative to the
        ///                  sid. Unique up to 64 characters long. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Field </returns>
        public static FieldResource Create(string pathAssistantSid,
                                           string pathTaskSid,
                                           string fieldType,
                                           string uniqueName,
                                           ITwilioRestClient client = null)
        {
            var options = new CreateFieldOptions(pathAssistantSid, pathTaskSid, fieldType, uniqueName);

            return(Create(options, client));
        }