public static async Task <EDSMResponse <Stations> > GetSystemStations(string systemName) { string url = "https://www.edsm.net/api-system-v1/stations?systemName=" + systemName; var response = await EdsmApiCaller <StationsJSON> .GetWebJSONAsync(url); if (response.HasError) { ErrorEvent(response.err); return(null); } return(response.response.Convert((int)response.StatusCode, response.StatusCodeMessage)); }
public static async Task <EDSMResponse <Ranks> > GetCommanderRanks(string commanderName) { string url = "https://www.edsm.net/api-commander-v1/get-ranks?commanderName=" + commanderName; var response = await EdsmApiCaller <JSONRanks> .GetWebJSONAsync(url); if (response.HasError) { ErrorEvent(response.err); return(null); } return(response.response.Convert((int)response.StatusCode, response.StatusCodeMessage)); }
public static async Task <Types.EDSM.ApiStatus.ApiStatus> GetApiStatus() { string url = "https://www.edsm.net/api-status-v1/elite-server"; var response = await EdsmApiCaller <Types.EDSM.ApiStatus.JSON> .GetWebJSONAsync(url); if (!response.HasError) { return(response.response.Convert()); } ErrorEvent(response.err, "Failed to get the current Elite:Dangerous servers' status."); return(null); }
public static async Task <EDSMResponse <Traffic> > GetSystemTraffic(string systemName) { string url = "https://www.edsm.net/api-system-v1/traffic?systemName=" + systemName; var response = await EdsmApiCaller <TrafficJSON> .GetWebJSONAsync(url); if (response.HasError) { ErrorEvent(response.err); return(new EDSMResponse <Traffic> { Data = null, HTMLStatus = (int)response.StatusCode, HTMLStatusResponse = response.StatusCodeMessage, Message = response.err.Message, MessageNumber = 1 }); } return(response.response.Convert((int)response.StatusCode, response.StatusCodeMessage)); }
public static async Task <EDSMResponse <Position> > GetCommanderPosition(string commanderName) { string url = "https://www.edsm.net/api-logs-v1/get-position?showCoordinates=1&commanderName=" + commanderName; var response = await EdsmApiCaller <JSONPosition> .GetWebJSONAsync(url); if (response.HasError) { ErrorEvent(response.err); return(new EDSMResponse <Position> { Data = null, HTMLStatus = (int)response.StatusCode, HTMLStatusResponse = response.StatusCodeMessage, Message = response.err.Message, MessageNumber = 1 }); } return(response.response.Convert((int?)response.StatusCode, response.StatusCodeMessage)); }
public static async Task <EDSMResponse <StarSystem> > GetSystemData(string systemName) { string url = "https://www.edsm.net/api-v1/system?showInformation=1&showId=1&showCoordinates=1&showPrimaryStar=1&showPermit=1&systemName=" + systemName; var response = await EdsmApiCaller <SystemJSON> .GetWebJSONAsync(url); if (response.HasError) { ErrorEvent(response.err); return(new EDSMResponse <StarSystem> { HTMLStatus = (int?)response.StatusCode ?? -1, HTMLStatusResponse = response.StatusCodeMessage, Message = response.err.Message, MessageNumber = -1, Data = null }); } return(response.response.Convert((int?)response.StatusCode, response.StatusCodeMessage)); }