This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
/
Leg.ts
196 lines (180 loc) · 5.23 KB
/
Leg.ts
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import { LegMode, TransportSubmode } from '../types/Mode'
import { uniq } from '../utils'
import {
fragmentName as lineFields,
fragments as lineFragments,
Line,
} from './Line'
import {
fragmentName as placeFields,
fragments as placeFragments,
Place,
} from './Place'
import {
fragmentName as authorityFields,
fragments as authorityFragments,
Authority,
} from './Authority'
import {
fragmentName as operatorFields,
fragments as operatorFragments,
Operator,
} from './Operator'
import {
fragmentName as serviceJourneyFields,
fragments as serviceJourneyFragments,
ServiceJourney,
} from './ServiceJourney'
import {
fragmentName as situationFields,
fragments as situationFragments,
Situation,
} from './Situation'
import {
fragmentName as interchangeFields,
fragments as interchangeFragments,
Interchange,
} from './Interchange'
import {
fragmentName as pointsOnLinkFields,
fragments as pointsOnLinkFragments,
PointsOnLink,
} from './PointsOnLink'
import {
fragmentName as estimatedCallFields,
fragments as estimatedCallFragments,
EstimatedCall,
IntermediateEstimatedCall,
} from './EstimatedCall'
import {
fragmentName as bookingArrangementFields,
fragments as bookingArrangementFragments,
BookingArrangement,
} from './BookingArrangement'
import { Notice } from './Notice'
/**
* @deprecated
* The JourneyPlanner v2 queries and types are deprecated.
* Write your own GraphQL queries for JourneyPlanner v3.
* Write your own types or use those from JourneyPlannerTypes where applicable.
*/
export interface Leg {
/** The aimed date and time this leg ends. */
aimedEndTime: string
/** The aimed date and time this leg starts. */
aimedStartTime: string
/** For ride legs, the service authority used for this legs. For non-ride legs, null. */
authority?: Authority
/** The distance traveled while traversing the leg in meters. */
distance: number
/** This sums the direct durations of each leg. Be careful about using this, as it is not equal to the duration between startTime and endTime. See the directDuration documentation on Leg. */
directDuration: number
/** Duration of the trip, in seconds. */
duration: number
/** The expected, realtime adjusted date and time this leg ends. */
expectedEndTime: string
expectedStartTime: string
/** EstimatedCall for the quay where the leg originates. */
fromEstimatedCall?: EstimatedCall
/** The Place where the leg originates. */
fromPlace: Place
interchangeFrom?: Interchange
interchangeTo?: Interchange
/** For ride legs, estimated calls for quays between the Place where the leg originates and the Place where the leg ends. For non-ride legs, empty list. */
intermediateEstimatedCalls: IntermediateEstimatedCall[]
/** For ride legs, the line. For non-ride legs, undefined. */
line?: Line
/** The mode of transport or access (e.g., foot) used when traversing this leg. */
mode: LegMode
notices?: Notice[] // from mapper
/** For ride legs, the operator used for this legs. For non-ride legs, null. */
operator?: Operator
pointsOnLink?: PointsOnLink
/** Whether there is real-time data about this leg or not */
realtime: boolean
ride: boolean
rentedBike?: boolean
/** For ride legs, the service journey. For non-ride legs, null. */
serviceJourney: ServiceJourney
/** All relevant situations for this leg */
situations: Situation[]
/** EstimatedCall for the quay where the leg ends. */
toEstimatedCall?: EstimatedCall
/** The Place where the leg ends. */
toPlace: Place
/** The transport sub mode (e.g., localBus or expressBus) used when traversing this leg. Null if leg is not a ride */
transportSubmode?: TransportSubmode
bookingArrangements?: BookingArrangement
}
export const fragmentName = 'legFields'
const fragment = `
fragment ${fragmentName} on Leg {
aimedEndTime
aimedStartTime
authority {
...${authorityFields}
}
distance
directDuration
duration
expectedEndTime
expectedStartTime
fromEstimatedCall {
...${estimatedCallFields}
}
fromPlace {
...${placeFields}
}
interchangeFrom {
...${interchangeFields}
}
interchangeTo {
...${interchangeFields}
}
intermediateEstimatedCalls {
...${estimatedCallFields}
}
line {
...${lineFields}
}
mode
operator {
...${operatorFields}
}
pointsOnLink {
...${pointsOnLinkFields}
}
realtime
ride
rentedBike
serviceJourney {
...${serviceJourneyFields}
}
situations {
...${situationFields}
}
toEstimatedCall {
...${estimatedCallFields}
}
toPlace {
...${placeFields}
}
transportSubmode
bookingArrangements {
...${bookingArrangementFields}
}
}
`
export const fragments = uniq<string>([
fragment,
...lineFragments,
...placeFragments,
...authorityFragments,
...operatorFragments,
...serviceJourneyFragments,
...situationFragments,
...interchangeFragments,
...pointsOnLinkFragments,
...estimatedCallFragments,
...bookingArrangementFragments,
])