174
1
using System;
2
using System.Collections.Generic;
3
using System.Net.Http;
4
using System.Threading.Tasks;
5
6
//if you see a request failed, it ran out of api requests for the day
7
public class SatellitePositionService
8
{
9
private readonly HttpClient _httpClient;
10
public SatellitePositionService()
11
{
12
_httpClient = new HttpClient();
13
}
14
15
public async Task<string> GetCelestrakTLEData(string satelliteName)
16
{
17
string apiUrl = "https://celestrak.org/NORAD/elements/gp.php?GROUP=engineering&FORMAT=tle";
18
return await GetDataFromApi(apiUrl, "Celestrak");
19
}
20
21
public async Task<string> GetN2YOTLEData(string noradId)
22
{
23
string apiUrl = $"https://www.n2yo.com/rest/v1/satellite/tle/39084";
24
return await GetDataFromApi(apiUrl, "N2YO");
Cached Result
Action | Entities | Performance | TimeFaster | ReducedPercent |
---|---|---|---|---|
Dapper | 2000 | 7424 ms | ||
Dapper Plus | 2000 | 83 ms | 89.45x faster than Dapper | Time reduced by 99% compared to Dapper |