Skip to main content

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

Developer documentation

Personal favourites

Keep personal shortcuts and their order with the selected layout.

Source 0.1.0 Private source package

How the calls fit together

Read the current revision, review a change and retain the original command until its result is known.

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

layoutFavourites.get

Reads the current person's complete bounded collection for one layout.

const result = await client.layoutFavourites.get(
  "1",
  "18",
  {}
);
TypeScript parameters and return type
accountId · required
string

Account containing the selected layout.

layoutId · required
string

Layout whose personal collection should be read.

options · optional
RailDeckRequestControlOptions

Cancellation and timeout owned by the requesting journey.

Returns Promise<LayoutFavouriteSnapshot>.

Example evidence: Retained SDK transport fixture.

layoutFavourites.change

Saves one captured membership or ordering change without automatic replay.

const result = await client.layoutFavourites.change(
  "1",
  "1",
  {
    "requestId": "34a1d26d-322d-4714-a4bb-2686fe82ab82",
    "reviewedRevision": "ab721b00687dcff35a8ce4354b3f4093d621ddd8b15aed6cab7de9be6db30f92",
    "operation": "add",
    "target": {
      "kind": "signal",
      "id": "2"
    }
  },
  {}
);
TypeScript parameters and return type
accountId · required
string

Account containing the selected layout.

layoutId · required
string

Layout whose personal collection was reviewed.

input · required
ChangeLayoutFavouritesCommand

Original intent and reviewed revision, reused only for an explicit safe retry.

options · optional
RailDeckRequestControlOptions

Cancellation and timeout, without changing the captured command.

Returns Promise<LayoutFavouriteReceipt>.

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';

/**
 * Capture the current personal shortcut revision for an explicit later change.
 * @param client - Configured client; the caller owns current authority.
 * @param accountId - Authorised account for this workflow.
 * @param layoutId - Explicitly selected layout within the account.
 * @param signal - Caller-owned cancellation signal.
 * @returns The snapshot whose revision must remain attached to the reviewed change.
 */
export async function prepareFavouriteChange(
  client: Client,
  accountId: string,
  layoutId: string,
  signal: AbortSignal,
) {
  return client.layoutFavourites.get(accountId, layoutId, { signal, timeoutMs: 15_000 });
}

/**
 * Submit one confirmed shortcut addition without rebasing or automatic retry.
 * @param client - Configured client; the caller owns current authority.
 * @param accountId - Authorised account for this workflow.
 * @param layoutId - Explicitly selected layout within the account.
 * @param opened - Record retained from the review that authorised this change.
 * @param target - Shortcut target explicitly selected by the person.
 * @param requestId - New identity created once for this explicit user intent.
 * @param signal - Caller-owned cancellation signal.
 * @returns A receipt for this request; retain its identity if delivery becomes uncertain.
 */
export async function addReviewedFavourite(
  client: Client,
  accountId: string,
  layoutId: string,
  opened: Awaited<ReturnType<Client['layoutFavourites']['get']>>,
  target: Extract<Parameters<Client['layoutFavourites']['change']>[2], { operation: 'add' }>['target'],
  requestId: string,
  signal: AbortSignal,
) {
  return client.layoutFavourites.change(accountId, layoutId, {
    requestId, reviewedRevision: opened.revision, operation: 'add', target,
  }, { signal, timeoutMs: 15_000 });
}
Download TypeScript example

Information reviewed .