Exemplo n.º 1
0
 public static string apiUrl = "https://api.zalando.com"; //this will be set when the app starts in the case we need to change country.
 public static async Task<string> callAsync(string api, Filter filter)
 {
     HttpClient client = new HttpClient();
     Task<string> getStringTask = client.GetStringAsync(getApiUrl(api, filter));
     
     string urlContents = await getStringTask;
     return urlContents;
 }
Exemplo n.º 2
0
        private async Task<List<Article>> getArticles(Filter filter)
        {
            Article article = new Article();
            Task<List<Article>> task = article.readAPIAsync<Article>(filter);
                //"https://api.zalando.com/articles?brandFamily=nike&color=white&color=red&category=womens-shoes&page=1&pageSize=2");
            List<Article> list = await task;

            return list;
        }
Exemplo n.º 3
0
 public async Task TestGetArticles()
 {
     Article article = new Article();
     Filter filter = new Filter();
     filter.setFilter("brandFamily=nike&color=white&color=red&category=womens-shoes&page=1&pageSize=2");
     Task<List<Article>> task = article.readAPIAsync<Article>(filter);
     List<Article>  list = await task;
     Assert.AreNotEqual(list.Count, 0);
 }
Exemplo n.º 4
0
        private async Task<List<Article>> getArticles(string fullText)
        {
            Filter filter = new Filter().addGender(gender).addFullText(fullText).addPaging(currentPage);
            Article article = new Article();
            Task<List<Article>> task = article.readAPIAsync<Article>(filter);
            List<Article> list = await task;

            Articles = list;
            return list;
            
        }
Exemplo n.º 5
0
 private static Filter getFilter(string gender)
 {
     Filter filter = new Filter().addGender(gender);
     return filter;
 }
Exemplo n.º 6
0
 private static string getApiUrl(string api, Filter filter)
 {
     return apiUrl + api + filter.UrlFilter;
 }