Rolling stock
Maintain rolling stock, pictures, catalogue choices and layout assignments.
Source 0.1.0 Private source package
How the calls fit together
Open the vehicle before editing; preserve expectedUpdatedAt and keep model weights distinct from full-size weights.
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
rollingStock.list
Lists account-owned rolling stock.
const result = await client.rollingStock.list(
"account 1",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the rolling stock.
options· optionalRailDeckRequestControlOptionsOptional cancellation and request controls.
Returns Promise<RailDeckRollingStockListResponse>.
Example evidence: Retained SDK transport fixture.
rollingStock.previewDuplication
Reviews a source and its gallery.
const result = await client.rollingStock.previewDuplication(
"23",
"7",
{}
);TypeScript parameters and return type
accountId· requiredstringAuthorised account containing the selected railway records.
id· requiredstringIdentifier of the explicitly selected record in your authorised development environment.
options· optionalRailDeckRequestControlOptionsOptional filters or request controls shown in the type. The example demonstrates the supplied fields.
Returns Promise<RailDeckRollingStockDuplicationPreview>.
Example evidence: Retained SDK transport fixture.
rollingStock.duplicate
Copies reviewed configuration into an independent vehicle.
const result = await client.rollingStock.duplicate(
"23",
"7",
{
"displayName": "{{fixtureDisplayName}}",
"expectedSourceRevision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"runningNumber": null,
"includeNotes": false,
"includePhotographs": true
}
);TypeScript parameters and return type
accountId· requiredstringAuthorised account containing the selected railway records.
id· requiredstringIdentifier of the explicitly selected record in your authorised development environment.
input· requiredDuplicateRailDeckRollingStockInputThe operation input. Use the complete typed shape shown in the example and retain reviewed versions for writes.
Returns Promise<RailDeckRollingStock>.
Example evidence: Retained SDK transport fixture.
rollingStock.listForLayout
Reads a layout's stock roster.
const result = await client.rollingStock.listForLayout(
"account 1",
"layout/2",
{}
);TypeScript parameters and return type
accountId· requiredstringAuthorised account containing the selected railway records.
layoutId· requiredstringExplicitly selected layout within that account.
options· optionalRailDeckRequestControlOptionsOptional filters or request controls shown in the type. The example demonstrates the supplied fields.
Returns Promise<{ accountId: string; layoutId: string; rollingStockIds: string[] }>.
Example evidence: Retained SDK transport fixture.
rollingStock.assignToLayout
Adds a compatible vehicle to a layout.
const result = await client.rollingStock.assignToLayout(
"account 1",
"layout/2",
"stock/3"
);TypeScript parameters and return type
accountId· requiredstringAuthorised account containing the selected railway records.
layoutId· requiredstringExplicitly selected layout within that account.
rollingStockId· requiredstringIdentifier of the explicitly selected record in your authorised development environment.
Returns Promise<RailDeckSuccessResponse>.
Example evidence: Retained SDK transport fixture.
rollingStock.removeFromLayout
Removes a vehicle's layout assignment.
const result = await client.rollingStock.removeFromLayout(
"account 1",
"layout/2",
"stock/3"
);TypeScript parameters and return type
accountId· requiredstringAuthorised account containing the selected railway records.
layoutId· requiredstringExplicitly selected layout within that account.
rollingStockId· requiredstringIdentifier of the explicitly selected record in your authorised development environment.
Returns Promise<RailDeckSuccessResponse>.
Example evidence: Retained SDK transport fixture.
rollingStock.create
Creates one account-owned rolling-stock record.
const result = await client.rollingStock.create(
"account 1",
{
"displayName": "{{fixtureDisplayName}}",
"category": "coach",
"manufacturer": "Bachmann",
"className": "Mk1 SK",
"runningNumber": "E25624",
"emptyWeightGrams": 145,
"ladenWeightGrams": 180,
"maxSafeSpeedPercent": 85
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that will own the rolling-stock record.
input· requiredCreateRailDeckRollingStockInputRolling-stock details, weights, and optional safety limits.
Returns Promise<RailDeckRollingStock>.
Example evidence: Retained SDK transport fixture.
rollingStock.get
Loads one account-owned rolling-stock record.
const result = await client.rollingStock.get(
"account 1",
"stock-2",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the rolling-stock record.
rollingStockId· requiredRailDeckIdentifierRolling-stock record to load.
options· optionalRailDeckRequestControlOptionsOptional cancellation and request controls.
Returns Promise<RailDeckRollingStock>.
Example evidence: Retained SDK transport fixture.
rollingStock.update
Updates the reviewed version of one account-owned rolling-stock record.
const result = await client.rollingStock.update(
"account 1",
"stock-2",
{
"expectedUpdatedAt": "2026-07-02T09:00:00.000Z",
"displayName": "{{fixtureDisplayName}}",
"notes": "Runs in the demonstration rake."
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the rolling-stock record.
rollingStockId· requiredRailDeckIdentifierRolling-stock record to update.
input· requiredUpdateRailDeckRollingStockInputReviewed expectedUpdatedAt version and partial rolling-stock update.
Returns Promise<RailDeckRollingStock>.
Example evidence: Retained SDK transport fixture.
rollingStock.delete
Deletes one account-owned rolling-stock record.
const result = await client.rollingStock.delete(
"account 1",
"stock-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the rolling-stock record.
rollingStockId· requiredRailDeckIdentifierRolling-stock record to delete.
Returns Promise<RailDeckSuccessResponse>.
Example evidence: Retained SDK transport fixture.
rollingStock.applyCatalogueProfile
Applies or previews a catalogue product profile for rolling stock.
const result = await client.rollingStock.applyCatalogueProfile(
"account 1",
"stock-2",
{
"mode": "dry_run",
"productProfileId": "product-rolling-stock-1",
"options": {
"productDetails": "merge"
}
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the rolling-stock record.
rollingStockId· requiredRailDeckIdentifierRolling-stock record receiving catalogue product data.
input· requiredApplyRailDeckCatalogueProfileInputCatalogue product profile, mode, and section options.
Returns Promise<RailDeckRollingStockCatalogueProfileApplication>.
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.
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';
/**
* Read the rolling-stock version that the person will edit.
* @param client - Configured client; the caller owns current authority.
* @param accountId - Authorised account for this workflow.
* @param vehicleId - Explicitly selected rolling-stock record.
* @param signal - Caller-owned cancellation signal.
* @returns The original record, including updatedAt for a later save.
*/
export async function openVehicle(
client: Client,
accountId: string,
vehicleId: string,
signal: AbortSignal,
) {
return client.rollingStock.get(accountId, vehicleId, { signal, timeoutMs: 15_000 });
}
/**
* Save confirmed notes against the version actually opened by the editor.
* @param client - Configured client; the caller owns current authority.
* @param accountId - Authorised account for this workflow.
* @param opened - Record retained from the review that authorised this change.
* @param notes - New notes explicitly confirmed by the person editing the vehicle.
* @returns The updated vehicle; conflicts propagate without silently overwriting newer work.
*/
export async function saveReviewedVehicleNotes(
client: Client,
accountId: string,
opened: Awaited<ReturnType<Client['rollingStock']['get']>>,
notes: string,
) {
return client.rollingStock.update(accountId, opened.id, {
expectedUpdatedAt: opened.updatedAt, notes,
});
}
Download TypeScript example