From a304c24b32c0327436bbd8c2853e60668e161b42 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Mon, 29 Dec 2025 00:41:52 +0100 Subject: Rename a lot of stuff, add Santiago real time --- .../Queries/StopsInfo.cs | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/Enmarcha.Sources.OpenTripPlannerGql/Queries/StopsInfo.cs (limited to 'src/Enmarcha.Sources.OpenTripPlannerGql/Queries/StopsInfo.cs') diff --git a/src/Enmarcha.Sources.OpenTripPlannerGql/Queries/StopsInfo.cs b/src/Enmarcha.Sources.OpenTripPlannerGql/Queries/StopsInfo.cs new file mode 100644 index 0000000..01557c0 --- /dev/null +++ b/src/Enmarcha.Sources.OpenTripPlannerGql/Queries/StopsInfo.cs @@ -0,0 +1,57 @@ +using System.Globalization; +using System.Text.Json.Serialization; + +namespace Enmarcha.Sources.OpenTripPlannerGql.Queries; + +public class StopsInfoContent : IGraphRequest +{ + public record Args(IEnumerable Ids); + + public static string Query(Args args) + { + var idsString = string.Join("\",\"", args.Ids); + return string.Create(CultureInfo.InvariantCulture, $@" + query Query {{ + stops(ids: [""{idsString}""]) {{ + gtfsId + code + name + lat + lon + routes {{ + shortName + color + textColor + }} + }} + }} + "); + } +} + +public class StopsInfoResponse : AbstractGraphResponse +{ + [JsonPropertyName("stops")] public List? Stops { get; set; } + + public class StopItem + { + [JsonPropertyName("gtfsId")] public required string GtfsId { get; set; } + + [JsonPropertyName("code")] public string? Code { get; set; } + + [JsonPropertyName("name")] public required string Name { get; set; } + + [JsonPropertyName("lat")] public double Lat { get; set; } + + [JsonPropertyName("lon")] public double Lon { get; set; } + + [JsonPropertyName("routes")] public List Routes { get; set; } = []; + } + + public class RouteDetails + { + [JsonPropertyName("shortName")] public string? ShortName { get; set; } + [JsonPropertyName("color")] public string? Color { get; set; } + [JsonPropertyName("textColor")] public string? TextColor { get; set; } + } +} -- cgit v1.3