public void GetStoreInfo(EtaApiQueryStringParameterOptions options, Action <Store> callback, Action <Exception> error) { if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm("store", "0a63T"); } ApiRaw("/api/v1/store/info/", options, onresult => { var json = JsonValue.Parse(onresult); if (json.ContainsKey("data")) { var store = Store.FromJson(json["data"], isRoot: true); callback(store); } else { callback(null); } }, (onerror, uri) => { error(onerror); }); }
public void GetStoreList(EtaApiQueryStringParameterOptions options, Action <List <Store> > callback, Action <Exception, Uri> error) { // Offer Id el. Catalog id med som key if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm(EtaApiConstants.EtaApi_Latitude, "55.77012"); options.AddParm(EtaApiConstants.EtaApi_Longitude, "12.46320"); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, "0"); options.AddParm(EtaApiConstants.EtaApi_Accuracy, "0"); options.AddParm(EtaApiConstants.EtaApi_Ditance, "10000"); //options.AddParm(EtaApiConstants.EtaApi_OfferId, ""); //options.AddParm(EtaApiConstants.EtaApi_CatalogId, ""); options.AddParm("type", "suggested"); } ApiRaw("/api/v1/store/list/", options, _onresult => { string onresult = _onresult; var json = JsonValue.Parse(onresult); List <Store> stores = new List <Store>(); foreach (var item in json["data"] as JsonArray) { var store = Store.FromJson(item, isRoot: true); stores.Add(store); } callback(stores); }, (onerror, uri) => { error(onerror, uri); }); }
public void GetOfferSearch(EtaApiQueryStringParameterOptions options, string query, Action <List <Offer> > callback, Action <Exception, Uri> error) { if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm(EtaApiConstants.EtaApi_Latitude, "55.77012"); options.AddParm(EtaApiConstants.EtaApi_Longitude, "12.46320"); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, "0"); options.AddParm(EtaApiConstants.EtaApi_Accuracy, "0"); options.AddParm(EtaApiConstants.EtaApi_Ditance, "10000"); } options.AddParm("q", query); ApiRaw("/api/v1/offer/search/", options, onresult => { var json = JsonValue.Parse(onresult); List <Offer> offers = new List <Offer>(); foreach (var item in json["data"] as JsonArray) { var offer = Offer.FromJson(item); offers.Add(offer); } callback(offers); }, (onerror, uri) => { error(onerror, uri); }); }
public void GetOfferList(EtaApiQueryStringParameterOptions options, Action <List <Offer> > callback, Action <Exception, Uri> error) { if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm("from", EtaSDK.Utils.UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm("to", EtaSDK.Utils.UNIXTime.GetTimestamp(DateTime.Now.AddDays(14))); options.AddParm(EtaApiConstants.EtaApi_Latitude, "55.77012"); options.AddParm(EtaApiConstants.EtaApi_Longitude, "12.46320"); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, "0"); options.AddParm(EtaApiConstants.EtaApi_Accuracy, "0"); options.AddParm(EtaApiConstants.EtaApi_Ditance, "10000"); //options.AddParm(EtaApiConstants.EtaApi_OfferId, ""); options.AddParm("store", "5d6dBY"); // 5d6dBY options.AddParm("type", "suggested"); } ApiRaw("/api/v1/offer/list/", options, _onresult => { string onresult = _onresult; var json = JsonValue.Parse(onresult); List <Offer> offers = new List <Offer>(); foreach (var item in json["data"] as JsonArray) { var offer = Offer.FromJson(item); offers.Add(offer); } callback(offers); }, (onerror, uri) => { error(onerror, uri); }); }
public void GetCatalogInfo(string catalogId, string publicKey, Action <Catalog> callback, Action <Exception> error) { var options = new EtaApiQueryStringParameterOptions(); options.AddParm("catalog", catalogId); ApiRaw("/api/v1/catalog/info/", options, _onresult => { string onresult = _onresult; var json = JsonValue.Parse(onresult); var catalog = Catalog.FromJson(json); callback(catalog); }, (onerror, uri) => { error(onerror); }); }
public void GetOfferInfo(EtaApiQueryStringParameterOptions options, Action <string> callback, Action <Exception> error) { if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm("type", "all"); } ApiRaw("/api/v1/store/list/", options, onresult => { var json = JsonValue.Parse(onresult); callback(onresult); }, (onerror, uri) => { error(onerror); }); }
public void GetCatalogList(EtaApiQueryStringParameterOptions options, Action <List <Catalog> > callback, Action <Exception, Uri> error) { if (options == null) { options = new EtaApiQueryStringParameterOptions(); options.AddParm(EtaApiConstants.EtaApi_Latitude, "55.77012"); options.AddParm(EtaApiConstants.EtaApi_Longitude, "12.46320"); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, "0"); options.AddParm(EtaApiConstants.EtaApi_Accuracy, "0"); options.AddParm(EtaApiConstants.EtaApi_Ditance, "10000"); } ApiRaw("/api/v1/catalog/list/", options, _onresult => { string onresult = _onresult; if (!string.IsNullOrWhiteSpace(onresult)) { try { var json = JsonValue.Parse(onresult); List <Catalog> catalogs = new List <Catalog>(); foreach (var item in json["data"] as JsonArray) { var catalog = Catalog.FromJson(item); catalogs.Add(catalog); } callback(catalogs); } catch (Exception ex) { error(new ArgumentNullException("Ups ingen data fra serveren", ex), null); } } else { error(new ArgumentNullException("Ups ingen data fra serveren"), new Uri("")); } }, (onerror, uri) => { error(onerror, uri); }); }