Skip to main content

Rail Deck is being prepared for an invitation-only Alpha. Check current availability

Developer documentation

Command stations

Read and maintain command-station records for a layout.

Source 0.1.0 Private source package

How the calls fit together

Load the selected station and review its deletion consequences. A saved record is not evidence of a hardware connection.

JavaScript examples

Supply your configured client. Each call awaits a decoded result; errors pass to your caller. These identifiers and values are fictional. Use selected development records and review every change before running it. Opening this page sends no API requests.

See the complete TypeScript workflow · Explore the Node starter

controllers.list

Lists controllers in an account.

const result = await client.controllers.list(
  "account 1",
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the controllers.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckControllerListResponse>.

Example evidence: Retained SDK transport fixture.

controllers.create

Creates a controller inside an account.

const result = await client.controllers.create(
  "account 1",
  {
    "name": "DCC-EX",
    "type": "dcc-ex"
  },
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that will own the controller.

input · required
CreateRailDeckControllerInput

Controller name, type, connection mode, layout assignment, and metadata.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckController>.

Example evidence: Retained SDK transport fixture.

controllers.get

Loads one controller.

const result = await client.controllers.get(
  "account-1",
  "controller-1",
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the controller.

controllerId · required
RailDeckIdentifier

Controller to load.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckController>.

Example evidence: Retained SDK transport fixture.

controllers.update

Updates one controller.

const result = await client.controllers.update(
  "account-1",
  "controller-1",
  {
    "name": "Yard Controller"
  },
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the controller.

controllerId · required
RailDeckIdentifier

Controller to update.

input · required
UpdateRailDeckControllerInput

Partial controller update.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckController>.

Example evidence: Retained SDK transport fixture.

controllers.getDeletionPreview

Loads the current consequences and blockers which bind deliberate controller deletion.

const result = await client.controllers.getDeletionPreview(
  "account-1",
  "controller-1",
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Authorised account containing the selected railway records.

controllerId · required
RailDeckIdentifier

Identifier of the explicitly selected record in your authorised development environment.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckControllerDeletionPreview>.

Example evidence: Retained SDK transport fixture.

controllers.delete

Deletes one controller.

const result = await client.controllers.delete(
  "account-1",
  "controller-1",
  {
    "previewFingerprint": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
    "confirmed": true
  },
  {}
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the controller.

controllerId · required
RailDeckIdentifier

Controller to delete.

input · required
DeleteRailDeckControllerInput

The operation input. Use the complete typed shape shown in the example and retain reviewed versions for writes.

requestOptions · optional
RailDeckRequestControlOptions

Caller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.

Returns Promise<RailDeckSuccessResponse>.

Example evidence: Retained SDK transport fixture.

Download all TypeScript method examples

JavaScript calls and TypeScript downloads are checked through the real SDK using local response fixtures. This verifies the calls and decoding for those fixtures.

Handle errors and uncertain outcomes

Choose another feature

The complete TypeScript workflow

Follow how the calls fit together, including the review and recovery steps. Supply your configured client and explicitly selected development records. Importing the download performs no requests; mutations are never retried automatically.

import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration';

/**
 * Load a station and review the consequences before a separate confirmation.
 * @param client - Configured client; the caller owns current authority.
 * @param accountId - Authorised account for this workflow.
 * @param controllerId - Explicitly selected command station.
 * @param signal - Caller-owned cancellation signal.
 * @returns The record and deletion preview, without removing or operating the station.
 */
export async function prepareControllerRemoval(
  client: Client,
  accountId: string,
  controllerId: string,
  signal: AbortSignal,
) {
  const options = { signal, timeoutMs: 15_000 };
  const controller = await client.controllers.get(accountId, controllerId, options);
  const consequences = await client.controllers.getDeletionPreview(accountId, controllerId, options);
  return { controller, consequences };
}
Download TypeScript example

Information reviewed .