props/Props-Modules/Props.Shop/Ebay/Api/ItemSummary/SearchResultParser.cs

29 lines
886 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using Props.Shop.Framework;
namespace Props.Shop.Ebay.Api.ItemSummary
{
public class SearchResultParser
{
private dynamic data;
public int BeginIndex => data.offset;
public int EndIndex => BeginIndex + data.limit;
public IEnumerable<ProductListing> ProductListings { get; private set; }
public SearchResultParser(string result)
{
data = JObject.Parse(result);
List<ProductListing> parsed = new List<ProductListing>();
foreach (dynamic itemSummary in data.itemSummaries)
{
ProductListing listing = new ProductListing();
// TODO: Finish parsing the data.
parsed.Add(listing);
}
ProductListings = parsed;
}
}
}