blob: dfecdd6753ffb8515aaa4d1e0cbb2202c17303d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
using System.Globalization;
using System.Text.Json.Serialization;
namespace Costasdev.Busurbano.Backend.GraphClient.App;
public class ArrivalsAtStopContent : IGraphRequest<string>
{
public static string Query(string id)
{
return string.Create(CultureInfo.InvariantCulture, $@"
query Query {{
stop(id:""{id}"") {{
code
name
arrivals: stoptimesWithoutPatterns(numberOfDepartures:10) {{
trip {{
gtfsId
routeShortName
route {{
color
textColor
}}
}}
headsign
scheduledDeparture
}}
}}
}}
");
}
}
public class ArrivalsAtStopResponse : AbstractGraphResponse
{
[JsonPropertyName("stop")]
public StopItem Stop { get; set; }
public class StopItem
{
[JsonPropertyName("code")]
public required string Code { get; set; }
[JsonPropertyName("name")]
public required string Name { get; set; }
[JsonPropertyName("arrivals")]
public List<Arrival> Arrivals { get; set; } = [];
}
public class Arrival
{
[JsonPropertyName("headsign")]
public required string Headsign { get; set; }
[JsonPropertyName("scheduledDeparture")]
public int ScheduledDepartureSeconds { get; set; }
[JsonPropertyName("trip")]
public required TripDetails Trip { get; set; }
}
public class TripDetails
{
[JsonPropertyName("gtfsId")]
public required string GtfsId { get; set; }
[JsonPropertyName("routeShortName")]
public required string RouteShortName { get; set; }
[JsonPropertyName("route")]
public required RouteDetails Route { get; set; }
}
public class RouteDetails
{
[JsonPropertyName("color")]
public required string Color { get; set; }
[JsonPropertyName("textColor")]
public required string TextColor { get; set; }
}
}
|