Esempio n. 1
0
        public static LuisModel GetLuisIntent(string userStringQuery)
        {
            System.Collections.Specialized.NameValueCollection queryString = GetLuisQueryString(userStringQuery);

            string    jsonResponse = GetHttpResponse.GetJsonResponse(_luisUrl, queryString);
            LuisModel luisModel    = JsonConvert.DeserializeObject <LuisModel>(jsonResponse);

            return(luisModel);
        }
Esempio n. 2
0
        public string GetLuisIntent(string userStringQuery, string uri, string subscriptionKey)
        {
            _subscriptionKey = subscriptionKey;

            System.Collections.Specialized.NameValueCollection queryString = GetLuisQueryString(userStringQuery);

            string jsonResponse = GetHttpResponse.GetJsonResponse(uri, queryString);

            return(jsonResponse);
        }
        public Attachment GetMarketCap()
        {
            string coinmarketCapEndPoint = "https://api.coinmarketcap.com/v1/global/";

            string jsonResponse = GetHttpResponse.GetJsonResponse(coinmarketCapEndPoint);

            CoinMarketCapResponseModel coinMarketCapResponse = JsonConvert.DeserializeObject <CoinMarketCapResponseModel>(jsonResponse);

            var returnHero = CreateContextCard.GetHeroCard(coinMarketCapResponse.total_market_cap_usd.AddCommasAndCultureInfo("$"));

            return(returnHero);
        }
Esempio n. 4
0
        public static List <LuisModel> GetLuisIntent(string[] userStringQuery)
        {
            int lengthOfQueries             = userStringQuery.Length;
            List <LuisModel> returnResponse = new List <LuisModel>();

            for (int i = 0; i < userStringQuery.Length; i++)
            {
                System.Collections.Specialized.NameValueCollection queryString = GetLuisQueryString(userStringQuery[i]);

                string    jsonResponse = GetHttpResponse.GetJsonResponse(_luisUrl, queryString);
                LuisModel luisModel    = JsonConvert.DeserializeObject <LuisModel>(jsonResponse);
                luisModel.responseJson = jsonResponse;
                returnResponse.Add(luisModel);
            }

            return(returnResponse);
        }
        public IActionResult Get([FromRoute] string id)
        {
            var serviceResponse = _storageService.Select(id);

            var response = new GetHttpResponse
            {
                Total = serviceResponse.Total, StorageCollection = serviceResponse.Storages.SelectMany(
                    storage => new List <object>
                {
                    new
                    {
                        storage.Id, storage.Name, storage.RackNumber
                    }
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }
        public IActionResult Get([FromQuery] GetHttpRequest request)
        {
            var serviceResponse = _storageService.SelectAll(request.Offset, request.Limit);

            var response = new GetHttpResponse
            {
                Total = serviceResponse.Total, StorageCollection = serviceResponse.Storages.SelectMany(
                    storage => new List <object>
                {
                    new
                    {
                        storage.Id, storage.Name, storage.RackNumber
                    }
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }
Esempio n. 7
0
        public string GetLuisIntent(string userStringQuery)
        {
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            queryString["q"] = HttpUtility.UrlEncode(userStringQuery);

            queryString["subscription-key"] = ConfigurationManager.AppSettings["LuisSubscriptionKey"];

            queryString["timezoneOffset"] = "0";
            queryString["verbose"]        = "false";
            queryString["spellCheck"]     = "false";
            queryString["staging"]        = "false";


            string jsonResponse = GetHttpResponse.GetJsonResponse(uri, queryString);


            return(jsonResponse);
        }
        public Attachment GetRandomGifBasedOnSearchCritera(string searchCritera)
        {
            const string giphyApiKey   = "ROSoLz0Iz8suznXXf1KOQ4a7RgjOSTS8";
            string       giphyEndPoint = $"https://api.giphy.com/v1/gifs/random?api_key={giphyApiKey}&tag={searchCritera}&rating=G";

            string jsonResponse = GetHttpResponse.GetJsonResponse(giphyEndPoint);

            var stronglyTypedGiphyResponse = JsonConvert.DeserializeAnonymousType(jsonResponse, new GiphyResponse());

            List <MediaUrl> mediaUrl = new List <MediaUrl>();

            mediaUrl.Add(new MediaUrl()
            {
                Profile = "image/gif",
                Url     = stronglyTypedGiphyResponse.Data.GiphyImages.GiphyInnerObject.Mp4
            });

            return(CreateContextCard.GetAnimationCard(mediaUrl: mediaUrl, autoLoop: true, autoStart: true));
        }