using System; using System.Collections.Generic; using System.Web.Script.Serialization; namespace Retailcrm.Versions.V3 { public partial class Client { /// /// Get inventories /// /// /// /// /// public Response StoreInventoriesGet(Dictionary filter = null, int page = 1, int limit = 20) { Dictionary parameters = new Dictionary(); if (filter != null && filter.Count > 0) { parameters.Add("filter", filter); } if (page > 0) { parameters.Add("page", page); } if (limit > 0) { parameters.Add("limit", limit); } return Request.MakeRequest("/store/inventories", Request.MethodGet, parameters); } /// /// Upload inventories /// /// /// /// public Response StoreInventoriesUpload(List offers, string site = "") { if (offers.Count< 1) { throw new ArgumentException("Parameter `offers` must contains a data"); } if (offers.Count > 250) { throw new ArgumentException("Parameter `offers` must contain 250 or less records"); } return Request.MakeRequest( "/store/inventories/upload", Request.MethodPost, FillSite( site, new Dictionary { { "offers", new JavaScriptSerializer().Serialize(offers) } } ) ); } } }