Пример #1
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Query parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Query </returns>
        public static QueryResource Create(CreateQueryOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Пример #2
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Query parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Query </returns>
        public static async System.Threading.Tasks.Task <QueryResource> CreateAsync(CreateQueryOptions options,
                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Пример #3
0
 private static Request BuildCreateRequest(CreateQueryOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/understand/Assistants/" + options.PathAssistantSid + "/Queries",
                postParams: options.GetParams()
                ));
 }
Пример #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The assistant_sid </param>
        /// <param name="language"> An ISO language-country string of the sample. </param>
        /// <param name="query"> A user-provided string that uniquely identifies this resource as an alternative to the sid. It
        ///             can be up to 2048 characters long. </param>
        /// <param name="intents"> Constraints the query to a set of intents. Useful when you need to constrain the paths the
        ///               user can take. Intents should be comma separated intent-unique-name-1, intent-unique-name-2 </param>
        /// <param name="modelBuild"> The Model Build Sid or unique name of the Model Build to be queried. </param>
        /// <param name="field"> Constraints the query to a given Field with an intent. Useful when you know the Field you are
        ///             expecting. It accepts one field in the format intent-unique-name-1:field-unique-name </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Query </returns>
        public static async System.Threading.Tasks.Task <QueryResource> CreateAsync(string pathAssistantSid,
                                                                                    string language,
                                                                                    string query,
                                                                                    string intents           = null,
                                                                                    string modelBuild        = null,
                                                                                    string field             = null,
                                                                                    ITwilioRestClient client = null)
        {
            var options = new CreateQueryOptions(pathAssistantSid, language, query)
            {
                Intents = intents, ModelBuild = modelBuild, Field = field
            };

            return(await CreateAsync(options, client));
        }
Пример #5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathAssistantSid"> The assistant_sid </param>
        /// <param name="language"> An ISO language-country string of the sample. </param>
        /// <param name="query"> A user-provided string that uniquely identifies this resource as an alternative to the sid. It
        ///             can be up to 2048 characters long. </param>
        /// <param name="intents"> Constraints the query to a set of intents. Useful when you need to constrain the paths the
        ///               user can take. Intents should be comma separated intent-unique-name-1, intent-unique-name-2 </param>
        /// <param name="modelBuild"> The Model Build Sid or unique name of the Model Build to be queried. </param>
        /// <param name="field"> Constraints the query to a given Field with an intent. Useful when you know the Field you are
        ///             expecting. It accepts one field in the format intent-unique-name-1:field-unique-name </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Query </returns>
        public static QueryResource Create(string pathAssistantSid,
                                           string language,
                                           string query,
                                           string intents           = null,
                                           string modelBuild        = null,
                                           string field             = null,
                                           ITwilioRestClient client = null)
        {
            var options = new CreateQueryOptions(pathAssistantSid, language, query)
            {
                Intents = intents, ModelBuild = modelBuild, Field = field
            };

            return(Create(options, client));
        }