mobility-toolbox-js 3.0.0-beta.19 → 3.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/HttpAPI.d.ts +5 -5
- package/api/RealtimeAPI.d.ts +204 -171
- package/api/RealtimeAPI.js +306 -258
- package/api/RoutingAPI.d.ts +4 -4
- package/api/StopsAPI.d.ts +4 -4
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -164
- package/api/index.js +1 -1
- package/common/controls/StopFinderControlCommon.d.ts +11 -11
- package/common/controls/StopFinderControlCommon.js +30 -30
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +149 -155
- package/common/mixins/RealtimeLayerMixin.js +395 -395
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getVehiclePosition.d.ts +2 -2
- package/common/utils/getVehiclePosition.js +7 -7
- package/common/utils/renderTrajectories.js +5 -5
- package/common/utils/sortByDelay.js +5 -5
- package/maplibre/layers/RealtimeLayer.d.ts +59 -64
- package/maplibre/layers/RealtimeLayer.js +8 -8
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/mbt.js +7205 -7031
- package/mbt.js.map +4 -4
- package/mbt.min.js +25 -25
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +81 -87
- package/ol/controls/RoutingControl.js +216 -218
- package/ol/layers/Layer.d.ts +9 -9
- package/ol/layers/MaplibreLayer.d.ts +10 -10
- package/ol/layers/MaplibreLayer.js +9 -3
- package/ol/layers/MaplibreStyleLayer.d.ts +77 -76
- package/ol/layers/MaplibreStyleLayer.js +237 -238
- package/ol/layers/RealtimeLayer.d.ts +92 -96
- package/ol/layers/RealtimeLayer.js +139 -131
- package/ol/mixins/MobilityLayerMixin.d.ts +9 -9
- package/ol/mixins/PropertiesLayerMixin.d.ts +33 -36
- package/ol/mixins/PropertiesLayerMixin.js +73 -72
- package/ol/renderers/MaplibreLayerRenderer.js +3 -3
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +14 -17
- package/ol/renderers/RealtimeLayerRenderer.d.ts +6 -6
- package/ol/renderers/RealtimeLayerRenderer.js +54 -52
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +10 -16
- package/package.json +6 -5
- package/setupTests.js +3 -4
- package/types/common.d.ts +53 -49
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +91 -93
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
package/api/HttpAPI.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export
|
|
2
|
-
url: string;
|
|
1
|
+
export interface HttpAPIOptions {
|
|
3
2
|
apiKey?: string;
|
|
4
|
-
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
5
|
/**
|
|
6
6
|
* Common class to access to a geOps api using http.
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
9
|
declare class HttpAPI {
|
|
10
|
-
url: string;
|
|
11
10
|
apiKey?: string;
|
|
11
|
+
url: string;
|
|
12
12
|
constructor(options: HttpAPIOptions);
|
|
13
13
|
/**
|
|
14
14
|
* Append the apiKey before sending the request.
|
|
15
15
|
*
|
|
16
16
|
* @private
|
|
17
17
|
*/
|
|
18
|
-
fetch(path: string, params:
|
|
18
|
+
fetch(path: string, params: object, config: RequestInit): Promise<any>;
|
|
19
19
|
}
|
|
20
20
|
export default HttpAPI;
|
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData, WebSocketAPIParameters } from './WebSocketAPI';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RealtimeBbox, RealtimeDeparture, RealtimeExtraGeom, RealtimeFullTrajectory, RealtimeGeneralizationLevel, RealtimeMode, RealtimeNews, RealtimeStation, RealtimeStationId, RealtimeStopSequence, RealtimeTenant, RealtimeTrainId, RealtimeTrajectory, RealtimeVersion } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @typedef RealtimeAPIOptions
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
url?: string;
|
|
6
|
+
export interface RealtimeAPIOptions {
|
|
8
7
|
apiKey?: string;
|
|
9
|
-
version?: RealtimeVersion;
|
|
10
8
|
bbox?: RealtimeBbox;
|
|
11
9
|
buffer?: number[];
|
|
12
10
|
pingIntervalMs?: number;
|
|
13
11
|
reconnectTimeoutMs?: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export type RealtimeAPIDeparturesById =
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
export type RealtimeModesType = {
|
|
12
|
+
url?: string;
|
|
13
|
+
version?: RealtimeVersion;
|
|
14
|
+
}
|
|
15
|
+
export type RealtimeAPIExtraGeomsById = Record<string, RealtimeExtraGeom>;
|
|
16
|
+
export type RealtimeAPIDeparturesById = Record<string, RealtimeDeparture>;
|
|
17
|
+
export interface RealtimeModesType {
|
|
22
18
|
RAW: RealtimeMode;
|
|
23
|
-
TOPOGRAPHIC: RealtimeMode;
|
|
24
19
|
SCHEMATIC: RealtimeMode;
|
|
25
|
-
|
|
20
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
21
|
+
}
|
|
26
22
|
/**
|
|
27
23
|
* Enum for Realtime modes.
|
|
28
24
|
* @readonly
|
|
@@ -35,8 +31,8 @@ export type RealtimeModesType = {
|
|
|
35
31
|
*/
|
|
36
32
|
export declare const RealtimeModes: {
|
|
37
33
|
RAW: RealtimeMode;
|
|
38
|
-
TOPOGRAPHIC: RealtimeMode;
|
|
39
34
|
SCHEMATIC: RealtimeMode;
|
|
35
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
40
36
|
};
|
|
41
37
|
/**
|
|
42
38
|
* This class provides convenience methods to use to the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
@@ -64,51 +60,15 @@ export declare const RealtimeModes: {
|
|
|
64
60
|
* @public
|
|
65
61
|
*/
|
|
66
62
|
declare class RealtimeAPI {
|
|
67
|
-
_url: string;
|
|
68
|
-
get url(): string;
|
|
69
|
-
set url(newUrl: string);
|
|
70
63
|
_bbox?: RealtimeBbox;
|
|
71
|
-
/**
|
|
72
|
-
* The bounding box to receive data from.\
|
|
73
|
-
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
74
|
-
* \
|
|
75
|
-
* Where:
|
|
76
|
-
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
77
|
-
*
|
|
78
|
-
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
79
|
-
*
|
|
80
|
-
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
81
|
-
*
|
|
82
|
-
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
83
|
-
*
|
|
84
|
-
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
85
|
-
*
|
|
86
|
-
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
87
|
-
* Example: "mots=rail,subway".\
|
|
88
|
-
*
|
|
89
|
-
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
90
|
-
* Example: "gen_level=5"\
|
|
91
|
-
*
|
|
92
|
-
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
93
|
-
* Example: "tenant=sbb"\
|
|
94
|
-
*
|
|
95
|
-
* - ...: Any other values added to the bbox will be send to the server
|
|
96
|
-
*
|
|
97
|
-
* @type {string[]}
|
|
98
|
-
*
|
|
99
|
-
* @public
|
|
100
|
-
*/
|
|
101
|
-
get bbox(): RealtimeBbox | undefined;
|
|
102
|
-
set bbox(newBbox: RealtimeBbox | undefined);
|
|
103
64
|
_buffer?: number[];
|
|
104
|
-
|
|
105
|
-
set buffer(newBuffer: number[] | undefined);
|
|
106
|
-
version: RealtimeVersion;
|
|
107
|
-
wsApi: WebSocketAPI;
|
|
65
|
+
_url: string;
|
|
108
66
|
private pingInterval;
|
|
109
67
|
private pingIntervalMs;
|
|
110
68
|
private reconnectTimeout?;
|
|
111
69
|
private reconnectTimeoutMs?;
|
|
70
|
+
version: RealtimeVersion;
|
|
71
|
+
wsApi: WebSocketAPI;
|
|
112
72
|
/**
|
|
113
73
|
* Constructor
|
|
114
74
|
*
|
|
@@ -120,27 +80,63 @@ declare class RealtimeAPI {
|
|
|
120
80
|
*/
|
|
121
81
|
constructor(options?: RealtimeAPIOptions);
|
|
122
82
|
/**
|
|
123
|
-
*
|
|
83
|
+
* Close the websocket connection without reconnection.
|
|
124
84
|
*
|
|
125
85
|
* @public
|
|
126
86
|
*/
|
|
127
|
-
|
|
87
|
+
close(): void;
|
|
128
88
|
/**
|
|
129
|
-
*
|
|
89
|
+
* Send GET to a channel.
|
|
130
90
|
*
|
|
91
|
+
* @param {string | WebSocketAPIParameters} channelOrParams Name of the websocket channel to send GET or an object representing parameters to send
|
|
92
|
+
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
131
93
|
* @public
|
|
132
94
|
*/
|
|
133
|
-
|
|
95
|
+
get(channelOrParams: string | WebSocketAPIParameters): Promise<WebSocketAPIMessageEventData<any>>;
|
|
134
96
|
/**
|
|
135
|
-
*
|
|
97
|
+
* Get a full trajectory of a vehicule .
|
|
98
|
+
*
|
|
99
|
+
* @param {string} id A vehicle id.
|
|
100
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
101
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
102
|
+
* @return {Promise<{data: { content: RealtimeFullTrajectory }}>} Return a full trajectory.
|
|
103
|
+
* @public
|
|
136
104
|
*/
|
|
137
|
-
|
|
105
|
+
getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<WebSocketAPIMessageEventData<RealtimeFullTrajectory>>;
|
|
138
106
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @
|
|
107
|
+
* Return a station with a given uic number and a mode.
|
|
108
|
+
*
|
|
109
|
+
* @param {number} uic UIC of the station.
|
|
110
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
111
|
+
* @return {Promise<{data: { content: RealtimeStation }}>} A station.
|
|
112
|
+
* @public
|
|
142
113
|
*/
|
|
143
|
-
|
|
114
|
+
getStation(uic: RealtimeStationId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeStation>>;
|
|
115
|
+
/**
|
|
116
|
+
* Get the list of ststions available for a specifc mode. The promise is resolved every 100ms
|
|
117
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
118
|
+
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
119
|
+
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
getStations(mode: RealtimeMode, timeout?: number): Promise<RealtimeStation[]>;
|
|
123
|
+
/**
|
|
124
|
+
* Get the list of stops for this vehicle.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} id A vehicle id.
|
|
127
|
+
* @return {Promise<{data: { content: RealtimeStopSequence[] }}>} Returns a stop sequence object.
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
getStopSequence(id: RealtimeTrainId): Promise<WebSocketAPIMessageEventData<RealtimeStopSequence[]>>;
|
|
131
|
+
/**
|
|
132
|
+
* Return a partial trajectory with a given id and a mode.
|
|
133
|
+
*
|
|
134
|
+
* @param {number} id The identifier of a trajectory.
|
|
135
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
136
|
+
* @return {Promise<{data: { content: RealtimeTrajectory }}>} A trajectory.
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
getTrajectory(id: RealtimeTrainId, mode: RealtimeMode): Promise<WebSocketAPIMessageEventData<RealtimeTrajectory>>;
|
|
144
140
|
/**
|
|
145
141
|
* Callback when the websocket is closed by the server.
|
|
146
142
|
* It auto reconnects after a timeout.
|
|
@@ -148,12 +144,21 @@ declare class RealtimeAPI {
|
|
|
148
144
|
*/
|
|
149
145
|
onClose(): void;
|
|
150
146
|
/**
|
|
151
|
-
*
|
|
147
|
+
* Callback when the websocket is opened and ready.
|
|
148
|
+
* It applies the bbox and the projection.
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
onOpen(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Open the websocket connection.
|
|
152
154
|
*
|
|
153
|
-
* @
|
|
154
|
-
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
155
|
+
* @public
|
|
155
156
|
*/
|
|
156
|
-
|
|
157
|
+
open(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
160
|
+
*/
|
|
161
|
+
reset(): void;
|
|
157
162
|
/**
|
|
158
163
|
* Subscribe to a channel.
|
|
159
164
|
*
|
|
@@ -161,18 +166,19 @@ declare class RealtimeAPI {
|
|
|
161
166
|
* @param {function} onSuccess Callback when the subscription succeeds.
|
|
162
167
|
* @param {function} onError Callback when the subscription fails.
|
|
163
168
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
164
|
-
* @
|
|
169
|
+
* @public
|
|
165
170
|
*/
|
|
166
171
|
subscribe(channel: string, onSuccess: WebSocketAPIMessageCallback<any>, onError?: EventListener, quiet?: boolean): void;
|
|
167
172
|
/**
|
|
168
|
-
*
|
|
173
|
+
* Subscribe to deleted_vhicles channel.
|
|
169
174
|
*
|
|
170
|
-
* @param {
|
|
171
|
-
* @param {
|
|
172
|
-
* @param {function}
|
|
173
|
-
* @
|
|
175
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
176
|
+
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
177
|
+
* @param {function} onError Callback when the subscription fails.
|
|
178
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
179
|
+
* @public
|
|
174
180
|
*/
|
|
175
|
-
|
|
181
|
+
subscribeDeletedVehicles(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>, onError?: EventListener, quiet?: boolean): void;
|
|
176
182
|
/**
|
|
177
183
|
* Subscribe to departures channel of a given station.
|
|
178
184
|
*
|
|
@@ -180,16 +186,9 @@ declare class RealtimeAPI {
|
|
|
180
186
|
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
181
187
|
* @param {function} onError Callback when the subscription fails.
|
|
182
188
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
183
|
-
* @
|
|
189
|
+
* @deprecated Use subscribeTimetable instead.
|
|
184
190
|
*/
|
|
185
191
|
subscribeDepartures(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
186
|
-
/**
|
|
187
|
-
* Unsubscribe from current departures channel.
|
|
188
|
-
* @param {number} stationId UIC of the station.
|
|
189
|
-
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
190
|
-
* @public
|
|
191
|
-
*/
|
|
192
|
-
unsubscribeDepartures(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
193
192
|
/**
|
|
194
193
|
* Subscribe to the disruptions channel for tenant.
|
|
195
194
|
*
|
|
@@ -197,33 +196,45 @@ declare class RealtimeAPI {
|
|
|
197
196
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
198
197
|
* @param {function} onError Callback when the subscription fails.
|
|
199
198
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
200
|
-
* @
|
|
199
|
+
* @deprecated Use subscribeNewsticker instead.
|
|
201
200
|
*/
|
|
202
201
|
subscribeDisruptions(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
203
202
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* @param {
|
|
207
|
-
* @
|
|
203
|
+
* Subscribe to extra_geoms channel.
|
|
204
|
+
*
|
|
205
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Function called on each message of the channel.
|
|
206
|
+
* @param {function} onError Callback when the subscription fails.
|
|
207
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
208
208
|
*/
|
|
209
|
-
|
|
209
|
+
subscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>, onError?: EventListener, quiet?: boolean): void;
|
|
210
210
|
/**
|
|
211
|
-
*
|
|
211
|
+
* Subscribe to full_trajectory channel of a given vehicle.
|
|
212
212
|
*
|
|
213
|
-
* @param {
|
|
213
|
+
* @param {string} id A vehicle id.
|
|
214
214
|
* @param {RealtimeMode} mode Realtime mode.
|
|
215
|
-
* @
|
|
215
|
+
* @param {function(data:{content: RealtimeFullTrajectory})} onMessage Function called on each message of the channel.
|
|
216
|
+
* @param {function} onError Callback when the subscription fails.
|
|
217
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
216
218
|
* @public
|
|
217
219
|
*/
|
|
218
|
-
|
|
220
|
+
subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeFullTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
219
221
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param {
|
|
222
|
-
* @param {
|
|
223
|
-
* @
|
|
222
|
+
* Subscribe to healthcheck channel.
|
|
223
|
+
* @param {function(data: { content: string })} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
224
|
+
* @param {function} onError Callback when the subscription fails.
|
|
225
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
226
|
+
*/
|
|
227
|
+
subscribeHealthCheck(onMessage: WebSocketAPIMessageCallback<string>, onError?: EventListener, quiet?: boolean): void;
|
|
228
|
+
/**
|
|
229
|
+
* Subscribe to the newsticker channel for tenant.
|
|
230
|
+
*
|
|
231
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
232
|
+
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
233
|
+
* @param {function} onError Callback when the subscription fails.
|
|
234
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
224
235
|
* @public
|
|
225
236
|
*/
|
|
226
|
-
|
|
237
|
+
subscribeNewsticker(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
227
238
|
/**
|
|
228
239
|
* Subscribe to stations channel.
|
|
229
240
|
* One message pro station.
|
|
@@ -236,33 +247,25 @@ declare class RealtimeAPI {
|
|
|
236
247
|
*/
|
|
237
248
|
subscribeStations(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeStation>, onError?: EventListener, quiet?: boolean): void;
|
|
238
249
|
/**
|
|
239
|
-
*
|
|
240
|
-
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
241
|
-
* @public
|
|
242
|
-
*/
|
|
243
|
-
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
244
|
-
/**
|
|
245
|
-
* Subscribe to extra_geoms channel.
|
|
250
|
+
* Subscribe to stopsequence channel of a given vehicle.
|
|
246
251
|
*
|
|
247
|
-
* @param {
|
|
252
|
+
* @param {string} id A vehicle id.
|
|
253
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
|
|
248
254
|
* @param {function} onError Callback when the subscription fails.
|
|
249
255
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
256
|
+
* @public
|
|
250
257
|
*/
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Unsubscribe to extra_geoms channel.
|
|
254
|
-
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
255
|
-
*/
|
|
256
|
-
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
258
|
+
subscribeStopSequence(id: RealtimeTrainId, onMessage: WebSocketAPIMessageCallback<RealtimeStopSequence[]>, onError?: EventListener, quiet?: boolean): void;
|
|
257
259
|
/**
|
|
258
|
-
*
|
|
260
|
+
* Subscribe to timetable channel of a given station.
|
|
259
261
|
*
|
|
260
|
-
* @param {number}
|
|
261
|
-
* @param {
|
|
262
|
-
* @
|
|
262
|
+
* @param {number} stationId UIC of the station.
|
|
263
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
264
|
+
* @param {function} onError Callback when the subscription fails.
|
|
265
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
263
266
|
* @public
|
|
264
267
|
*/
|
|
265
|
-
|
|
268
|
+
subscribeTimetable(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
266
269
|
/**
|
|
267
270
|
* Subscribe to trajectory channel.
|
|
268
271
|
*
|
|
@@ -274,53 +277,39 @@ declare class RealtimeAPI {
|
|
|
274
277
|
*/
|
|
275
278
|
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
276
279
|
/**
|
|
277
|
-
* Unsubscribe
|
|
278
|
-
* @param {function(data: { content: RealtimeTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
279
|
-
* @public
|
|
280
|
-
*/
|
|
281
|
-
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>): void;
|
|
282
|
-
/**
|
|
283
|
-
* Subscribe to deleted_vhicles channel.
|
|
280
|
+
* Unsubscribe both modes of a channel.
|
|
284
281
|
*
|
|
285
|
-
* @param {
|
|
286
|
-
* @param {
|
|
287
|
-
* @param {function}
|
|
288
|
-
* @
|
|
282
|
+
* @param {string} channel Name of the websocket channel to unsubscribe.
|
|
283
|
+
* @param {string} suffix Suffix to add to the channel name.
|
|
284
|
+
* @param {function} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
285
|
+
* @public
|
|
289
286
|
*/
|
|
290
|
-
|
|
287
|
+
unsubscribe(channel: string, suffix?: string, onMessage?: WebSocketAPIMessageCallback<any>): void;
|
|
291
288
|
/**
|
|
292
289
|
* Unsubscribe to deleted_vhicles channels.
|
|
293
290
|
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
291
|
+
* @public
|
|
294
292
|
*/
|
|
295
293
|
unsubscribeDeletedVehicles(onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>): void;
|
|
296
294
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* @param {
|
|
300
|
-
* @
|
|
301
|
-
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
302
|
-
* @return {Promise<{data: { content: RealtimeFullTrajectory }}>} Return a full trajectory.
|
|
303
|
-
* @public
|
|
295
|
+
* Unsubscribe from current departures channel.
|
|
296
|
+
* @param {number} stationId UIC of the station.
|
|
297
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
298
|
+
* @deprecated Use unsubscribeTimetabe instead.
|
|
304
299
|
*/
|
|
305
|
-
|
|
300
|
+
unsubscribeDepartures(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
306
301
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* @param {
|
|
310
|
-
* @
|
|
311
|
-
* @param {function(data:{content: RealtimeFullTrajectory})} onMessage Function called on each message of the channel.
|
|
312
|
-
* @param {function} onError Callback when the subscription fails.
|
|
313
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
314
|
-
* @public
|
|
302
|
+
* Unsubscribe disruptions.
|
|
303
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
304
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
305
|
+
* @deprecated Use unsubscribeNewsticker instead.
|
|
315
306
|
*/
|
|
316
|
-
|
|
307
|
+
unsubscribeDisruptions(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
317
308
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* @callback onFullTrajectoryMessageCallback
|
|
321
|
-
* @param {number} responseCode
|
|
322
|
-
* @param {string} responseMessage
|
|
309
|
+
* Unsubscribe to extra_geoms channel.
|
|
310
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
323
311
|
*/
|
|
312
|
+
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
324
313
|
/**
|
|
325
314
|
* Unsubscribe from full_trajectory channel
|
|
326
315
|
*
|
|
@@ -330,23 +319,23 @@ declare class RealtimeAPI {
|
|
|
330
319
|
*/
|
|
331
320
|
unsubscribeFullTrajectory(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeFullTrajectory>): void;
|
|
332
321
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
|
|
336
|
-
|
|
322
|
+
* Unsubscribe to healthcheck channel.
|
|
323
|
+
* @param {function(data: { content: string })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
324
|
+
*/
|
|
325
|
+
unsubscribeHealthCheck(onMessage?: WebSocketAPIMessageCallback<string>): void;
|
|
326
|
+
/**
|
|
327
|
+
* Unsubscribe disruptions.
|
|
328
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
329
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
337
330
|
* @public
|
|
338
331
|
*/
|
|
339
|
-
|
|
332
|
+
unsubscribeNewsticker(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
340
333
|
/**
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
* @param {string} id A vehicle id.
|
|
344
|
-
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
|
|
345
|
-
* @param {function} onError Callback when the subscription fails.
|
|
346
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
334
|
+
* Unsubscribe to stations channel.
|
|
335
|
+
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
347
336
|
* @public
|
|
348
337
|
*/
|
|
349
|
-
|
|
338
|
+
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
350
339
|
/**
|
|
351
340
|
* Unsubscribe from stopsequence channel
|
|
352
341
|
*
|
|
@@ -356,16 +345,60 @@ declare class RealtimeAPI {
|
|
|
356
345
|
*/
|
|
357
346
|
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeStopSequence[]>): void;
|
|
358
347
|
/**
|
|
359
|
-
*
|
|
360
|
-
* @param {
|
|
361
|
-
* @param {function}
|
|
362
|
-
* @
|
|
348
|
+
* Unsubscribe from current departures channel.
|
|
349
|
+
* @param {number} stationId UIC of the station.
|
|
350
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
351
|
+
* @public
|
|
363
352
|
*/
|
|
364
|
-
|
|
353
|
+
unsubscribeTimetabe(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
365
354
|
/**
|
|
366
|
-
* Unsubscribe to
|
|
367
|
-
* @param {function(data: { content:
|
|
355
|
+
* Unsubscribe to trajectory channels.
|
|
356
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
357
|
+
* @public
|
|
368
358
|
*/
|
|
369
|
-
|
|
359
|
+
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>): void;
|
|
360
|
+
/**
|
|
361
|
+
* This callback type is called `requestCallback` and is displayed as a global symbol.
|
|
362
|
+
*
|
|
363
|
+
* @callback onFullTrajectoryMessageCallback
|
|
364
|
+
* @param {number} responseCode
|
|
365
|
+
* @param {string} responseMessage
|
|
366
|
+
*/
|
|
367
|
+
/**
|
|
368
|
+
* The bounding box to receive data from.\
|
|
369
|
+
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
370
|
+
* \
|
|
371
|
+
* Where:
|
|
372
|
+
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
373
|
+
*
|
|
374
|
+
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
375
|
+
*
|
|
376
|
+
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
377
|
+
*
|
|
378
|
+
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
379
|
+
*
|
|
380
|
+
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
381
|
+
*
|
|
382
|
+
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
383
|
+
* Example: "mots=rail,subway".\
|
|
384
|
+
*
|
|
385
|
+
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
386
|
+
* Example: "gen_level=5"\
|
|
387
|
+
*
|
|
388
|
+
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
389
|
+
* Example: "tenant=sbb"\
|
|
390
|
+
*
|
|
391
|
+
* - ...: Any other values added to the bbox will be send to the server
|
|
392
|
+
*
|
|
393
|
+
* @type {string[]}
|
|
394
|
+
*
|
|
395
|
+
* @public
|
|
396
|
+
*/
|
|
397
|
+
get bbox(): RealtimeBbox | undefined;
|
|
398
|
+
set bbox(newBbox: RealtimeBbox | undefined);
|
|
399
|
+
get buffer(): number[] | undefined;
|
|
400
|
+
set buffer(newBuffer: number[] | undefined);
|
|
401
|
+
get url(): string;
|
|
402
|
+
set url(newUrl: string);
|
|
370
403
|
}
|
|
371
404
|
export default RealtimeAPI;
|