/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create FieldType parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of FieldType </returns>
        public static FieldTypeResource Create(CreateFieldTypeOptions 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(CreateFieldTypeOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Autopilot,
                "/v1/Assistants/" + options.PathAssistantSid + "/FieldTypes",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The SID of the Assistant that is the parent of the new resource </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the new resource </param>
        /// <param name="friendlyName"> A string to describe the new resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of FieldType </returns>
        public static async System.Threading.Tasks.Task <FieldTypeResource> CreateAsync(string pathAssistantSid,
                                                                                        string uniqueName,
                                                                                        string friendlyName      = null,
                                                                                        ITwilioRestClient client = null)
        {
            var options = new CreateFieldTypeOptions(pathAssistantSid, uniqueName)
            {
                FriendlyName = friendlyName
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The SID of the Assistant that is the parent of the new resource </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the new resource </param>
        /// <param name="friendlyName"> A string to describe the new resource </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of FieldType </returns>
        public static FieldTypeResource Create(string pathAssistantSid,
                                               string uniqueName,
                                               string friendlyName      = null,
                                               ITwilioRestClient client = null)
        {
            var options = new CreateFieldTypeOptions(pathAssistantSid, uniqueName)
            {
                FriendlyName = friendlyName
            };

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

            return(FromJson(response.Content));
        }