/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Sample parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Sample </returns>
        public static SampleResource Create(CreateSampleOptions 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 Sample parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Sample </returns>
        public static async System.Threading.Tasks.Task <SampleResource> CreateAsync(CreateSampleOptions 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(CreateSampleOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Autopilot,
                "/v1/Assistants/" + options.PathAssistantSid + "/Tasks/" + options.PathTaskSid + "/Samples",
                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 associated with the Sample resource to create </param>
        /// <param name="language"> The ISO language-country string that specifies the language used for the new sample </param>
        /// <param name="taggedText"> The text example of how end users might express the task </param>
        /// <param name="sourceChannel"> The communication channel from which the new sample was captured </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Sample </returns>
        public static async System.Threading.Tasks.Task <SampleResource> CreateAsync(string pathAssistantSid,
                                                                                     string pathTaskSid,
                                                                                     string language,
                                                                                     string taggedText,
                                                                                     string sourceChannel     = null,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateSampleOptions(pathAssistantSid, pathTaskSid, language, taggedText)
            {
                SourceChannel = sourceChannel
            };

            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 associated with the Sample resource to create </param>
        /// <param name="language"> The ISO language-country string that specifies the language used for the new sample </param>
        /// <param name="taggedText"> The text example of how end users might express the task </param>
        /// <param name="sourceChannel"> The communication channel from which the new sample was captured </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Sample </returns>
        public static SampleResource Create(string pathAssistantSid,
                                            string pathTaskSid,
                                            string language,
                                            string taggedText,
                                            string sourceChannel     = null,
                                            ITwilioRestClient client = null)
        {
            var options = new CreateSampleOptions(pathAssistantSid, pathTaskSid, language, taggedText)
            {
                SourceChannel = sourceChannel
            };

            return(Create(options, client));
        }