/// <summary> /// Fetches JSON data from API and then converts it to regular model /// </summary> /// <param name="stationId">Station id</param> /// <param name="duration">Days count to forecasts upfront</param> /// <returns>List of TidalEvents</returns> public List <TidalEvent> FetchEvents(string stationId, int duration = 1) { string response = GetInstance().GetTidalEventsJSON(stationId, duration); List <Newton.TidalEventNewton> eventList = JsonConvert.DeserializeObject <List <Newton.TidalEventNewton> >(response); return(NewtonModelsConverter.TidalEventNewton_ToList_TidalEvent(eventList, stationId)); }
/// <summary> /// Fetches JSON data from API an converts to regular model /// </summary> /// <returns>List of TidalStation's</returns> public List <TidalStation> FetchStations() { string response = GetInstance().GetStationsJSON(); Newton.TidalStationsNewton model = JsonConvert.DeserializeObject <Newton.TidalStationsNewton>(response); return(NewtonModelsConverter.TidalStationsNewton_ToList_TidalStation(model)); }