Ejemplo n.º 1
0
        public async Task <ResponseContainer <T> > Get(DateTime date)
        {
            string week = date.Month.ToString();

            if (week.Length == 1)
            {
                week = $"0{week}";
            }

            var year = date.Year;

            var url = $"{BreweryDbClient.BaseAddress}feature/{year}-{week}?key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <T> >(url));
        }
Ejemplo n.º 2
0
        public async Task <ResponseContainer <List <T> > > Get(NameValueCollection nvc)
        {
            var parameterBuilder = new StringBuilder();

            foreach (var parameter in nvc)
            {
                parameterBuilder.Append(parameter.Key);
                parameterBuilder.Append("=");
                parameterBuilder.Append(parameter.Value);
                parameterBuilder.Append("&");
            }

            var url = $"{BreweryDbClient.BaseAddress}beers?{parameterBuilder}key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <List <T> > >(url));
        }
Ejemplo n.º 3
0
        public async Task <ResponseContainer <List <T> > > GetAll(int pageNumber)
        {
            var url = $"{BreweryDbClient.BaseAddress}features?p={pageNumber}&key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <List <T> > >(url));
        }
Ejemplo n.º 4
0
        public async Task <ResponseContainer <T> > ThisWeeks()
        {
            var url = $"{BreweryDbClient.BaseAddress}featured?key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <T> >(url));
        }
        public async Task <ResponseContainer <T> > Get(string id)
        {
            var url = $"{BreweryDbClient.BaseAddress}adjunct/{id}?key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <T> >(url));
        }
Ejemplo n.º 6
0
        public async Task <ResponseContainer <List <T> > > Search(string keyword)
        {
            var url = $"{BreweryDbClient.BaseAddress}search?q={keyword}&type=beer&withBreweries=y&withSocialAccounts=y&withGuilds=y&withLocations=y&withAlternateNames=y&hasLabels=y&withIngredients=y&key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <List <T> > >(url));
        }
Ejemplo n.º 7
0
        public async Task <ResponseContainer <List <T> > > GetAll()
        {
            var url = $"{BreweryDbClient.BaseAddress}socialsites?key={BreweryDbClient.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <List <T> > >(url));
        }
Ejemplo n.º 8
0
        public async Task <ResponseContainer <List <T> > > GetBeerListWithFilter(string filterStr)
        {
            var url = $"{BreweryDbAPICall.BaseAddress}beers?{filterStr}&key={BreweryDbAPICall.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <List <T> > >(url));
        }
Ejemplo n.º 9
0
        public async Task <ResponseContainer <T> > Get(string id)
        {
            var url = $"{BreweryDbAPICall.BaseAddress}beer/{id}?withBreweries=y&key={BreweryDbAPICall.ApplicationKey}&format=json";

            return(await JsonDownloader.DownloadSerializedJsonDataAsync <ResponseContainer <T> >(url));
        }