/// <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.Autopilot,
                "/v1/Assistants/" + options.PathAssistantSid + "/Tasks/" + options.PathTaskSid + "/Fields",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The SID of the Assistant that is the parent of the Task associated with the new
        ///                        resource </param>
        /// <param name="pathTaskSid"> The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource
        ///                   associated with the new Field resource </param>
        /// <param name="fieldType"> The Field Type of this field </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the new resource </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 SID of the Assistant that is the parent of the Task associated with the new
        ///                        resource </param>
        /// <param name="pathTaskSid"> The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource
        ///                   associated with the new Field resource </param>
        /// <param name="fieldType"> The Field Type of this field </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the new resource </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));
        }