Skip to content

SimRail-SDK/api

Repository files navigation

SimRail API SDK

This is a simple SDK (community edition) for interacting with the SimRail APIs.

This API module builds a layer on top of a Core API module (like @simrail-sdk/api-core-node) by providing:

  • Methods to request single resources. (A single server, station or train)
  • Automatic pulling of remote data updates.
  • Update event subcriptions.
  • Caching of remote API responses.

This API module is only about interacting with SimRail's remote APIs. If you are looking for a more developer-friendly SDK, checkout:

This module requires the use of a Core API module to be able to extend it. By default this module will use @simrail-sdk/api-core-node. To provide another Core API module or a custom one, check out the example providing a (custom) Core API class below.



Content index



Using NPM:

$ npm i @simrail-sdk/api

or

$ npm i github:simrail-sdk/api#VERSION

Where VERSION specifies the version to install.

import Api from "@simrail-sdk/api";

const api = new Api({
    endpoints: {
        liveData: "https://panel.simrail.eu:8084",
        timetable: "https://api1.aws.simrail.eu:8082/api",
    },
});
const serverCode: Api.ServerCode = "en1";

api.getActiveServers().then(...);
api.getActiveServer(serverCode).then(...);
// {
//     id: "638fec40d089346098624eb5",
//     isActive: true,
//     serverCode: "en1",
//     serverName: "EN1 (English)",
//     serverRegion: "Europe",
// },

api.getActiveStations(serverCode).then(...);
api.getActiveStation(serverCode, "KO").then(...);
// {
//     additionalImage1URL: "https://api.simrail.eu:8083/Thumbnails/Stations/ko2.jpg",
//     additionalImage2URL: "https://api.simrail.eu:8083/Thumbnails/Stations/ko3.jpg",
//     difficultyLevel: 5,
//     dispatchedBy: [],
//     id: "644133f3858f72cc3d476e42",
//     latitude: 50.25686264038086,
//     longitude: 19.01921844482422,
//     mainImageURL: "https://api.simrail.eu:8083/Thumbnails/Stations/ko1m.jpg",
//     name: "Katowice",
//     prefix: "KO"
// },

api.getActiveTrains(serverCode).then(...);
api.getActiveTrain(serverCode, "446004").then(...);
// {
//     endStation: "Częstochowa",
//     id: "662f96b3766d379b4f3f525f",
//     runId: "73c0f0ea-20d9-4317-8339-8bc7d098bd35",
//     serverCode: "en1",
//     startStation: "Jaworzno Szczakowa",
//     trainData: {
//     inBorderStationArea: true,
//     latitude: 50.262142181396484,
//     longitude: 19.269641876220703,
//     vdDelayedTimetableIndex: 1,
//     velocity: 40,
//     distanceToSignalInFront: 386.6281433105469,
//     signalInFront: "SMA_G@7129,82510,8",
//     signalInFrontSpeed: 40
//     },
//     trainName: "PWJ",
//     trainNoLocal: "446004",
//     type: "bot",
//     vehicles: [ "EN57/EN57-1003", "EN57/EN57-614", "EN57/EN57-1755" ]
// },

api.getTimetable(serverCode).then(...);
api.getTimetable(serverCode, "446004").then(...);
// {
//     endStation: "Częstochowa",
//     endsAt: "03:53:00",
//     locoType: "EN57 (5B+6B+5B)",
//     runId: "73c0f0ea-20d9-4317-8339-8bc7d098bd35",
//     startStation: "Jaworzno Szczakowa",
//     startsAt: "02:15:00",
//     timetable: [
//       {
//         departureTime: "2024-08-05 02:15:00",
//         displayedTrainNumber: "446004",
//         line: 133,
//         maxSpeed: 100,
//         kilometrage: 15.81,
//         nameForPerson: "Jaworzno Szczakowa",
//         nameOfPoint: "Jaworzno Szczakowa",
//         pointId: "1472",
//         stopType: "NoStopOver",
//         trainType: "PWJ",
//         supervisedBy: "Jaworzno Szczakowa"
//       },
//       ...
//     ],
//     trainLength: 60,
//     trainName: "PWJ",
//     trainNoLocal: "446004",
//     trainWeight: 60
// }


import Api from "@simrail-sdk/api";

const api = new Api(...);
const serverCode: Api.ServerCode = "en1";

// Start auto updates using data from "en1".
api.startAutoUpdates(serverCode);

// Stop auto updates.
api.stopAutoUpdates();

// Restart auto updates.
api.startAutoUpdates();

// Or, do the same thing using accessors
api.autoUpdateServer = serverCode;
api.autoUpdate = true;
const updatesEnabled = api.autoUpdate;


import Api from "@simrail-sdk/api";

const api = new Api(...);

// Subscribe to API events.
const eventSubscription = api.events.subscribe((event) => {
    switch (event.type) {
        case Api.Event.Type.ActiveServersUpdated:  event.activeServers[0].id;       break;
        case Api.Event.Type.ActiveStationsUpdated: event.activeStations[0].code;    break;
        case Api.Event.Type.ActiveTrainsUpdated:   event.activeTrains[0].id;        break;
        case Api.Event.Type.AutoUpdateChanged:     event.autoUpdate === true;       break;
        case Api.Event.Type.TimetableUpdated:      event.timetable[0].trainNoLocal; break;
    }
});

// Unsubscribe from events.
eventSubscription.unsubscribe();


import Api from "@simrail-sdk/api";

// Cache configuration can be specified at API class construction.
const api = new Api({

    /** Specifies a config for requests to the timetable endpoint. */
    timetable: {
        cache: {
            /**
             * Specifies if caching is enabled.
             * @default true
             */
            enabled: true,
            /**
             * Specifies for how long a timetable record is cached in seconds.
             * This value also specifies the update interval for auto updates.
             * @default 1440
             */
            retention: 1440,
            /**
             * Specifies if only one timetable record should be cached.
             *
             * When set to:
             * - `true` only the last timetable record will be cached.
             * - `false` a timetable record will be cached for
             *   each server that was queried for a timetable.
             *   Use this when you are actively querying multiple servers.
             *
             * @default true
             */
            singleRecordOnly: true,
        },
    },

    /** Specifies a config for requests to the live data endpoint. */
    liveData: {
        cache: {
            // Values displayed are the defaults.
            activeServers:  { enabled: true, retention: 30 },
            activeStations: { enabled: true, retention: 30 },
            activeTrains:   { enabled: true, retention: 5  },
        },
    },

    ...

});


// Independent of the cache config you can prevent a cached result
//   to be returned by specifying the `noCache` argument.
const serverCode: Api.ServerCode = "de1";
const noCache: Api.NoCache = true;
const nonCachedServers        = await api.getActiveServers(noCache);
const nonCachedServer         = await api.getActiveServer(serverCode, noCache);
const nonCachedStations       = await api.getActiveStations(serverCode, noCache);
const nonCachedStation        = await api.getActiveStation(serverCode, "KO", noCache);
const nonCachedTrains         = await api.getActiveTrains(serverCode, noCache);
const nonCachedTrain          = await api.getActiveTrain(serverCode, "446004", noCache);
const nonCachedTimetable      = await api.getTimetable(serverCode, noCache);
const nonCachedTrainTimetable = await api.getTimetable(serverCode, "446004", noCache);


// If you need to, flush cached data.
api.flushCache();
// Or
api.flushActiveServerCache();
api.flushActiveStationCache();
api.flushActiveTrainCache();
api.flushTimetableCache();


import Api from "@simrail-sdk/api";
import Core from "different-api-core";

// By default the API will use the Core API class from package `@simrail-sdk/api-core-node`.
// To provide another Core API class or a custom one, just include the instance in the API config.
const core = new Core({ endpoints });
const api = new Api({ core });


NOTE: The API reference section doesn't account for namespaces, this unfortunately means the documentation below is not entirely complete. Please investigate the TypeScript definition files for the full API.




Specifies an API class instance for interacting with SimRail's remote API.

Implements:  Omit<Api.Core, "config">

Since: 0.1.0

Definition:  index.ts:29



Arguments: Type
config Config

Returns:  Api

Since: 0.1.0

Definition:  index.ts:94



optional

Specifies the unique code of the server to automatically retrieve data from.

Type:  string

Since: 0.1.0

Definition:  index.ts:47



read-only

Specifies the configuration of the API.

Type:  Config

Since: 0.1.0

Definition:  index.ts:35



read-only

Specifies a reference to the Core API.

Type:  Api.Core

Since: 0.1.0

Definition:  index.ts:32



read-only

Specifies the event emitter for API events.

Type:  Emitter

Since: 0.1.0

Definition:  index.ts:38



Since: 0.1.0

Definition:  index.ts:73



Method to flush all cached active server records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:109



Method to flush all cached active station records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:119



Method to flush all cached active train records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:129



Method to flush all cached records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:139



Method to flush all cached timetable records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:152



Method to retrieve an active server from the live data endpoint.

Arguments: Type Optional Default Description
serverCode string No N/A The unique code of the server.
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Server>  - The multiplayer server.

Since: 0.1.0

Definition:  index.ts:164



Method to retrieve active servers from the live data endpoint.

Arguments: Type Optional Default Description
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Server[]>  - A list of multiplayer servers.

Since: 0.1.0

Definition:  index.ts:178



Method to retrieve an active dispatch station from the live data endpoint.

The value for stationCode can be either:

  • The prefix of the station.
  • The code which is the prefix but stripped from diacritics. Example: prefix ŁA equals code LA.
Arguments: Type Optional Default Description
serverCode string No N/A The code of the related server.
stationCode string No N/A The unique code of the dispatch station.
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Station>  - The active dispatch station.

Since: 0.1.0

Definition:  index.ts:210



Method to retrieve active dispatch stations from the live data endpoint.

Arguments: Type Optional Default Description
serverCode string No N/A The unique code of the multiplayer server.
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Station[]>  - A list of active dispatch stations.

Since: 0.1.0

Definition:  index.ts:225



Method to retrieve an active train from the live data endpoint.

Arguments: Type Optional Default Description
serverCode string No N/A The code of the related server.
trainNoLocal string No N/A The national number of the train.
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Train>  - The active dispatch train.

Since: 0.1.0

Definition:  index.ts:257



Method to retrieve active trains from the live data endpoint.

Arguments: Type Optional Default Description
serverCode string No N/A The unique code of the multiplayer server.
noCache boolean Yes false Prevent returning a cached result.

Returns:  Promise<Train[]>  - A list of active trains.

Since: 0.1.0

Definition:  index.ts:272



Method to retrieve timetable data from the timetable endpoint.

Arguments: Type Optional Description
serverCode string No The unique code of the multiplayer server.
noCache boolean Yes

Returns:  Promise<Data[]>

Since: 0.1.0

Definition:  index.ts:297



Arguments: Type Optional
serverCode string No
trainNoLocal string No
noCache boolean Yes

Returns:  Promise<Data>

Since: 0.1.0

Definition:  index.ts:297



Arguments: Type Optional
serverCode string No
trainNoOrNoCache string Yes
noCache boolean Yes

Returns:  Promise<Data | Data[]>

Since: 0.1.0

Definition:  index.ts:297



Method to start auto updating cached data.

This will update cached data and enable events. The update interval is determined by checking the cache retention value.

NOTE: Auto update only works for records which have caching enabled.

Arguments: Type Optional
autoUpdateServer string Yes

Returns:  Api  - This Api instance.

Since: 0.1.0

Definition:  index.ts:337



Method to stop auto updating cached data.

Returns:  Api  - This Api instance.

Since: 0.1.0

Definition:  index.ts:381




Specifies the default retention for active server records.

Type:  Config.LiveData.Cache.ActiveServers.Retention

Since: 0.1.0

Definition:  index.ts:441




Specifies the default retention for active station records.

Type:  Config.LiveData.Cache.ActiveStations.Retention

Since: 0.1.0

Definition:  index.ts:443




Specifies the default retention for active train records.

Type:  Config.LiveData.Cache.ActiveTrains.Retention

Since: 0.1.0

Definition:  index.ts:445




Specifies the default retention for timetable records.

Type:  Config.Timetable.Cache.Retention

Since: 0.1.0

Definition:  index.ts:447




Specifies the version of the API.

Type:  Version

Since: 0.1.0

Definition:  index.ts:432




Specifies the maximum allowable operating speed. (Vmax)

Type:  "vmax"

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:15




Specifies the "speed" value that will indicate "vmax".

Type:  32767

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:18




Specifies a type of API event.

Since: 0.1.0

Definition:  index.ts:700



Specifies an event that fires when cached active servers updated.

Type:  "activeServersUpdated"

Since: 0.1.0

Definition:  index.ts:704



Specifies an event that fires when cached active dispatch stations updated.

Type:  "activeStationsUpdated"

Since: 0.1.0

Definition:  index.ts:706



Specifies an event that fires when cached active trains updated.

Type:  "activeTrainsUpdated"

Since: 0.1.0

Definition:  index.ts:708



Specifies an event that fires when the value of Api.autoUpdate changes.

Type:  "autoUpdateChanged"

Since: 0.1.0

Definition:  index.ts:702



Specifies an event that fires when cached timetable data updated.

Type:  "timetableUpdated"

Since: 0.1.0

Definition:  index.ts:710




Extends:  Server

Since: 0.1.0

Definition:  index.ts:623




Since: 0.1.0

Definition:  index.ts:625



Type:  Map

Since: 0.1.0

Definition:  index.ts:626



Type:  number

Since: 0.1.0

Definition:  index.ts:627




Specifies an event that fires when cached active servers updated.

Extends:  Base<Type.ActiveServersUpdated>

Since: 0.1.0

Definition:  index.ts:729



Type:  Server[]

Since: 0.1.0

Definition:  index.ts:730




Extends:  Station

Since: 0.1.0

Definition:  index.ts:635



Type:  string

Since: 0.1.0

Definition:  index.ts:636




Specifies an event that fires when cached active dispatch stations updated.

Extends:  Base<Type.ActiveStationsUpdated>

Since: 0.1.0

Definition:  index.ts:734



Type:  List

Since: 0.1.0

Definition:  index.ts:735




Extends:  Train

Since: 0.1.0

Definition:  index.ts:654




Specifies an event that fires when cached active trains updated.

Extends:  Base<Type.ActiveTrainsUpdated>

Since: 0.1.0

Definition:  index.ts:739



Type:  Train[]

Since: 0.1.0

Definition:  index.ts:740




Specifies an event that fires when the value of Api.autoUpdate changes.

Extends:  Base<Type.AutoUpdateChanged>

Since: 0.1.0

Definition:  index.ts:724



Type:  boolean

Since: 0.1.0

Definition:  index.ts:725




Type params: Extends
EventType Type

Since: 0.1.0

Definition:  index.ts:713

Extended by



Specifies a reference to the related Api instance.

Type:  Api

Since: 0.1.0

Definition:  index.ts:715



Specifies the type of API event.

Type:  EventType

Since: 0.1.0

Definition:  index.ts:717




Specifies the internal cache of an API class instance.

Since: 0.1.0

Definition:  index.ts:615



optional

Type:  ActiveServers

Since: 0.1.0

Definition:  index.ts:616



Type:  ActiveStations

Since: 0.1.0

Definition:  index.ts:617



Type:  ActiveTrains

Since: 0.1.0

Definition:  index.ts:618



Type:  Timetables

Since: 0.1.0

Definition:  index.ts:619




Specifies the configuration of the API.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:96



read-only

Specifies the configuration for API endpoints.

Type:  Endpoints

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:104




Specifies information about a train in a timetable.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:15



optional

Specifies under which train number the train will continue.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:17



Specifies the name of the destination station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:19



Specifies when the train arrives at it's destination. Format: hh:mm:ss

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:21



Specifies the name of the train's locomotive.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:23



Specifies the unique ID of the train. (independent from the train number)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:25



Specifies the name of the origin station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:27



Specifies when the train departs from it's origin. Format: hh:mm:ss

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:29



Specifies a list of timetable entries for this train.

Type:  Api.Timetable.Timetable

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:31



Specifies the length of the train in meters.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:33



Specifies the name of the train or train series.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:35



optional

Specifies the international train number of this train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:37



Specifies the national train number of this train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:39



Specifies the weight of this train in metric tonnes.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:41




Specifies a configuration for caching timetable data.

Since: 0.1.0

Definition:  index.ts:601




Specifies a player dispatching at a station in the raw API format.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:196



Specifies the unique code of the server the player is using in the raw API format.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:198



Specifies the Steam ID of the player in the raw API format.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:200




Specifies a configuration for caching timetable data.

Since: 0.1.0

Definition:  index.ts:577



read-only optional

Specifies for how long a timetable record should be cached in seconds.

Defaults to 24 hours.

Type:  number

Since: 0.1.0

Definition:  index.ts:585



read-only optional

Specifies if only one timetable record should be cached.

When set to:

  • true only the last timetable record will be cached.
  • false a timetable record will be cached for each server that was queried for a timetable. Use this when you are actively querying multiple servers.

Type:  boolean

Since: 0.1.0

Definition:  index.ts:597




Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:110



read-only

Specifies the URL for the live data API endpoint.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:112



read-only

Specifies the URL for the timetable API endpoint.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:114




Specifies a response for a failed request.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:39




Specifies a configuration for live data queries.

Since: 0.1.0

Definition:  index.ts:476



read-only optional

Specifies a configuration for caching live data data.

Type:  Cache

Since: 0.1.0

Definition:  index.ts:478




Specifies a configuration of the API.

Extends

Since: 0.1.0

Definition:  index.ts:473




Specifies a multiplayer server.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:64

Extended by:  ActiveServer



Specifies the unique ID of the server. (independent of code)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:66



Specifies if the server is active.

Type:  boolean

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:68



Specifies the unique code of the server.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:70



Specifies the name of the server.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:72



Specifies in which region the server is located.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:74




Specifies an active dispatch station.

Since: 0.1.0

Definition:  index.ts:758

Extended by:  ActiveStation



Type:  string

Since: 0.1.0

Definition:  index.ts:759




Since: 0.1.0

Definition:  index.ts:643



Type:  Map

Since: 0.1.0

Definition:  index.ts:644



Type:  number

Since: 0.1.0

Definition:  index.ts:645




Specfies a response for a successful request.

Type params: Description
ResponseData The requested data.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:47



Specifies the number of results.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:49



Specifies the requested data.

Type:  ResponseData

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:51



Specifies a description for the response.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:53




Since: 0.1.0

Definition:  index.ts:675



Type:  Map

Since: 0.1.0

Definition:  index.ts:676



Type:  number

Since: 0.1.0

Definition:  index.ts:677




Specifies an event that fires when cached timetable data updated.

Extends:  Base<Type.TimetableUpdated>

Since: 0.1.0

Definition:  index.ts:744



Type:  Data[]

Since: 0.1.0

Definition:  index.ts:745




Specifies an active train.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:220

Extended by:  ActiveTrain



Specifies the name of the destination station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:222



Specifies the unique ID of the train. (independent from runId)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:224



Specifies the unique ID of this train on the timetable server. (independent from id)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:226



Specifies the unique code of the server the train is running on.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:228



Specifies the name of the origin station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:230



Specifies live data about the train.

Type:  TrainData

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:232



Specifies the name of the train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:234



Specifies the national train number of this train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:236



Specifies if this train is operated by a "bot" or a "user".

Type:  Type

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:238



Specifies a list of vehicles of this train.

NOTE: This data hasn't be deciphered yet, if you know what this data describes please open a new issue in the project repository.

Type:  Vehicles

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:245




Specifies live data about a train.

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:281



optional

Specifies the Steam ID of the player controlling this train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:283



optional

Specifies the distance to the next signal in meters.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:285



Specifies if the train is in the border area of the map. (unplayable area)

Type:  boolean

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:287



Specifies the current global latitude of the train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:289



Specifies the current global longitude of the train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:291



optional

Specifies data about the next signal.

NOTE: This data (except for the ID prefixing the @ symbol) hasn't be deciphered yet, if you know what this data describes please open a new issue in the project repository.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:298



optional

Specifies the track limit effective at the next signal in km/h.

Type:  SignalInFrontSpeed

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:300



Specifies the index of the current entry in this train's timetable.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:302



Specifies the current speed of the train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:304




Since: 0.1.0

Definition:  index.ts:660



Type:  Map

Since: 0.1.0

Definition:  index.ts:661



Type:  number

Since: 0.1.0

Definition:  index.ts:662




Specifies a configuration of the API.

Extends:  Core

Since: 0.1.0

Definition:  index.ts:467



read-only

Specifies a Core API class instance.

Type:  Core<true>

Since: 0.1.0

Definition:  index.ts:469




Specifies a configuration for caching active servers.

Type:  ActiveServers.Disabled | ActiveServers.Enabled

Since: 0.1.0

Definition:  index.ts:504




Type:  { [serverCode in [LiveData.Server.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerCode]]: ActiveStations.Stations }

Since: 0.1.0

Definition:  index.ts:639




Type:  { [serverCode in [LiveData.Server.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerCode]]: ActiveTrains.Trains }

Since: 0.1.0

Definition:  index.ts:656




Specifies a response returned by the remote API.

Type params: Description
ResponseData The requested data.

Type:  ApiResponse.Error | ApiResponse.Successful<ResponseData>

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:28




Specifies when the train arrives at a point.

Type:  Timetable.ArrivalTime | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:208




Specifies if cached data is automatically updated.

Type:  boolean

Since: 0.1.0

Definition:  index.ts:450




Specifies the unique code of a server to automatically retrieve data from.

Type:  [LiveData.Server.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerCode]

Since: 0.1.0

Definition:  index.ts:453




Specifies a configuration for caching timetable data.

Type:  Cache.Disabled | Cache.Enabled

Since: 0.1.0

Definition:  index.ts:564




Specifies the unique code of the dispatch station.

Type:  string

Since: 0.1.0

Definition:  index.ts:772




Specifies a configuration of the API.

Type:  Config.Regular | Config.WithCore

Since: 0.1.0

Definition:  index.ts:456




Specifies under which train number a train will continue.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:49




Specifies the Steam ID of the player controlling a train in the raw API format.

Type:  string | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:358




Specifies the number of results.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:35




Specifies when a train departs at this point.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:134




Specifies a description of a response.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:37




Specifies the difficulty level for a station in the raw API format. (from 1 to 5)

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:194




Specifies which train number is displayed for a train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:136




Specifies the distance to the next signal in meters and in the raw API format.

Type:  number | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:371




Specifies an API event emitter.

Type:  RXJS.Observable<Event>

Since: 0.1.0

Definition:  index.ts:721




Specifies when a train arrives at it's destination. Format: hh:mm:ss

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:53




Specifies the name of a destination station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:51




Specifies an API event.

Type:  Event.AutoUpdateChanged | Event.ActiveServersUpdated | Event.ActiveStationsUpdated | Event.ActiveTrainsUpdated | Event.TimetableUpdated

Since: 0.1.0

Definition:  index.ts:691




Specifies the unique ID of a train. (independent from Train.RunId)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:251




Specifies the URL of an image.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:158




Specifies if a train is in the border area of the map. (unplayable area)

Type:  boolean

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:312




Specifies if a server is active.

Type:  boolean

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:80




Specifies at what distance a point will be passed.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:144




Specifies the global latitude of a station in the raw API format.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:207




Specifies the current global latitude of a train in the raw API format.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:360




Specifies the current global latitude of a train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:314




Specifies the number of the line that a train will follow.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:138




Specifies a list of active dispatch stations.

Type:  Station[]

Since: 0.1.0

Definition:  index.ts:774




Specifies the name of a train's locomotive.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:55




Specifies the current global longitude of a train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:316




Specifies the current global longitude of a train in the raw API format.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:362




Type:  { [trainNumber in [LiveData.Train.TrainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainNoLocal]]: Api.Timetable.Data }

Since: 0.1.0

Definition:  index.ts:680




Specifies the maximum speed at a point.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:142




Specifies at what distance a point will be passed in kilometers.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:212




Specifies the name of a station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:166




Specifies the name of the dispatcher for a point.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:146




Specifies the name of a point.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:148




Specifies if a cached result can be returned.

Type:  boolean

Since: 0.1.0

Definition:  index.ts:779




Specifies at which platform a train will stop in Roman numerals.

Type:  Timetable.Platform | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:218




Specifies the unique ID of a point.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:156




Specifies the prefix of a station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:168




Specifies a radio channel.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:162




Specifies the radio channels required after a point as a comma-separated string.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:224




Specifies if a request succeeded.

Type:  boolean

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:41




Specifies for how long a timetable record is cached in seconds.

Type:  number

Since: 0.1.0

Definition:  index.ts:604




Specifies the unique ID of a train. (independent from the train number)

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:57




Specifies the unique code of a timetable server.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:59




Specifies the name of a server.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:86




Specifies in which region a server is located.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:88




Specifies data about the next signal in the raw API format.

NOTE: This data (except for the ID prefixing the @ symbol) hasn't be deciphered yet, if you know what this data describes please open a new issue in the project repository.

Type:  string | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:369




Specifies the track limit effective at the next signal in km/h and in the raw API format.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:373




Specifies if only one timetable record should be cached.

Type:  boolean

Since: 0.1.0

Definition:  index.ts:607




Specifies when a train departs from it's origin. Format: hh:mm:ss

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:63




Specifies the name of an origin station.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:61




Specifies the category of a station.

Type:  Timetable.StationCategory | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:226




Specifies the Steam ID of a player.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:153




Specifies the type of stop a train will make.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:228




Specifies the name of the dispatch station a point belongs to.

Type:  Timetable.SupervisedBy | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:230




Type:  number

Since: 0.1.0

Definition:  index.ts:686




Type:  { [serverCode in [LiveData.Server.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerCode]]: Timetables.Timetable }

Since: 0.1.0

Definition:  index.ts:671




Specifies the number of the track a train will stop at.

Type:  Timetable.Track | null

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:232




Specifies the length of a train in meters.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:65




Specifies the name of a train or train series.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:67




Specifies the international train number of a train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:69




Specifies the national train number of a train.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:71




Specifies the name of a train series.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:178




Specifies the weight of a train in metric tonnes.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts:73




Specifies the type of train operator in the raw API format. ("bot" or "user")

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:408




Specifies an API endpoint URL.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/index.d.ts:118




Specifies the index of the current entry in a train's timetable.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:327




Specifies data about a vehicle of a train.

NOTE: This data hasn't be deciphered yet, if you know what this data describes please open a new issue in the project repository.

Type:  string

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:272




Specifies a list of vehicles of a train.

NOTE: This data hasn't be deciphered yet, if you know what this data describes please open a new issue in the project repository.

Type:  Vehicles[]

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:279




Specifies the current speed of a train.

Type:  number

Since: 0.1.0

Definition:  node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts:329




Specifies the version of the API.

Type:  `${number}.${number}.${number}` | `${number}.${number}.${number}-${string}`

Since: 0.1.0

Definition:  index.ts:782




Package name: @simrail-sdk/api

Author: Niek van Bennekom

Version: 0.1.1

Repository: github:simrail-sdk/api (origin)

Keywords: simrail, sdk, api, rest.

View license   |   view open source licenses

SCTL version: 0.1.11-dev

Production packages: (3)

  • @simrail-sdk/api-core-node: SimRail SDK - API Core for Node.JS.

  • remove-accents: Converting the accented characters to their corresponding non-accented ASCII characters.

  • rxjs: Reactive Extensions for modern JavaScript.



Development packages: (2)

  • @types/node: TypeScript definitions for node.

  • typescript: TypeScript is a language for application scale JavaScript development.



This module contains and uses the following internal modules:

  • index.js


Dependency tree:

Dependency tree graph



File type Number of files Lines with code Lines with comments Blank lines
Markdown 3 3558 0 2300
TypeScript 8 793 556 199
JavaScript 7 497 7 0
JSON 3 123 0 1
YAML 1 50 0 3
All (total) 22 5021 563 2503

About

SimRail SDK - API

Resources

License

Stars

Watchers

Forks

Packages

No packages published