예제 #1
0
        private async Task <List <PlaceInfo> > GetBarDataAsync(string latitude, string longitude)
        {
            var categories = _categoryListString.Split(',');
            var placeList  = new List <PlaceInfo>();

            foreach (var category in categories)
            {
                var link       = string.Format(_mapperLink, latitude, longitude, _accessKey, category);
                var jsonStream = await _fetcher.GetHttpStreamAsync(link);

                placeList.AddRange(JsonConvert.DeserializeObject <PlacesResponse>(jsonStream).data);
            }
            await FetchLocationsAsync(placeList);

            return(placeList);
        }
예제 #2
0
        public static async Task <T> FetchAndDeserializeAsync <T>(string link, IHttpFetcher fetcher)
        {
            var jsonStream = await fetcher.GetHttpStreamAsync(link);

            var deserialized = JsonConvert.DeserializeObject <T>(jsonStream);

            return(deserialized);
        }
        private async Task <List <Place> > GetBarDataAsync(string latitude, string longitude, string radius)
        {
            RegexTools.LocationDataTextIsCorrect(latitude, longitude, radius);
            var link       = string.Format(_apiLink, _accessToken, latitude, longitude, radius, _requestedFields, _category);
            var jsonStream = await _fetcher.GetHttpStreamAsync(link);

            var barList = JsonConvert.DeserializeObject <PlacesResponse>(jsonStream).data;

            return(barList);
        }
예제 #4
0
        private async Task <IEnumerable <Venue> > GetBarDataAsync(string latitude, string longitude, string radius)
        {
            var categoryIDs = _categoryIdDs.Split(',');
            var venueList   = new List <Venue>();

            foreach (var category in categoryIDs)
            {
                var link       = string.Format(_apiLink, _clientId, _clientSecret, latitude, longitude, category, radius);
                var jsonStream = await _fetcher.GetHttpStreamAsync(link);

                venueList.AddRange(JsonConvert.DeserializeObject <SearchResponse>(jsonStream).response.venues);
            }
            return(venueList);
        }
        private async Task <IEnumerable <Place> > GetBarDataAsync(string latitude, string longitude, string radius)
        {
            var categoryList = _categoryList.Split(',');
            var placeList    = new List <Place>();

            foreach (var category in categoryList)
            {
                var link       = string.Format(_apiLink, latitude, longitude, radius, category, _apiKey);
                var jsonStream = await _fetcher.GetHttpStreamAsync(link);

                var deserialized = JsonConvert.DeserializeObject <PlacesApiQueryResponse>(jsonStream).Results;
                placeList.AddRange(deserialized);
            }
            return(placeList);
        }