aboutsummaryrefslogtreecommitdiff
path: root/src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-12-29 00:41:52 +0100
commita304c24b32c0327436bbd8c2853e60668e161b42 (patch)
tree08f65c05daca134cf4d2e4f779bd15d98fd66370 /src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs
parent120a3c6bddd0fb8d9fa05df4763596956554c025 (diff)
Rename a lot of stuff, add Santiago real time
Diffstat (limited to 'src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs')
-rw-r--r--src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs b/src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs
deleted file mode 100644
index eed78d6..0000000
--- a/src/Costasdev.Busurbano.Sources.OpenTripPlannerGql/OpenTripPlannerClient.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Net.Http.Json;
-using Costasdev.Busurbano.Sources.OpenTripPlannerGql.Queries;
-using Microsoft.Extensions.Logging;
-
-namespace Costasdev.Busurbano.Sources.OpenTripPlannerGql;
-
-public class OpenTripPlannerClient
-{
- private readonly HttpClient _httpClient;
- private readonly string _baseUrl;
- private readonly ILogger<OpenTripPlannerClient> _logger;
-
- public OpenTripPlannerClient(
- HttpClient httpClient,
- string baseUrl,
- ILogger<OpenTripPlannerClient> logger
- )
- {
- _httpClient = httpClient;
- _baseUrl = baseUrl;
- _logger = logger;
- }
-
- public async Task GetStopsInBbox(double minLat, double minLon, double maxLat, double maxLon)
- {
- var requestContent =
- StopTileRequestContent.Query(new StopTileRequestContent.Bbox(minLon, minLat, maxLon, maxLat));
-
- var request = new HttpRequestMessage(HttpMethod.Post, $"{_baseUrl}/gtfs/v1");
- request.Content = JsonContent.Create(new GraphClientRequest
- {
- Query = requestContent
- });
-
- var response = await _httpClient.SendAsync(request);
- var responseBody = await response.Content.ReadFromJsonAsync<GraphClientResponse<StopTileResponse>>();
-
- if (responseBody is not { IsSuccess: true })
- {
- _logger.LogError(
- "Error fetching stop data, received {StatusCode} {ResponseBody}",
- response.StatusCode,
- await response.Content.ReadAsStringAsync()
- );
- }
- }
-}