Пример #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/Services/" + options.PathServiceSid + "/Queries",
                client.Region,
                postParams: options.GetParams()
                ));
 }
Пример #4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="language"> The language </param>
        /// <param name="query"> The query </param>
        /// <param name="intent"> The intent </param>
        /// <param name="modelBuild"> The model_build </param>
        /// <param name="field"> The field </param>
        /// <param name="namedEntity"> The named_entity </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 pathServiceSid,
                                                                                    string language,
                                                                                    string query,
                                                                                    string intent            = null,
                                                                                    string modelBuild        = null,
                                                                                    string field             = null,
                                                                                    string namedEntity       = null,
                                                                                    ITwilioRestClient client = null)
        {
            var options = new CreateQueryOptions(pathServiceSid, language, query)
            {
                Intent = intent, ModelBuild = modelBuild, Field = field, NamedEntity = namedEntity
            };

            return(await CreateAsync(options, client));
        }
Пример #5
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="language"> The language </param>
        /// <param name="query"> The query </param>
        /// <param name="intent"> The intent </param>
        /// <param name="modelBuild"> The model_build </param>
        /// <param name="field"> The field </param>
        /// <param name="namedEntity"> The named_entity </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Query </returns>
        public static QueryResource Create(string pathServiceSid,
                                           string language,
                                           string query,
                                           string intent            = null,
                                           string modelBuild        = null,
                                           string field             = null,
                                           string namedEntity       = null,
                                           ITwilioRestClient client = null)
        {
            var options = new CreateQueryOptions(pathServiceSid, language, query)
            {
                Intent = intent, ModelBuild = modelBuild, Field = field, NamedEntity = namedEntity
            };

            return(Create(options, client));
        }