Ejemplo n.º 1
0
 public async Task<AsyncResult<Product[]>> GetAsync()
 {
     var token = authStore.LoadToken();
     using (var client = new BearerHttpClient(token.AccessToken))
     {
         var str = await client.GetStringAsync(new Uri("api/products", UriKind.Relative));
         var res = JsonConvert.DeserializeObject<Product[]>(str);
         return new AsyncResult<Product[]> { Result = res, Succeed = true };
     }
 }
Ejemplo n.º 2
0
 public async Task<AsyncResult<FileDescription[]>> GetFiles(string productId)
 {
     var token = authStore.LoadToken();
     using (var client = new BearerHttpClient(token.AccessToken))
     {
         var uriString = string.Format("api/products/{0}/files", productId);
         var uri = new Uri(uriString, UriKind.Relative);
         var str = await client.GetStringAsync(uri);
         var res = JsonConvert.DeserializeObject<FileDescription[]>(str);
         return new AsyncResult<FileDescription[]> { Result = res, Succeed = true };
     }
 }