Example #1
0
        /// <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));
        }
Example #2
0
        /// <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));
        }
Example #3
0
 private static Request BuildCreateRequest(CreateSampleOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/understand/Assistants/" + options.PathAssistantSid + "/Intents/" + options.PathIntentSid + "/Samples",
                client.Region,
                postParams: options.GetParams()
                ));
 }
Example #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The assistant_sid </param>
        /// <param name="pathIntentSid"> The intent_sid </param>
        /// <param name="language"> An ISO language-country string of the sample. </param>
        /// <param name="taggedText"> The text example of how end-users may express this intent. The sample may contain Field
        ///                  tag blocks. </param>
        /// <param name="sourceChannel"> The communication channel the sample was captured. It can be: voice, sms, chat, alexa,
        ///                     google-assistant, or slack. If not included the value will be null </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 pathIntentSid,
                                                                                     string language,
                                                                                     string taggedText,
                                                                                     string sourceChannel     = null,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateSampleOptions(pathAssistantSid, pathIntentSid, language, taggedText)
            {
                SourceChannel = sourceChannel
            };

            return(await CreateAsync(options, client));
        }
Example #5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The assistant_sid </param>
        /// <param name="pathIntentSid"> The intent_sid </param>
        /// <param name="language"> An ISO language-country string of the sample. </param>
        /// <param name="taggedText"> The text example of how end-users may express this intent. The sample may contain Field
        ///                  tag blocks. </param>
        /// <param name="sourceChannel"> The communication channel the sample was captured. It can be: voice, sms, chat, alexa,
        ///                     google-assistant, or slack. If not included the value will be null </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 pathIntentSid,
                                            string language,
                                            string taggedText,
                                            string sourceChannel     = null,
                                            ITwilioRestClient client = null)
        {
            var options = new CreateSampleOptions(pathAssistantSid, pathIntentSid, language, taggedText)
            {
                SourceChannel = sourceChannel
            };

            return(Create(options, client));
        }