npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@simrail-sdk/api

v0.1.1

Published

SimRail SDK - API

Readme

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

Usage details

Installation

Using NPM:

$ npm i @simrail-sdk/api

or

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

Where VERSION specifies the version to install.

Examples

Simple API usage

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
// }

Automatic updates

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;

Handling events

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();

Working with result caching

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();

Providing a (custom) Core API class

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 });

API reference

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.

  • class Api

  • const DEFAULT_ACTIVE_SERVER_RETENTION

  • const DEFAULT_ACTIVE_STATION_RETENTION

  • const DEFAULT_ACTIVE_TRAIN_RETENTION

  • const DEFAULT_TIMETABLE_RETENTION

  • const VERSION

  • const VMAX

  • const VMAX_VALUE

  • enum Type

  • interface ActiveServer

  • interface ActiveServers

  • interface ActiveServersUpdated

  • interface ActiveStation

  • interface ActiveStationsUpdated

  • interface ActiveTrain

  • interface ActiveTrainsUpdated

  • interface AutoUpdateChanged

  • interface Base

  • [interface Cache][api-reference-index.ts~Cache]

    • [property Cache.activeServers][api-reference-index.ts~Cache.activeServers]

    • [property Cache.activeStations][api-reference-index.ts~Cache.activeStations]

    • [property Cache.activeTrains][api-reference-index.ts~Cache.activeTrains]

    • [property Cache.timetables][api-reference-index.ts~Cache.timetables]

  • [interface Config][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Config]

    • [property Config.endpoints][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Config.endpoints]
  • [interface Data][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data]

    • [property Data.continuesAs][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.continuesAs]

    • [property Data.endStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.endStation]

    • [property Data.endsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.endsAt]

    • [property Data.locoType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.locoType]

    • [property Data.runId][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.runId]

    • [property Data.startStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.startStation]

    • [property Data.startsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.startsAt]

    • [property Data.timetable][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.timetable]

    • [property Data.trainLength][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.trainLength]

    • [property Data.trainName][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.trainName]

    • [property Data.trainNoInternational][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.trainNoInternational]

    • [property Data.trainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.trainNoLocal]

    • [property Data.trainWeight][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data.trainWeight]

  • [interface Disabled][api-reference-index.ts~Disabled]

  • [interface DispatchedBy][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy]

    • [property DispatchedBy.ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy.ServerCode]

    • [property DispatchedBy.SteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DispatchedBy.SteamId]

  • [interface Enabled][api-reference-index.ts~Enabled]

    • [property Enabled.retention][api-reference-index.ts~Enabled.retention]

    • [property Enabled.singleRecordOnly][api-reference-index.ts~Enabled.singleRecordOnly]

  • [interface Endpoints][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints]

    • [property Endpoints.liveData][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints.liveData]

    • [property Endpoints.timetable][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Endpoints.timetable]

  • [interface Error][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Error]

  • [interface LiveData][api-reference-index.ts~LiveData]

    • [property LiveData.cache][api-reference-index.ts~LiveData.cache]
  • [interface Regular][api-reference-index.ts~Regular]

  • [interface Server][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server]

    • [property Server.id][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.id]

    • [property Server.isActive][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.isActive]

    • [property Server.serverCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverCode]

    • [property Server.serverName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverName]

    • [property Server.serverRegion][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server.serverRegion]

  • [interface Station][api-reference-index.ts~Station]

    • [property Station.code][api-reference-index.ts~Station.code]
  • [interface Stations][api-reference-index.ts~Stations]

    • [property Stations.map][api-reference-index.ts~Stations.map]

    • [property Stations.timestamp][api-reference-index.ts~Stations.timestamp]

  • [interface Successful][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful]

    • [property Successful.count][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.count]

    • [property Successful.data][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.data]

    • [property Successful.description][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Successful.description]

  • [interface Timetable][api-reference-index.ts~Timetable]

    • [property Timetable.map][api-reference-index.ts~Timetable.map]

    • [property Timetable.timestamp][api-reference-index.ts~Timetable.timestamp]

  • [interface TimetableUpdated][api-reference-index.ts~TimetableUpdated]

    • [property TimetableUpdated.timetable][api-reference-index.ts~TimetableUpdated.timetable]
  • [interface Train][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train]

    • [property Train.endStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.endStation]

    • [property Train.id][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.id]

    • [property Train.runId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.runId]

    • [property Train.serverCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.serverCode]

    • [property Train.startStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.startStation]

    • [property Train.trainData][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainData]

    • [property Train.trainName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainName]

    • [property Train.trainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.trainNoLocal]

    • [property Train.type][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.type]

    • [property Train.vehicles][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train.vehicles]

  • [interface TrainData][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData]

    • [property TrainData.controlledBySteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.controlledBySteamId]

    • [property TrainData.distanceToSignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.distanceToSignalInFront]

    • [property TrainData.inBorderStationArea][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.inBorderStationArea]

    • [property TrainData.latitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.latitude]

    • [property TrainData.longitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.longitude]

    • [property TrainData.signalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.signalInFront]

    • [property TrainData.signalInFrontSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.signalInFrontSpeed]

    • [property TrainData.vdDelayedTimetableIndex][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.vdDelayedTimetableIndex]

    • [property TrainData.velocity][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~TrainData.velocity]

  • [interface Trains][api-reference-index.ts~Trains]

    • [property Trains.map][api-reference-index.ts~Trains.map]

    • [property Trains.timestamp][api-reference-index.ts~Trains.timestamp]

  • [interface WithCore][api-reference-index.ts~WithCore]

    • [property WithCore.core][api-reference-index.ts~WithCore.core]
  • type ActiveServers

  • [type ActiveStations][api-reference-index.ts~ActiveStations]

  • [type ActiveTrains][api-reference-index.ts~ActiveTrains]

  • [type ApiResponse][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ApiResponse]

  • [type ArrivalTime][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ArrivalTime]

  • [type AutoUpdate][api-reference-index.ts~AutoUpdate]

  • [type AutoUpdateServer][api-reference-index.ts~AutoUpdateServer]

  • [type Cache][api-reference-index.ts~Cache]

  • [type Code][api-reference-index.ts~Code]

  • [type Config][api-reference-index.ts~Config]

  • [type ContinuesAs][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ContinuesAs]

  • [type ControlledBySteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ControlledBySteamId]

  • [type Count][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Count]

  • [type DepartureTime][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~DepartureTime]

  • [type Description][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Description]

  • [type DifficultyLevel][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DifficultyLevel]

  • [type DisplayedTrainNumber][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~DisplayedTrainNumber]

  • [type DistanceToSignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~DistanceToSignalInFront]

  • [type Emitter][api-reference-index.ts~Emitter]

  • [type EndsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~EndsAt]

  • [type EndStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~EndStation]

  • [type Event][api-reference-index.ts~Event]

  • [type Id][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Id]

  • [type ImageUrl][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ImageUrl]

  • [type InBorderStationArea][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~InBorderStationArea]

  • [type IsActive][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~IsActive]

  • [type Kilometrage][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Kilometrage]

  • [type Latititude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latititude]

  • [type Latititute][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latititute]

  • [type Latitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Latitude]

  • [type Line][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Line]

  • [type List][api-reference-index.ts~List]

  • [type LocoType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~LocoType]

  • [type Longitude][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Longitude]

  • [type Longitute][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Longitute]

  • [type Map][api-reference-index.ts~Map]

  • [type MaxSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~MaxSpeed]

  • [type Mileage][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Mileage]

  • [type Name][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Name]

  • [type NameForPerson][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~NameForPerson]

  • [type NameOfPoint][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~NameOfPoint]

  • [type NoCache][api-reference-index.ts~NoCache]

  • [type Platform][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Platform]

  • [type PointId][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~PointId]

  • [type Prefix][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Prefix]

  • [type RadioChannel][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RadioChannel]

  • [type RadioChannels][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RadioChannels]

  • [type Result][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Result]

  • [type Retention][api-reference-index.ts~Retention]

  • [type RunId][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~RunId]

  • [type ServerCode][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~ServerCode]

  • [type ServerName][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerName]

  • [type ServerRegion][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~ServerRegion]

  • [type SignalInFront][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~SignalInFront]

  • [type SignalInFrontSpeed][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~SignalInFrontSpeed]

  • [type SingleRecordOnly][api-reference-index.ts~SingleRecordOnly]

  • [type StartsAt][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StartsAt]

  • [type StartStation][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StartStation]

  • [type StationCategory][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StationCategory]

  • [type SteamId][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~SteamId]

  • [type StopType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~StopType]

  • [type SupervisedBy][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~SupervisedBy]

  • [type Timestamp][api-reference-index.ts~Timestamp]

  • [type Timetables][api-reference-index.ts~Timetables]

  • [type Track][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Track]

  • [type TrainLength][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainLength]

  • [type TrainName][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainName]

  • [type TrainNoInternational][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainNoInternational]

  • [type TrainNoLocal][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainNoLocal]

  • [type TrainType][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainType]

  • [type TrainWeight][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~TrainWeight]

  • [type Type][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Type]

  • [type Url][api-reference-node_modules/@simrail-sdk/api-core-node/index.d.ts~Url]

  • [type VdDelayedTimetableIndex][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~VdDelayedTimetableIndex]

  • [type Vehicle][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Vehicle]

  • [type Vehicles][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Vehicles]

  • [type Velocity][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Velocity]

  • type Version

class 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

new Api.constructor(config)   

| Arguments: | Type | | ---------- | ------ | | config | [Config][api-reference-index.ts~Config] |

Returns:  Api

Since: 0.1.0

Definition:  index.ts:94

property Api.autoUpdateServer   

optional

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

Type:  string

Since: 0.1.0

Definition:  index.ts:47

property Api.config   

read-only

Specifies the configuration of the API.

Type:  [Config][api-reference-index.ts~Config]

Since: 0.1.0

Definition:  index.ts:35

property Api.core   

read-only

Specifies a reference to the Core API.

Type:  Api.Core

Since: 0.1.0

Definition:  index.ts:32

property Api.events   

read-only

Specifies the event emitter for API events.

Type:  [Emitter][api-reference-index.ts~Emitter]

Since: 0.1.0

Definition:  index.ts:38

property Api.autoUpdate   

Since: 0.1.0

Definition:  index.ts:73

method Api.flushActiveServerCache()   

Method to flush all cached active server records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:109

method Api.flushActiveStationCache()   

Method to flush all cached active station records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:119

method Api.flushActiveTrainCache()   

Method to flush all cached active train records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:129

method Api.flushCache()   

Method to flush all cached records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:139

method Api.flushTimetableCache()   

Method to flush all cached timetable records.

Returns:  Api  - This API instance.

Since: 0.1.0

Definition:  index.ts:152

method Api.getActiveServer(serverCode, noCache)   

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][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server]>  - The multiplayer server.

Since: 0.1.0

Definition:  index.ts:164

method Api.getActiveServers(noCache)   

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][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Server][]>  - A list of multiplayer servers.

Since: 0.1.0

Definition:  index.ts:178

method Api.getActiveStation(serverCode, stationCode, noCache)   

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][api-reference-index.ts~Station]>  - The active dispatch station.

Since: 0.1.0

Definition:  index.ts:210

method Api.getActiveStations(serverCode, noCache)   

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][api-reference-index.ts~Station][]>  - A list of active dispatch stations.

Since: 0.1.0

Definition:  index.ts:225

method Api.getActiveTrain(serverCode, trainNoLocal, noCache)   

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][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train]>  - The active dispatch train.

Since: 0.1.0

Definition:  index.ts:257

method Api.getActiveTrains(serverCode, noCache)   

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][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train][]>  - A list of active trains.

Since: 0.1.0

Definition:  index.ts:272

method Api.getTimetable(serverCode, noCache)   

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][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data][]>

Since: 0.1.0

Definition:  index.ts:297

method Api.getTimetable(serverCode, trainNoLocal, noCache)   

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

Returns:  Promise<[Data][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data]>

Since: 0.1.0

Definition:  index.ts:297

method Api.getTimetable(serverCode, trainNoOrNoCache, noCache)   

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

Returns:  Promise<[Data][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data] | [Data][api-reference-node_modules/@simrail-sdk/api-core-node/types/timetable/index.d.ts~Data][]>

Since: 0.1.0

Definition:  index.ts:297

method Api.startAutoUpdates(autoUpdateServer)   

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 Api.stopAutoUpdates()   

Method to stop auto updating cached data.

Returns:  Api  - This Api instance.

Since: 0.1.0

Definition:  index.ts:381

const DEFAULT_ACTIVE_SERVER_RETENTION   

Specifies the default retention for active server records.

Type:  [Config.LiveData.Cache.ActiveServers.Retention][api-reference-index.ts~Retention]

Since: 0.1.0

Definition:  index.ts:441

const DEFAULT_ACTIVE_STATION_RETENTION   

Specifies the default retention for active station records.

Type:  [Config.LiveData.Cache.ActiveStations.Retention][api-reference-index.ts~Retention]

Since: 0.1.0

Definition:  index.ts:443

const DEFAULT_ACTIVE_TRAIN_RETENTION   

Specifies the default retention for active train records.

Type:  [Config.LiveData.Cache.ActiveTrains.Retention][api-reference-index.ts~Retention]

Since: 0.1.0

Definition:  index.ts:445

const DEFAULT_TIMETABLE_RETENTION   

Specifies the default retention for timetable records.

Type:  [Config.Timetable.Cache.Retention][api-reference-index.ts~Retention]

Since: 0.1.0

Definition:  index.ts:447

const VERSION   

Specifies the version of the API.

Type:  Version

Since: 0.1.0

Definition:  index.ts:432

const VMAX   

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

const VMAX_VALUE   

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

enum Type   

Specifies a type of API event.

Since: 0.1.0

Definition:  index.ts:700

member Type.ActiveServersUpdated   

Specifies an event that fires when cached active servers updated.

Type:  "activeServersUpdated"

Since: 0.1.0

Definition:  index.ts:704

member Type.ActiveStationsUpdated   

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

Type:  "activeStationsUpdated"

Since: 0.1.0

Definition:  index.ts:706

member Type.ActiveTrainsUpdated   

Specifies an event that fires when cached active trains updated.

Type:  "activeTrainsUpdated"

Since: 0.1.0

Definition:  index.ts:708

member Type.AutoUpdateChanged   

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

Type:  "autoUpdateChanged"

Since: 0.1.0

Definition:  index.ts:702

member Type.TimetableUpdated   

Specifies an event that fires when cached timetable data updated.

Type:  "timetableUpdated"

Since: 0.1.0

Definition:  index.ts:710

interface ActiveServer   

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

Since: 0.1.0

Definition:  index.ts:623

interface ActiveServers   

Since: 0.1.0

Definition:  index.ts:625

property ActiveServers.map   

Type:  [Map][api-reference-index.ts~Map]

Since: 0.1.0

Definition:  index.ts:626

property ActiveServers.timestamp   

Type:  number

Since: 0.1.0

Definition:  index.ts:627

interface ActiveServersUpdated   

Specifies an event that fires when cached active servers updated.

Extends:  Base<Type.ActiveServersUpdated>

Since: 0.1.0

Definition:  index.ts:729

property ActiveServersUpdated.activeServers   

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

Since: 0.1.0

Definition:  index.ts:730

interface ActiveStation   

Extends:  [Station][api-reference-index.ts~Station]

Since: 0.1.0

Definition:  index.ts:635

property ActiveStation.code   

Type:  string

Since: 0.1.0

Definition:  index.ts:636

interface ActiveStationsUpdated   

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

Extends:  Base<Type.ActiveStationsUpdated>

Since: 0.1.0

Definition:  index.ts:734

property ActiveStationsUpdated.activeStations   

Type:  [List][api-reference-index.ts~List]

Since: 0.1.0

Definition:  index.ts:735

interface ActiveTrain   

Extends:  [Train][api-reference-node_modules/@simrail-sdk/api-core-node/types/liveData/index.d.ts~Train]

Since: 0.1.0

Definition:  index.ts:654

interface ActiveTrainsUpdated   

Specifies an event that fires when cached active trains updated.

Extends:  Base<Type.ActiveTrainsUpdated>

Since: 0.1.0

Definition:  index.ts:739

property ActiveTrainsUpdated.activeTrains   

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

Since: 0.1.0

Definition:  index.ts:740

interface AutoUpdateChanged   

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

Extends:  Base<Type.AutoUpdateChanged>

Since: 0.1.0

Definition:  index.ts:724

property AutoUpdateChanged.autoUpdate   

Type:  boolean

Since: 0.1.0

Definition:  index.ts:725

interface Base   

| Type params: | Extends | | ------------ | --------- | | EventType | Type |

Since: 0.1.0

Definition:  index.ts:713

Extended by

property Base.api   

Specifies a reference to the related Api instance.

Type:  Api

Since: 0.1.0

Definition:  index.ts:715

property Base.type   

Specifies the type of API event.

Type:  EventType

Since: 0.1.0

Definition:  [index.