public async Task <ActionResult> Cards()
        {
            IPageOfCardData page = await _client.GetPageOfCards(new ApiWrapper.Requests.GetPageOfCardsRequest()
            {
                Count  = 10,
                Offset = 0
            });

            List <IVariationDetail> varDetails = new List <IVariationDetail>();

            foreach (var card in page.Results)
            {
                var cardData = await _client.GetCardData(new GetCardDataRequest()
                {
                    Href = card.Href
                });

                var varDetail = await _client.GetVariationDetail(new GetVariationDetailRequest()
                {
                    UUID = cardData.UUID
                });

                varDetails.Add(varDetail);
            }
            return(View(varDetails));
        }
示例#2
0
        public async Task <IPageOfCardData> GetPageOfCards(GetPageOfCardsRequest request)
        {
            try
            {
                HttpResponseMessage reply = await _client.GetAsync(baseApi + pageOfCardsEndpoint + $"?limit={request.Count}&offset={request.Offset}");

                CheckStatusCode(reply);
                string jsonReply = await reply.Content.ReadAsStringAsync();

                IPageOfCardData page = Newtonsoft.Json.JsonConvert.DeserializeObject <PageOfCardData>(jsonReply);
                return(page);
            }
            catch (Exception ex) { return(null); }
        }