mobility-toolbox-js 3.0.0-beta.3 → 3.0.0-beta.32

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.
Files changed (125) hide show
  1. package/api/HttpAPI.d.ts +20 -0
  2. package/api/HttpAPI.js +0 -11
  3. package/api/RealtimeAPI.d.ts +404 -0
  4. package/api/RealtimeAPI.js +342 -276
  5. package/api/RoutingAPI.d.ts +47 -0
  6. package/api/RoutingAPI.js +17 -7
  7. package/api/StopsAPI.d.ts +44 -0
  8. package/api/StopsAPI.js +17 -11
  9. package/api/WebSocketAPI.d.ts +147 -0
  10. package/api/WebSocketAPI.js +164 -164
  11. package/api/index.d.ts +3 -0
  12. package/api/index.js +1 -1
  13. package/api/typedefs.d.ts +76 -0
  14. package/api/typedefs.js +27 -42
  15. package/common/controls/StopFinderControlCommon.d.ts +53 -0
  16. package/common/controls/StopFinderControlCommon.js +31 -31
  17. package/common/index.d.ts +2 -0
  18. package/common/index.js +1 -1
  19. package/common/mixins/RealtimeLayerMixin.d.ts +267 -0
  20. package/common/mixins/RealtimeLayerMixin.js +401 -393
  21. package/common/styles/index.d.ts +4 -0
  22. package/common/styles/realtimeDefaultStyle.d.ts +36 -0
  23. package/common/styles/realtimeDefaultStyle.js +6 -6
  24. package/common/styles/realtimeDelayStyle.d.ts +12 -0
  25. package/common/styles/realtimeHeadingStyle.d.ts +12 -0
  26. package/common/styles/realtimeHeadingStyle.js +5 -5
  27. package/common/styles/realtimeSimpleStyle.d.ts +4 -0
  28. package/common/typedefs.d.ts +219 -0
  29. package/common/typedefs.js +7 -1
  30. package/common/utils/compareDepartures.d.ts +10 -0
  31. package/common/utils/compareDepartures.js +2 -2
  32. package/common/utils/constants.d.ts +5 -0
  33. package/common/utils/createCanvas.d.ts +10 -0
  34. package/common/utils/createDefaultCopyrightElt.d.ts +5 -0
  35. package/common/utils/createDefaultStopFinderElt.d.ts +5 -0
  36. package/common/utils/createRealtimeFilters.d.ts +12 -0
  37. package/common/utils/debounceDeparturesMessages.d.ts +12 -0
  38. package/common/utils/debounceWebsocketMessages.d.ts +11 -0
  39. package/common/utils/getLayersAsFlatArray.d.ts +3 -0
  40. package/common/utils/getLayersAsFlatArray.js +5 -1
  41. package/common/utils/getMapGlCopyrights.d.ts +17 -0
  42. package/common/utils/getMapGlCopyrights.js +3 -3
  43. package/common/utils/getRealtimeModeSuffix.d.ts +10 -0
  44. package/common/utils/getRealtimeModeSuffix.js +1 -0
  45. package/common/utils/getUrlWithParams.d.ts +8 -0
  46. package/common/utils/getVehiclePosition.d.ts +17 -0
  47. package/common/utils/getVehiclePosition.js +9 -3
  48. package/common/utils/index.d.ts +16 -0
  49. package/common/utils/realtimeConfig.d.ts +64 -0
  50. package/common/utils/removeDuplicate.d.ts +9 -0
  51. package/common/utils/renderTrajectories.d.ts +16 -0
  52. package/common/utils/renderTrajectories.js +6 -6
  53. package/common/utils/sortAndFilterDepartures.d.ts +15 -0
  54. package/common/utils/sortAndFilterDepartures.js +1 -1
  55. package/common/utils/sortByDelay.d.ts +3 -0
  56. package/common/utils/sortByDelay.js +5 -1
  57. package/common/utils/timeUtils.d.ts +23 -0
  58. package/common/utils/toMercatorExtent.d.ts +5 -0
  59. package/iife.d.ts +2 -0
  60. package/index.d.ts +9 -0
  61. package/maplibre/controls/CopyrightControl.d.ts +35 -0
  62. package/maplibre/controls/index.d.ts +1 -0
  63. package/maplibre/index.d.ts +5 -0
  64. package/maplibre/layers/Layer.d.ts +28 -0
  65. package/maplibre/layers/Layer.js +1 -1
  66. package/maplibre/layers/RealtimeLayer.d.ts +181 -0
  67. package/maplibre/layers/RealtimeLayer.js +29 -5
  68. package/maplibre/layers/index.d.ts +2 -0
  69. package/maplibre/utils/getMercatorResolution.d.ts +7 -0
  70. package/maplibre/utils/getSourceCoordinates.d.ts +7 -0
  71. package/maplibre/utils/getSourceCoordinates.js +5 -5
  72. package/maplibre/utils/index.d.ts +2 -0
  73. package/mbt.js +39819 -32088
  74. package/mbt.js.map +4 -4
  75. package/mbt.min.js +61 -58
  76. package/mbt.min.js.map +4 -4
  77. package/ol/controls/CopyrightControl.d.ts +31 -0
  78. package/ol/controls/CopyrightControl.js +18 -8
  79. package/ol/controls/RoutingControl.d.ts +202 -0
  80. package/ol/controls/RoutingControl.js +220 -219
  81. package/ol/controls/StopFinderControl.d.ts +37 -0
  82. package/ol/controls/StopFinderControl.js +5 -2
  83. package/ol/controls/index.d.ts +3 -0
  84. package/ol/index.d.ts +7 -0
  85. package/ol/index.js +1 -0
  86. package/ol/layers/Layer.d.ts +103 -0
  87. package/ol/layers/Layer.js +38 -0
  88. package/ol/layers/MaplibreLayer.d.ts +167 -0
  89. package/ol/layers/MaplibreLayer.js +115 -27
  90. package/ol/layers/MaplibreStyleLayer.d.ts +237 -0
  91. package/ol/layers/MaplibreStyleLayer.js +315 -265
  92. package/ol/layers/RealtimeLayer.d.ts +283 -0
  93. package/ol/layers/RealtimeLayer.js +143 -128
  94. package/ol/layers/VectorLayer.d.ts +18 -0
  95. package/ol/layers/VectorLayer.js +32 -0
  96. package/ol/layers/index.d.ts +5 -0
  97. package/ol/layers/index.js +3 -0
  98. package/ol/mixins/MobilityLayerMixin.d.ts +96 -0
  99. package/ol/mixins/MobilityLayerMixin.js +1 -4
  100. package/ol/mixins/PropertiesLayerMixin.d.ts +136 -0
  101. package/ol/mixins/PropertiesLayerMixin.js +122 -140
  102. package/ol/mixins/index.d.ts +1 -0
  103. package/ol/mixins/index.js +2 -0
  104. package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -0
  105. package/ol/renderers/MaplibreLayerRenderer.js +142 -114
  106. package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +20 -0
  107. package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
  108. package/ol/renderers/RealtimeLayerRenderer.d.ts +22 -0
  109. package/ol/renderers/RealtimeLayerRenderer.js +58 -53
  110. package/ol/styles/fullTrajectoryDelayStyle.d.ts +6 -0
  111. package/ol/styles/fullTrajectoryStyle.d.ts +5 -0
  112. package/ol/styles/index.d.ts +3 -0
  113. package/ol/styles/routingStyle.d.ts +4 -0
  114. package/ol/utils/getFeatureInfoAtCoordinate.d.ts +8 -0
  115. package/ol/utils/getFeatureInfoAtCoordinate.js +12 -18
  116. package/ol/utils/index.d.ts +1 -0
  117. package/package.json +31 -31
  118. package/setupTests.d.ts +1 -0
  119. package/setupTests.js +3 -4
  120. package/types/common.d.ts +55 -48
  121. package/types/index.d.ts +1 -1
  122. package/types/realtime.d.ts +91 -93
  123. package/types/routing.d.ts +60 -60
  124. package/types/stops.d.ts +62 -62
  125. package/ol/layers/MapGlLayer.js +0 -142
@@ -0,0 +1,20 @@
1
+ export interface HttpAPIOptions {
2
+ apiKey?: string;
3
+ url: string;
4
+ }
5
+ /**
6
+ * Common class to access to a geOps api using http.
7
+ * @private
8
+ */
9
+ declare class HttpAPI {
10
+ apiKey?: string;
11
+ url: string;
12
+ constructor(options: HttpAPIOptions);
13
+ /**
14
+ * Append the apiKey before sending the request.
15
+ *
16
+ * @private
17
+ */
18
+ fetch(path: string, params: object, config: RequestInit): Promise<any>;
19
+ }
20
+ export default HttpAPI;
package/api/HttpAPI.js CHANGED
@@ -10,17 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import getUrlWithParams from '../common/utils/getUrlWithParams';
11
11
  /**
12
12
  * Common class to access to a geOps api using http.
13
- *
14
- * @example
15
- * import { API } from 'mobility-toolbox-js/api';
16
- *
17
- * const api = new HttpApi({
18
- * url: [yourUrl],
19
- * apiKey: [yourApiKey]
20
- * });
21
- *
22
- * @classproperty {string} url Url of the service.
23
- * @classproperty {string} apiKey Api key to access the service.
24
13
  * @private
25
14
  */
26
15
  class HttpAPI {
@@ -0,0 +1,404 @@
1
+ import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData, WebSocketAPIParameters } from './WebSocketAPI';
2
+ import type { RealtimeBbox, RealtimeDeparture, RealtimeExtraGeom, RealtimeFullTrajectory, RealtimeGeneralizationLevel, RealtimeMode, RealtimeNews, RealtimeStation, RealtimeStationId, RealtimeStopSequence, RealtimeTenant, RealtimeTrainId, RealtimeTrajectory, RealtimeVersion } from '../types';
3
+ /**
4
+ * @typedef RealtimeAPIOptions
5
+ */
6
+ export interface RealtimeAPIOptions {
7
+ apiKey?: string;
8
+ bbox?: RealtimeBbox;
9
+ buffer?: number[];
10
+ pingIntervalMs?: number;
11
+ reconnectTimeoutMs?: number;
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 {
18
+ RAW: RealtimeMode;
19
+ SCHEMATIC: RealtimeMode;
20
+ TOPOGRAPHIC: RealtimeMode;
21
+ }
22
+ /**
23
+ * Enum for Realtime modes.
24
+ * @readonly
25
+ * @typedef {string} RealtimeMode
26
+ * @property {string} RAW "raw"
27
+ * @property {string} SCHEMATIC "schematic"
28
+ * @property {string} TOPOGRAPHIC "topographic"
29
+ * @enum {RealtimeMode}
30
+ * @public
31
+ */
32
+ export declare const RealtimeModes: {
33
+ RAW: RealtimeMode;
34
+ SCHEMATIC: RealtimeMode;
35
+ TOPOGRAPHIC: RealtimeMode;
36
+ };
37
+ /**
38
+ * This class provides convenience methods to use to the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
39
+ *
40
+ * @example
41
+ * import { RealtimeAPI } from 'mobility-toolbox-js/api';
42
+ *
43
+ * const api = new RealtimeAPI({
44
+ * apiKey: "yourApiKey",
45
+ * bbox: [782001, 5888803, 923410, 5923660, 11, "mots=rail"],
46
+ * // url: "wss://api.geops.io/tracker-ws/v1/",
47
+ * });
48
+ *
49
+ * // Open the websocket connection
50
+ * api.open();
51
+ *
52
+ * // Subscribe to channel
53
+ * api.subscribeTrajectory('topographic', (data) => {
54
+ * console.log('Log trajectories:', JSON.stringify(data.content));
55
+ * });
56
+ *
57
+ * // Close the websocket connection
58
+ * // api.close();
59
+ *
60
+ * @public
61
+ */
62
+ declare class RealtimeAPI {
63
+ _bbox?: RealtimeBbox;
64
+ _buffer?: number[];
65
+ _url: string;
66
+ private pingInterval;
67
+ private pingIntervalMs;
68
+ private reconnectTimeout?;
69
+ private reconnectTimeoutMs?;
70
+ version: RealtimeVersion;
71
+ wsApi: WebSocketAPI;
72
+ /**
73
+ * Constructor
74
+ *
75
+ * @param {Object} options Options.
76
+ * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
77
+ * @param {string[]} options.bbox The bounding box to receive data from.
78
+ * @param {string} [options.url='wss://api.geops.io/tracker-ws/v1/'] Url of the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
79
+ * @public
80
+ */
81
+ constructor(options?: RealtimeAPIOptions);
82
+ /**
83
+ * Close the websocket connection without reconnection.
84
+ *
85
+ * @public
86
+ */
87
+ close(): void;
88
+ /**
89
+ * Send GET to a channel.
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.
93
+ * @public
94
+ */
95
+ get(channelOrParams: string | WebSocketAPIParameters): Promise<WebSocketAPIMessageEventData<any>>;
96
+ /**
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
104
+ */
105
+ getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<WebSocketAPIMessageEventData<RealtimeFullTrajectory>>;
106
+ /**
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
113
+ */
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>>;
140
+ /**
141
+ * Callback when the websocket is closed by the server.
142
+ * It auto reconnects after a timeout.
143
+ * @private
144
+ */
145
+ onClose(): void;
146
+ /**
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.
154
+ *
155
+ * @public
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;
162
+ /**
163
+ * Subscribe to a channel.
164
+ *
165
+ * @param {string} channel Name of the websocket channel to subscribe.
166
+ * @param {function} onSuccess Callback when the subscription succeeds.
167
+ * @param {function} onError Callback when the subscription fails.
168
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
169
+ * @public
170
+ */
171
+ subscribe(channel: string, onSuccess: WebSocketAPIMessageCallback<any>, onError?: EventListener, quiet?: boolean): void;
172
+ /**
173
+ * Subscribe to deleted_vhicles channel.
174
+ *
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
180
+ */
181
+ subscribeDeletedVehicles(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>, onError?: EventListener, quiet?: boolean): void;
182
+ /**
183
+ * Subscribe to departures channel of a given station.
184
+ *
185
+ * @param {number} stationId UIC of the station.
186
+ * @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
187
+ * @param {function} onError Callback when the subscription fails.
188
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
189
+ * @deprecated Use subscribeTimetable instead.
190
+ */
191
+ subscribeDepartures(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
192
+ /**
193
+ * Subscribe to the disruptions channel for tenant.
194
+ *
195
+ * @param {RealtimeTenant} tenant Tenant's id
196
+ * @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
197
+ * @param {function} onError Callback when the subscription fails.
198
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
199
+ * @deprecated Use subscribeNewsticker instead.
200
+ */
201
+ subscribeDisruptions(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
202
+ /**
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
+ */
209
+ subscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>, onError?: EventListener, quiet?: boolean): void;
210
+ /**
211
+ * Subscribe to full_trajectory channel of a given vehicle.
212
+ *
213
+ * @param {string} id A vehicle id.
214
+ * @param {RealtimeMode} mode Realtime mode.
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.
218
+ * @public
219
+ */
220
+ subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeFullTrajectory>, onError?: EventListener, quiet?: boolean): void;
221
+ /**
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.
235
+ * @public
236
+ */
237
+ subscribeNewsticker(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
238
+ /**
239
+ * Subscribe to stations channel.
240
+ * One message pro station.
241
+ *
242
+ * @param {RealtimeMode} mode Realtime mode.
243
+ * @param {function(data: { content: RealtimeStation })} onMessage Function called on each message of the channel.
244
+ * @param {function} onError Callback when the subscription fails.
245
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
246
+ * @public
247
+ */
248
+ subscribeStations(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeStation>, onError?: EventListener, quiet?: boolean): void;
249
+ /**
250
+ * Subscribe to stopsequence channel of a given vehicle.
251
+ *
252
+ * @param {string} id A vehicle id.
253
+ * @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
254
+ * @param {function} onError Callback when the subscription fails.
255
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
256
+ * @public
257
+ */
258
+ subscribeStopSequence(id: RealtimeTrainId, onMessage: WebSocketAPIMessageCallback<RealtimeStopSequence[]>, onError?: EventListener, quiet?: boolean): void;
259
+ /**
260
+ * Subscribe to timetable channel of a given station.
261
+ *
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.
266
+ * @public
267
+ */
268
+ subscribeTimetable(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
269
+ /**
270
+ * Subscribe to trajectory channel.
271
+ *
272
+ * @param {RealtimeMode} mode Realtime mode.
273
+ * @param {function(data: { content: RealtimeTrajectory })} onMessage Function called on each message of the channel.
274
+ * @param {function} onError Callback when the subscription fails.
275
+ * @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
276
+ * @public
277
+ */
278
+ subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>, onError?: EventListener, quiet?: boolean): void;
279
+ /**
280
+ * Unsubscribe both modes of a channel.
281
+ *
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
286
+ */
287
+ unsubscribe(channel: string, suffix?: string, onMessage?: WebSocketAPIMessageCallback<any>): void;
288
+ /**
289
+ * Unsubscribe to deleted_vhicles channels.
290
+ * @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
291
+ * @public
292
+ */
293
+ unsubscribeDeletedVehicles(onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>): void;
294
+ /**
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 RealtimeAPI.unsubscribeTimetabe instead.
299
+ */
300
+ unsubscribeDepartures(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
301
+ /**
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.
306
+ */
307
+ unsubscribeDisruptions(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
308
+ /**
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.
311
+ */
312
+ unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
313
+ /**
314
+ * Unsubscribe from full_trajectory channel
315
+ *
316
+ * @param {string} id A vehicle id.
317
+ * @param {onFullTrajectoryMessageCallback} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
318
+ * @public
319
+ */
320
+ unsubscribeFullTrajectory(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeFullTrajectory>): void;
321
+ /**
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.
330
+ * @public
331
+ */
332
+ unsubscribeNewsticker(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
333
+ /**
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.
336
+ * @public
337
+ */
338
+ unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
339
+ /**
340
+ * Unsubscribe from stopsequence channel
341
+ *
342
+ * @param {string} id A vehicle id.
343
+ * @param {function(data: { content: RealtimeStopSequence[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
344
+ * @public
345
+ */
346
+ unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeStopSequence[]>): void;
347
+ /**
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
352
+ */
353
+ unsubscribeTimetabe(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
354
+ /**
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
358
+ */
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
+ * &nbsp;\
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
+ * &nbsp;
374
+ * - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
375
+ * &nbsp;
376
+ * - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
377
+ * &nbsp;
378
+ * - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
379
+ * &nbsp;
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
+ * &nbsp;
382
+ * - **mots**: A comma separated list of modes of transport. **Optional**.\
383
+ * Example: "mots=rail,subway".\
384
+ * &nbsp;
385
+ * - **gen_level**: An integer representing the generalization level. **Optional**.\
386
+ * Example: "gen_level=5"\
387
+ * &nbsp;
388
+ * - **tenant**: A string representing the tenant. **Optional**.\
389
+ * Example: "tenant=sbb"\
390
+ * &nbsp;
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);
403
+ }
404
+ export default RealtimeAPI;