mobility-toolbox-js 3.0.0-beta.9 → 3.0.1-beta.0
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 -16
- package/api/HttpAPI.js +0 -11
- package/api/RealtimeAPI.d.ts +221 -176
- package/api/RealtimeAPI.js +317 -258
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -164
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +12 -12
- package/common/controls/StopFinderControlCommon.js +31 -31
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +157 -163
- package/common/mixins/RealtimeLayerMixin.js +401 -393
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/typedefs.d.ts +13 -6
- package/common/typedefs.js +7 -1
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +9 -3
- package/common/utils/renderTrajectories.d.ts +1 -1
- package/common/utils/renderTrajectories.js +6 -6
- package/common/utils/sortAndFilterDepartures.d.ts +1 -1
- package/common/utils/sortAndFilterDepartures.js +1 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/layers/Layer.d.ts +1 -1
- package/maplibre/layers/Layer.js +1 -1
- package/maplibre/layers/RealtimeLayer.d.ts +87 -66
- package/maplibre/layers/RealtimeLayer.js +30 -6
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/mbt.js +20988 -13287
- package/mbt.js.map +4 -4
- package/mbt.min.js +61 -58
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +82 -89
- package/ol/controls/RoutingControl.js +217 -219
- package/ol/controls/StopFinderControl.d.ts +3 -3
- package/ol/controls/StopFinderControl.js +2 -2
- package/ol/index.d.ts +1 -0
- package/ol/index.js +1 -0
- package/ol/layers/Layer.d.ts +101 -0
- package/ol/layers/Layer.js +25 -0
- package/ol/layers/MaplibreLayer.d.ts +121 -24
- package/ol/layers/MaplibreLayer.js +98 -27
- package/ol/layers/MaplibreStyleLayer.d.ts +93 -91
- package/ol/layers/MaplibreStyleLayer.js +281 -257
- package/ol/layers/RealtimeLayer.d.ts +119 -121
- package/ol/layers/RealtimeLayer.js +143 -134
- package/ol/layers/VectorLayer.d.ts +18 -0
- package/ol/layers/VectorLayer.js +32 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/mixins/MobilityLayerMixin.d.ts +32 -34
- package/ol/mixins/PropertiesLayerMixin.d.ts +60 -51
- package/ol/mixins/PropertiesLayerMixin.js +114 -79
- package/ol/mixins/index.d.ts +1 -0
- package/ol/mixins/index.js +2 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +6 -6
- package/ol/renderers/RealtimeLayerRenderer.js +56 -51
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +31 -31
- package/setupTests.js +3 -4
- package/types/common.d.ts +55 -48
- 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/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
package/api/HttpAPI.d.ts
CHANGED
|
@@ -1,31 +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
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* import { API } from 'mobility-toolbox-js/api';
|
|
10
|
-
*
|
|
11
|
-
* const api = new HttpApi({
|
|
12
|
-
* url: [yourUrl],
|
|
13
|
-
* apiKey: [yourApiKey]
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* @classproperty {string} url Url of the service.
|
|
17
|
-
* @classproperty {string} apiKey Api key to access the service.
|
|
18
7
|
* @private
|
|
19
8
|
*/
|
|
20
9
|
declare class HttpAPI {
|
|
21
|
-
url: string;
|
|
22
10
|
apiKey?: string;
|
|
11
|
+
url: string;
|
|
23
12
|
constructor(options: HttpAPIOptions);
|
|
24
13
|
/**
|
|
25
14
|
* Append the apiKey before sending the request.
|
|
26
15
|
*
|
|
27
16
|
* @private
|
|
28
17
|
*/
|
|
29
|
-
fetch(path: string, params:
|
|
18
|
+
fetch(path: string, params: object, config: RequestInit): Promise<any>;
|
|
30
19
|
}
|
|
31
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 {
|
package/api/RealtimeAPI.d.ts
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import WebSocketAPI, { WebSocketAPIMessageCallback, WebSocketAPIMessageEventData, WebSocketAPIParameters } from './WebSocketAPI';
|
|
2
|
-
import type {
|
|
3
|
-
import { StopSequence } from './typedefs';
|
|
2
|
+
import type { RealtimeBbox, RealtimeDeparture, RealtimeExtraGeom, RealtimeFullTrajectory, RealtimeGeneralizationLevel, RealtimeMode, RealtimeNews, RealtimeStation, RealtimeStationId, RealtimeStopSequence, RealtimeTenant, RealtimeTrainId, RealtimeTrajectory, RealtimeVersion } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* @typedef RealtimeAPIOptions
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
8
|
-
url?: string;
|
|
6
|
+
export interface RealtimeAPIOptions {
|
|
9
7
|
apiKey?: string;
|
|
10
|
-
version?: RealtimeVersion;
|
|
11
8
|
bbox?: RealtimeBbox;
|
|
12
9
|
buffer?: number[];
|
|
13
10
|
pingIntervalMs?: number;
|
|
14
11
|
reconnectTimeoutMs?: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type RealtimeAPIDeparturesById =
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
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 {
|
|
23
18
|
RAW: RealtimeMode;
|
|
24
|
-
TOPOGRAPHIC: RealtimeMode;
|
|
25
19
|
SCHEMATIC: RealtimeMode;
|
|
26
|
-
|
|
20
|
+
TOPOGRAPHIC: RealtimeMode;
|
|
21
|
+
}
|
|
27
22
|
/**
|
|
28
23
|
* Enum for Realtime modes.
|
|
29
24
|
* @readonly
|
|
@@ -32,14 +27,15 @@ export type RealtimeModesType = {
|
|
|
32
27
|
* @property {string} SCHEMATIC "schematic"
|
|
33
28
|
* @property {string} TOPOGRAPHIC "topographic"
|
|
34
29
|
* @enum {RealtimeMode}
|
|
30
|
+
* @public
|
|
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
|
-
* This class provides convenience methods to use to the [geOps
|
|
38
|
+
* This class provides convenience methods to use to the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
43
39
|
*
|
|
44
40
|
* @example
|
|
45
41
|
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
@@ -50,92 +46,97 @@ export declare const RealtimeModes: {
|
|
|
50
46
|
* // url: "wss://api.geops.io/tracker-ws/v1/",
|
|
51
47
|
* });
|
|
52
48
|
*
|
|
49
|
+
* // Open the websocket connection
|
|
53
50
|
* api.open();
|
|
54
51
|
*
|
|
52
|
+
* // Subscribe to channel
|
|
55
53
|
* api.subscribeTrajectory('topographic', (data) => {
|
|
56
54
|
* console.log('Log trajectories:', JSON.stringify(data.content));
|
|
57
55
|
* });
|
|
58
56
|
*
|
|
57
|
+
* // Close the websocket connection
|
|
58
|
+
* // api.close();
|
|
59
|
+
*
|
|
59
60
|
* @public
|
|
60
61
|
*/
|
|
61
62
|
declare class RealtimeAPI {
|
|
62
|
-
_url: string;
|
|
63
|
-
get url(): string;
|
|
64
|
-
set url(newUrl: string);
|
|
65
63
|
_bbox?: RealtimeBbox;
|
|
66
|
-
/**
|
|
67
|
-
* The bounding box to receive data from.\
|
|
68
|
-
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
69
|
-
* \
|
|
70
|
-
* Where:
|
|
71
|
-
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
72
|
-
*
|
|
73
|
-
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
74
|
-
*
|
|
75
|
-
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
76
|
-
*
|
|
77
|
-
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
78
|
-
*
|
|
79
|
-
* - **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.\
|
|
80
|
-
*
|
|
81
|
-
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
82
|
-
* Example: "mots=rail,subway".\
|
|
83
|
-
*
|
|
84
|
-
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
85
|
-
* Example: "gen_level=5"\
|
|
86
|
-
*
|
|
87
|
-
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
88
|
-
* Example: "tenant=sbb"\
|
|
89
|
-
*
|
|
90
|
-
* - ...: Any other values added to the bbox will be send to the server
|
|
91
|
-
*
|
|
92
|
-
* @type {string[]}
|
|
93
|
-
*
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
get bbox(): RealtimeBbox | undefined;
|
|
97
|
-
set bbox(newBbox: RealtimeBbox | undefined);
|
|
98
64
|
_buffer?: number[];
|
|
99
|
-
|
|
100
|
-
set buffer(newBuffer: number[] | undefined);
|
|
101
|
-
version: RealtimeVersion;
|
|
102
|
-
wsApi: WebSocketAPI;
|
|
65
|
+
_url: string;
|
|
103
66
|
private pingInterval;
|
|
104
67
|
private pingIntervalMs;
|
|
105
68
|
private reconnectTimeout?;
|
|
106
69
|
private reconnectTimeoutMs?;
|
|
70
|
+
version: RealtimeVersion;
|
|
71
|
+
wsApi: WebSocketAPI;
|
|
107
72
|
/**
|
|
108
73
|
* Constructor
|
|
109
74
|
*
|
|
110
|
-
* @param {Object} options
|
|
111
|
-
* @param {string} options.url Url to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
75
|
+
* @param {Object} options Options.
|
|
112
76
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
113
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/).
|
|
114
79
|
* @public
|
|
115
80
|
*/
|
|
116
81
|
constructor(options?: RealtimeAPIOptions);
|
|
117
82
|
/**
|
|
118
|
-
*
|
|
83
|
+
* Close the websocket connection without reconnection.
|
|
119
84
|
*
|
|
120
85
|
* @public
|
|
121
86
|
*/
|
|
122
|
-
|
|
87
|
+
close(): void;
|
|
123
88
|
/**
|
|
124
|
-
*
|
|
89
|
+
* Send GET to a channel.
|
|
125
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.
|
|
126
93
|
* @public
|
|
127
94
|
*/
|
|
128
|
-
|
|
95
|
+
get(channelOrParams: string | WebSocketAPIParameters): Promise<WebSocketAPIMessageEventData<any>>;
|
|
129
96
|
/**
|
|
130
|
-
*
|
|
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
|
|
131
104
|
*/
|
|
132
|
-
|
|
105
|
+
getFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, generalizationLevel: RealtimeGeneralizationLevel | undefined): Promise<WebSocketAPIMessageEventData<RealtimeFullTrajectory>>;
|
|
133
106
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* @
|
|
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
|
|
137
113
|
*/
|
|
138
|
-
|
|
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>>;
|
|
139
140
|
/**
|
|
140
141
|
* Callback when the websocket is closed by the server.
|
|
141
142
|
* It auto reconnects after a timeout.
|
|
@@ -143,12 +144,21 @@ declare class RealtimeAPI {
|
|
|
143
144
|
*/
|
|
144
145
|
onClose(): void;
|
|
145
146
|
/**
|
|
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.
|
|
147
154
|
*
|
|
148
|
-
* @
|
|
149
|
-
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
155
|
+
* @public
|
|
150
156
|
*/
|
|
151
|
-
|
|
157
|
+
open(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
160
|
+
*/
|
|
161
|
+
reset(): void;
|
|
152
162
|
/**
|
|
153
163
|
* Subscribe to a channel.
|
|
154
164
|
*
|
|
@@ -156,69 +166,75 @@ declare class RealtimeAPI {
|
|
|
156
166
|
* @param {function} onSuccess Callback when the subscription succeeds.
|
|
157
167
|
* @param {function} onError Callback when the subscription fails.
|
|
158
168
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
159
|
-
* @
|
|
169
|
+
* @public
|
|
160
170
|
*/
|
|
161
171
|
subscribe(channel: string, onSuccess: WebSocketAPIMessageCallback<any>, onError?: EventListener, quiet?: boolean): void;
|
|
162
172
|
/**
|
|
163
|
-
*
|
|
173
|
+
* Subscribe to deleted_vhicles channel.
|
|
164
174
|
*
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {function}
|
|
168
|
-
* @
|
|
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
|
|
169
180
|
*/
|
|
170
|
-
|
|
181
|
+
subscribeDeletedVehicles(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>, onError?: EventListener, quiet?: boolean): void;
|
|
171
182
|
/**
|
|
172
183
|
* Subscribe to departures channel of a given station.
|
|
173
184
|
*
|
|
174
185
|
* @param {number} stationId UIC of the station.
|
|
175
|
-
* @param {
|
|
176
|
-
* @param {function(departures:Departure[])} onMessage Function called on each message of the channel.
|
|
186
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
177
187
|
* @param {function} onError Callback when the subscription fails.
|
|
178
188
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
179
|
-
* @
|
|
189
|
+
* @deprecated Use subscribeTimetable instead.
|
|
180
190
|
*/
|
|
181
191
|
subscribeDepartures(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
182
|
-
/**
|
|
183
|
-
* Unsubscribe from current departures channel.
|
|
184
|
-
* @param {RealtimeStationId} id Station's id
|
|
185
|
-
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
unsubscribeDepartures(id: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
189
192
|
/**
|
|
190
193
|
* Subscribe to the disruptions channel for tenant.
|
|
191
194
|
*
|
|
195
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
192
196
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
193
197
|
* @param {function} onError Callback when the subscription fails.
|
|
194
198
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
195
|
-
* @
|
|
199
|
+
* @deprecated Use subscribeNewsticker instead.
|
|
196
200
|
*/
|
|
197
201
|
subscribeDisruptions(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
198
202
|
/**
|
|
199
|
-
*
|
|
203
|
+
* Subscribe to extra_geoms channel.
|
|
200
204
|
*
|
|
201
|
-
* @param {function(data: { content:
|
|
202
|
-
* @
|
|
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.
|
|
203
208
|
*/
|
|
204
|
-
|
|
209
|
+
subscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>, onError?: EventListener, quiet?: boolean): void;
|
|
205
210
|
/**
|
|
206
|
-
*
|
|
211
|
+
* Subscribe to full_trajectory channel of a given vehicle.
|
|
207
212
|
*
|
|
208
|
-
* @param {
|
|
213
|
+
* @param {string} id A vehicle id.
|
|
209
214
|
* @param {RealtimeMode} mode Realtime mode.
|
|
210
|
-
* @
|
|
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.
|
|
211
218
|
* @public
|
|
212
219
|
*/
|
|
213
|
-
|
|
220
|
+
subscribeFullTrajectory(id: RealtimeTrainId, mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeFullTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
214
221
|
/**
|
|
215
|
-
*
|
|
216
|
-
* @param {
|
|
217
|
-
* @param {
|
|
218
|
-
* @
|
|
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.
|
|
219
235
|
* @public
|
|
220
236
|
*/
|
|
221
|
-
|
|
237
|
+
subscribeNewsticker(tenant: RealtimeTenant, onMessage: WebSocketAPIMessageCallback<RealtimeNews>, onError?: EventListener, quiet?: boolean): void;
|
|
222
238
|
/**
|
|
223
239
|
* Subscribe to stations channel.
|
|
224
240
|
* One message pro station.
|
|
@@ -231,129 +247,158 @@ declare class RealtimeAPI {
|
|
|
231
247
|
*/
|
|
232
248
|
subscribeStations(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeStation>, onError?: EventListener, quiet?: boolean): void;
|
|
233
249
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
239
|
-
/**
|
|
240
|
-
* Subscribe to extra_geoms channel.
|
|
250
|
+
* Subscribe to stopsequence channel of a given vehicle.
|
|
241
251
|
*
|
|
242
|
-
* @param {
|
|
252
|
+
* @param {string} id A vehicle id.
|
|
253
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
|
|
243
254
|
* @param {function} onError Callback when the subscription fails.
|
|
244
255
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
256
|
+
* @public
|
|
245
257
|
*/
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Unsubscribe to extra_geoms channel.
|
|
249
|
-
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
250
|
-
*/
|
|
251
|
-
unsubscribeExtraGeoms(onMessage: WebSocketAPIMessageCallback<RealtimeExtraGeom>): void;
|
|
258
|
+
subscribeStopSequence(id: RealtimeTrainId, onMessage: WebSocketAPIMessageCallback<RealtimeStopSequence[]>, onError?: EventListener, quiet?: boolean): void;
|
|
252
259
|
/**
|
|
253
|
-
*
|
|
260
|
+
* Subscribe to timetable channel of a given station.
|
|
254
261
|
*
|
|
255
|
-
* @param {number}
|
|
256
|
-
* @param {
|
|
257
|
-
* @
|
|
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.
|
|
258
266
|
* @public
|
|
259
267
|
*/
|
|
260
|
-
|
|
268
|
+
subscribeTimetable(stationId: number, onMessage: WebSocketAPIMessageCallback<RealtimeDeparture>, onError?: EventListener, quiet?: boolean): void;
|
|
261
269
|
/**
|
|
262
270
|
* Subscribe to trajectory channel.
|
|
263
271
|
*
|
|
264
272
|
* @param {RealtimeMode} mode Realtime mode.
|
|
265
|
-
* @param {function(data: { content:
|
|
273
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Function called on each message of the channel.
|
|
266
274
|
* @param {function} onError Callback when the subscription fails.
|
|
267
275
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
268
276
|
* @public
|
|
269
277
|
*/
|
|
270
|
-
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<
|
|
271
|
-
/**
|
|
272
|
-
* Unsubscribe to trajectory channels.
|
|
273
|
-
* @param {function(data: { content: RealtimeTrajectoryResponse[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
274
|
-
* @public
|
|
275
|
-
*/
|
|
276
|
-
unsubscribeTrajectory(onMessage: WebSocketAPIMessageCallback<RealtimeTrajectoryResponse[]>): void;
|
|
278
|
+
subscribeTrajectory(mode: RealtimeMode, onMessage: WebSocketAPIMessageCallback<RealtimeTrajectory>, onError?: EventListener, quiet?: boolean): void;
|
|
277
279
|
/**
|
|
278
|
-
*
|
|
280
|
+
* Unsubscribe both modes of a channel.
|
|
279
281
|
*
|
|
280
|
-
* @param {
|
|
281
|
-
* @param {
|
|
282
|
-
* @param {function}
|
|
283
|
-
* @
|
|
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
|
|
284
286
|
*/
|
|
285
|
-
|
|
287
|
+
unsubscribe(channel: string, suffix?: string, onMessage?: WebSocketAPIMessageCallback<any>): void;
|
|
286
288
|
/**
|
|
287
289
|
* Unsubscribe to deleted_vhicles channels.
|
|
288
290
|
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
291
|
+
* @public
|
|
289
292
|
*/
|
|
290
293
|
unsubscribeDeletedVehicles(onMessage: WebSocketAPIMessageCallback<RealtimeTrainId>): void;
|
|
291
294
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* @param {
|
|
295
|
-
* @
|
|
296
|
-
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
297
|
-
* @return {Promise<{ data: { content: RealtimeFullTrajectory } }>} Return a full trajectory.
|
|
298
|
-
* @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 RealtimeAPI.unsubscribeTimetabe instead.
|
|
299
299
|
*/
|
|
300
|
-
|
|
300
|
+
unsubscribeDepartures(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
301
301
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* @param {
|
|
305
|
-
* @
|
|
306
|
-
* @param {function(data: { content: RealtimeFullTrajectory })} onMessage Function called on each message of the channel.
|
|
307
|
-
* @param {function} onError Callback when the subscription fails.
|
|
308
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
309
|
-
* @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.
|
|
310
306
|
*/
|
|
311
|
-
|
|
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;
|
|
312
313
|
/**
|
|
313
314
|
* Unsubscribe from full_trajectory channel
|
|
314
315
|
*
|
|
315
316
|
* @param {string} id A vehicle id.
|
|
316
|
-
* @param {
|
|
317
|
+
* @param {onFullTrajectoryMessageCallback} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
317
318
|
* @public
|
|
318
319
|
*/
|
|
319
320
|
unsubscribeFullTrajectory(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeFullTrajectory>): void;
|
|
320
321
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
|
|
324
|
-
|
|
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.
|
|
325
330
|
* @public
|
|
326
331
|
*/
|
|
327
|
-
|
|
332
|
+
unsubscribeNewsticker(tenant: RealtimeTenant, onMessage?: WebSocketAPIMessageCallback<RealtimeNews>): void;
|
|
328
333
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* @param {string} id A vehicle id.
|
|
332
|
-
* @param {function(data: { content: StopSequence[] })} onMessage Function called on each message of the channel.
|
|
333
|
-
* @param {function} onError Callback when the subscription fails.
|
|
334
|
-
* @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.
|
|
335
336
|
* @public
|
|
336
337
|
*/
|
|
337
|
-
|
|
338
|
+
unsubscribeStations(onMessage?: WebSocketAPIMessageCallback<RealtimeStation>): void;
|
|
338
339
|
/**
|
|
339
340
|
* Unsubscribe from stopsequence channel
|
|
340
341
|
*
|
|
341
342
|
* @param {string} id A vehicle id.
|
|
342
|
-
* @param {function(data: { content:
|
|
343
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
343
344
|
* @public
|
|
344
345
|
*/
|
|
345
|
-
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<
|
|
346
|
+
unsubscribeStopSequence(id: RealtimeTrainId, onMessage?: WebSocketAPIMessageCallback<RealtimeStopSequence[]>): void;
|
|
346
347
|
/**
|
|
347
|
-
*
|
|
348
|
-
* @param {
|
|
349
|
-
* @param {function}
|
|
350
|
-
* @
|
|
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
|
|
351
352
|
*/
|
|
352
|
-
|
|
353
|
+
unsubscribeTimetabe(stationId: RealtimeStationId, onMessage?: WebSocketAPIMessageCallback<RealtimeDeparture>): void;
|
|
353
354
|
/**
|
|
354
|
-
* Unsubscribe to
|
|
355
|
-
* @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
|
|
356
358
|
*/
|
|
357
|
-
|
|
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);
|
|
358
403
|
}
|
|
359
404
|
export default RealtimeAPI;
|