Skip to content
Docs
Reference

BackstageClient.devices

BackstageClient.devices in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / BackstageClient / devices

devices: {
  assignRoles: (deviceId: string, request: {
     accountRoles: {
        accountId: string;
        roleId: string;
     }[];
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     roleId: string;
  }[]>;
  delete: (deviceId: string, requestOptions?: RequestOptions) => Promise<boolean>;
  dispatchCommand: (deviceId: string, request: {
     idempotencyKey?: string;
     payload?: Record<string, any>;
     peripheralId?: string;
     type: string;
   }, requestOptions?: RequestOptions) => Promise<{
     completedAt: string | null;
     createdAt: string;
     createdBy:   | {
        id: string;
        type: string;
      }
        | null;
     deliveredAt: string | null;
     deviceId: string;
     expiresAt: string;
     id: string;
     idempotencyKey: string | null;
     payload: {
      [key: string]: unknown;
     };
     peripheralId: string | null;
     progress:   | {
      [key: string]: unknown;
      }
        | null;
     result:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
  }>;
  get: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     appVersion: string | null;
     attachment: string | null;
     capabilities:   | {
      [key: string]: unknown;
      }
        | null;
     clientKey: string | null;
     connectivity: string;
     createdAt: string;
     hostDeviceId: string | null;
     id: string;
     lastSeenAt: string | null;
     liveStatus:   | {
      [key: string]: unknown;
      }
        | null;
     local:   | {
        hostname: string | null;
        port: number | null;
      }
        | null;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     model: string | null;
     name: string;
     online: boolean;
     peripherals?: {
        id: string;
        name: string;
        type: string;
     }[];
     platform:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
     updatedAt: string;
     vendor: string | null;
  }>;
  getCommand: (commandId: string, requestOptions?: RequestOptions) => Promise<{
     completedAt: string | null;
     createdAt: string;
     createdBy:   | {
        id: string;
        type: string;
      }
        | null;
     deliveredAt: string | null;
     deviceId: string;
     expiresAt: string;
     id: string;
     idempotencyKey: string | null;
     payload: {
      [key: string]: unknown;
     };
     peripheralId: string | null;
     progress:   | {
      [key: string]: unknown;
      }
        | null;
     result:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
  }>;
  list: (options?: {
     accountId?: string;
     connectivity?: "online" | "unknown" | "offline";
     locationId?: string;
     status?: "revoked" | "active";
     type?: string;
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     appVersion: string | null;
     attachment: string | null;
     capabilities:   | {
      [key: string]: unknown;
      }
        | null;
     clientKey: string | null;
     connectivity: string;
     createdAt: string;
     hostDeviceId: string | null;
     id: string;
     lastSeenAt: string | null;
     liveStatus:   | {
      [key: string]: unknown;
      }
        | null;
     local:   | {
        hostname: string | null;
        port: number | null;
      }
        | null;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     model: string | null;
     name: string;
     online: boolean;
     peripherals?: {
        id: string;
        name: string;
        type: string;
     }[];
     platform:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
     updatedAt: string;
     vendor: string | null;
  }[]>;
  listCommands: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
     completedAt: string | null;
     createdAt: string;
     createdBy:   | {
        id: string;
        type: string;
      }
        | null;
     deliveredAt: string | null;
     deviceId: string;
     expiresAt: string;
     id: string;
     idempotencyKey: string | null;
     payload: {
      [key: string]: unknown;
     };
     peripheralId: string | null;
     progress:   | {
      [key: string]: unknown;
      }
        | null;
     result:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
  }[]>;
  listEvents: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
     id: string;
     occurredAt: string;
     payload: {
      [key: string]: unknown;
     };
     receivedAt: string;
     type: string;
  }[]>;
  mediaCatalog: (requestOptions?: RequestOptions) => Promise<{
     capabilities: {
        id: string;
        label: string;
        mediaKind: string;
     }[];
     media: {
        capability: string;
        continuous: boolean;
        heightMm?: number;
        id: string;
        label: string;
        widthMm: number;
     }[];
  }>;
  mintLocalToken: (deviceId: string, request: {
     accountIds?: string[];
     allowedCommandTypes?: string[];
     ttlSeconds?: number;
   }, requestOptions?: RequestOptions) => Promise<{
     expiresAt: string;
     token: string;
     tokenId: string;
  }>;
  nfcReaders: (requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     chipTypes: string[];
     detached: boolean;
     encode: boolean;
     hostDeviceId: string | null;
     hostName: string | null;
     id: string;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     lock: boolean;
     name: string;
     online: boolean;
     read: boolean;
  }[]>;
  printers: (requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     capabilities:   | {
      [key: string]: unknown;
      }
        | null;
     detached: boolean;
     hostDeviceId: string | null;
     hostName: string | null;
     id: string;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     name: string;
     online: boolean;
     paperOut: boolean;
  }[]>;
  revoke: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     appVersion: string | null;
     attachment: string | null;
     capabilities:   | {
      [key: string]: unknown;
      }
        | null;
     clientKey: string | null;
     connectivity: string;
     createdAt: string;
     hostDeviceId: string | null;
     id: string;
     lastSeenAt: string | null;
     liveStatus:   | {
      [key: string]: unknown;
      }
        | null;
     local:   | {
        hostname: string | null;
        port: number | null;
      }
        | null;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     model: string | null;
     name: string;
     online: boolean;
     peripherals?: {
        id: string;
        name: string;
        type: string;
     }[];
     platform:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
     updatedAt: string;
     vendor: string | null;
  }>;
  rotateCredential: (deviceId: string, request: {
     graceSeconds?: number;
   }, requestOptions?: RequestOptions) => Promise<{
     credentialId: string;
     deviceSecret: string;
  }>;
  update: (deviceId: string, request: {
     locationId?: any;
     name?: string;
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string;
     appVersion: string | null;
     attachment: string | null;
     capabilities:   | {
      [key: string]: unknown;
      }
        | null;
     clientKey: string | null;
     connectivity: string;
     createdAt: string;
     hostDeviceId: string | null;
     id: string;
     lastSeenAt: string | null;
     liveStatus:   | {
      [key: string]: unknown;
      }
        | null;
     local:   | {
        hostname: string | null;
        port: number | null;
      }
        | null;
     location:   | {
        id: string;
        name: string;
      }
        | null;
     model: string | null;
     name: string;
     online: boolean;
     peripherals?: {
        id: string;
        name: string;
        type: string;
     }[];
     platform:   | {
      [key: string]: unknown;
      }
        | null;
     status: string;
     type: string;
     updatedAt: string;
     vendor: string | null;
  }>;
};

Defined in: client.ts:9840

Devices methods

assignRoles()#

assignRoles: (deviceId: string, request: {
  accountRoles: {
     accountId: string;
     roleId: string;
  }[];
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  roleId: string;
}[]>;

Assign device roles Replace a device’s account-role assignments.

Parameters#

ParameterType
deviceIdstring
request{ accountRoles: { accountId: string; roleId: string; }[]; }
request.accountRoles{ accountId: string; roleId: string; }[]
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; roleId: string; }[]>

Operation Id#

assignDeviceRoles

delete()#

delete: (deviceId: string, requestOptions?: RequestOptions) => Promise<boolean>;

Delete device Soft-delete a revoked device.

Parameters#

ParameterType
deviceIdstring
requestOptions?RequestOptions

Returns#

Promise<boolean>

Operation Id#

deleteDevice

dispatchCommand()#

dispatchCommand: (deviceId: string, request: {
  idempotencyKey?: string;
  payload?: Record<string, any>;
  peripheralId?: string;
  type: string;
}, requestOptions?: RequestOptions) => Promise<{
  completedAt: string | null;
  createdAt: string;
  createdBy:   | {
     id: string;
     type: string;
   }
     | null;
  deliveredAt: string | null;
  deviceId: string;
  expiresAt: string;
  id: string;
  idempotencyKey: string | null;
  payload: {
   [key: string]: unknown;
  };
  peripheralId: string | null;
  progress:   | {
   [key: string]: unknown;
   }
     | null;
  result:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
}>;

Dispatch a command Queue a command for a device or one of its peripherals. Idempotent on Idempotency-Key.

Parameters#

ParameterType
deviceIdstring
request{ idempotencyKey?: string; payload?: Record<string, any>; peripheralId?: string; type: string; }
request.idempotencyKey?string
request.payload?Record<string, any>
request.peripheralId?string
request.type?string
requestOptions?RequestOptions

Returns#

Promise<{ completedAt: string | null; createdAt: string; createdBy: | { id: string; type: string; } | null; deliveredAt: string | null; deviceId: string; expiresAt: string; id: string; idempotencyKey: string | null; payload: { [key: string]: unknown; }; peripheralId: string | null; progress: | { [key: string]: unknown; } | null; result: | { [key: string]: unknown; } | null; status: string; type: string; }>

Operation Id#

dispatchDeviceCommand

get()#

get: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  appVersion: string | null;
  attachment: string | null;
  capabilities:   | {
   [key: string]: unknown;
   }
     | null;
  clientKey: string | null;
  connectivity: string;
  createdAt: string;
  hostDeviceId: string | null;
  id: string;
  lastSeenAt: string | null;
  liveStatus:   | {
   [key: string]: unknown;
   }
     | null;
  local:   | {
     hostname: string | null;
     port: number | null;
   }
     | null;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  model: string | null;
  name: string;
  online: boolean;
  peripherals?: {
     id: string;
     name: string;
     type: string;
  }[];
  platform:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
  updatedAt: string;
  vendor: string | null;
}>;

Get device Get a device with its peripherals and live status.

Parameters#

ParameterType
deviceIdstring
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; appVersion: string | null; attachment: string | null; capabilities: | { [key: string]: unknown; } | null; clientKey: string | null; connectivity: string; createdAt: string; hostDeviceId: string | null; id: string; lastSeenAt: string | null; liveStatus: | { [key: string]: unknown; } | null; local: | { hostname: string | null; port: number | null; } | null; location: | { id: string; name: string; } | null; model: string | null; name: string; online: boolean; peripherals?: { id: string; name: string; type: string; }[]; platform: | { [key: string]: unknown; } | null; status: string; type: string; updatedAt: string; vendor: string | null; }>

Operation Id#

getDevice

getCommand()#

getCommand: (commandId: string, requestOptions?: RequestOptions) => Promise<{
  completedAt: string | null;
  createdAt: string;
  createdBy:   | {
     id: string;
     type: string;
   }
     | null;
  deliveredAt: string | null;
  deviceId: string;
  expiresAt: string;
  id: string;
  idempotencyKey: string | null;
  payload: {
   [key: string]: unknown;
  };
  peripheralId: string | null;
  progress:   | {
   [key: string]: unknown;
   }
     | null;
  result:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
}>;

Get a command Get a single command’s status/result by id (poll for completion).

Parameters#

ParameterType
commandIdstring
requestOptions?RequestOptions

Returns#

Promise<{ completedAt: string | null; createdAt: string; createdBy: | { id: string; type: string; } | null; deliveredAt: string | null; deviceId: string; expiresAt: string; id: string; idempotencyKey: string | null; payload: { [key: string]: unknown; }; peripheralId: string | null; progress: | { [key: string]: unknown; } | null; result: | { [key: string]: unknown; } | null; status: string; type: string; }>

Operation Id#

getDeviceCommand

list()#

list: (options?: {
  accountId?: string;
  connectivity?: "online" | "unknown" | "offline";
  locationId?: string;
  status?: "revoked" | "active";
  type?: string;
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  appVersion: string | null;
  attachment: string | null;
  capabilities:   | {
   [key: string]: unknown;
   }
     | null;
  clientKey: string | null;
  connectivity: string;
  createdAt: string;
  hostDeviceId: string | null;
  id: string;
  lastSeenAt: string | null;
  liveStatus:   | {
   [key: string]: unknown;
   }
     | null;
  local:   | {
     hostname: string | null;
     port: number | null;
   }
     | null;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  model: string | null;
  name: string;
  online: boolean;
  peripherals?: {
     id: string;
     name: string;
     type: string;
  }[];
  platform:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
  updatedAt: string;
  vendor: string | null;
}[]>;

List devices List top-level devices (relays/scanners/kiosks) for the organisation.

Parameters#

ParameterType
options?{ accountId?: string; connectivity?: "online" | "unknown" | "offline"; locationId?: string; status?: "revoked" | "active"; type?: string; }
options.accountId?string
options.connectivity?"online" | "unknown" | "offline"
options.locationId?string
options.status?"revoked" | "active"
options.type?string
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; appVersion: string | null; attachment: string | null; capabilities: | { [key: string]: unknown; } | null; clientKey: string | null; connectivity: string; createdAt: string; hostDeviceId: string | null; id: string; lastSeenAt: string | null; liveStatus: | { [key: string]: unknown; } | null; local: | { hostname: string | null; port: number | null; } | null; location: | { id: string; name: string; } | null; model: string | null; name: string; online: boolean; peripherals?: { id: string; name: string; type: string; }[]; platform: | { [key: string]: unknown; } | null; status: string; type: string; updatedAt: string; vendor: string | null; }[]>

Operation Id#

listDevices

listCommands()#

listCommands: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
  completedAt: string | null;
  createdAt: string;
  createdBy:   | {
     id: string;
     type: string;
   }
     | null;
  deliveredAt: string | null;
  deviceId: string;
  expiresAt: string;
  id: string;
  idempotencyKey: string | null;
  payload: {
   [key: string]: unknown;
  };
  peripheralId: string | null;
  progress:   | {
   [key: string]: unknown;
   }
     | null;
  result:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
}[]>;

List device commands Command history for a device (most recent first).

Parameters#

ParameterType
deviceIdstring
requestOptions?RequestOptions

Returns#

Promise<{ completedAt: string | null; createdAt: string; createdBy: | { id: string; type: string; } | null; deliveredAt: string | null; deviceId: string; expiresAt: string; id: string; idempotencyKey: string | null; payload: { [key: string]: unknown; }; peripheralId: string | null; progress: | { [key: string]: unknown; } | null; result: | { [key: string]: unknown; } | null; status: string; type: string; }[]>

Operation Id#

listDeviceCommands

listEvents()#

listEvents: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
  id: string;
  occurredAt: string;
  payload: {
   [key: string]: unknown;
  };
  receivedAt: string;
  type: string;
}[]>;

List device events The device-operational event log (most recent first).

Parameters#

ParameterType
deviceIdstring
requestOptions?RequestOptions

Returns#

Promise<{ id: string; occurredAt: string; payload: { [key: string]: unknown; }; receivedAt: string; type: string; }[]>

Operation Id#

listDeviceEvents

mediaCatalog()#

mediaCatalog: (requestOptions?: RequestOptions) => Promise<{
  capabilities: {
     id: string;
     label: string;
     mediaKind: string;
  }[];
  media: {
     capability: string;
     continuous: boolean;
     heightMm?: number;
     id: string;
     label: string;
     widthMm: number;
  }[];
}>;

Print capability & standard-media catalog The canonical print capabilities and standard media sizes designs are authored against.

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ capabilities: { id: string; label: string; mediaKind: string; }[]; media: { capability: string; continuous: boolean; heightMm?: number; id: string; label: string; widthMm: number; }[]; }>

Operation Id#

getDeviceMediaCatalog

mintLocalToken()#

mintLocalToken: (deviceId: string, request: {
  accountIds?: string[];
  allowedCommandTypes?: string[];
  ttlSeconds?: number;
}, requestOptions?: RequestOptions) => Promise<{
  expiresAt: string;
  token: string;
  tokenId: string;
}>;

Mint a Local Command Token Mint a short-lived, capability-scoped token a browser POS presents to the device’s local control plane.

Parameters#

ParameterType
deviceIdstring
request{ accountIds?: string[]; allowedCommandTypes?: string[]; ttlSeconds?: number; }
request.accountIds?string[]
request.allowedCommandTypes?string[]
request.ttlSeconds?number
requestOptions?RequestOptions

Returns#

Promise<{ expiresAt: string; token: string; tokenId: string; }>

Operation Id#

mintLocalToken

nfcReaders()#

nfcReaders: (requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  chipTypes: string[];
  detached: boolean;
  encode: boolean;
  hostDeviceId: string | null;
  hostName: string | null;
  id: string;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  lock: boolean;
  name: string;
  online: boolean;
  read: boolean;
}[]>;

List NFC readers Org-wide list of NFC reader peripherals (nfc_reader) with status and what each can do (read, encode, lock, chip types), for the exchange and encode-and-post stations to pick a reader. Scoped as the printers list is.

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; chipTypes: string[]; detached: boolean; encode: boolean; hostDeviceId: string | null; hostName: string | null; id: string; location: | { id: string; name: string; } | null; lock: boolean; name: string; online: boolean; read: boolean; }[]>

Operation Id#

listNfcReaders

printers()#

printers: (requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  capabilities:   | {
   [key: string]: unknown;
   }
     | null;
  detached: boolean;
  hostDeviceId: string | null;
  hostName: string | null;
  id: string;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  name: string;
  online: boolean;
  paperOut: boolean;
}[]>;

List printers Org-wide list of printer peripherals with status + capabilities, for the print-target picker.

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; capabilities: | { [key: string]: unknown; } | null; detached: boolean; hostDeviceId: string | null; hostName: string | null; id: string; location: | { id: string; name: string; } | null; name: string; online: boolean; paperOut: boolean; }[]>

Operation Id#

listPrinters

revoke()#

revoke: (deviceId: string, requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  appVersion: string | null;
  attachment: string | null;
  capabilities:   | {
   [key: string]: unknown;
   }
     | null;
  clientKey: string | null;
  connectivity: string;
  createdAt: string;
  hostDeviceId: string | null;
  id: string;
  lastSeenAt: string | null;
  liveStatus:   | {
   [key: string]: unknown;
   }
     | null;
  local:   | {
     hostname: string | null;
     port: number | null;
   }
     | null;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  model: string | null;
  name: string;
  online: boolean;
  peripherals?: {
     id: string;
     name: string;
     type: string;
  }[];
  platform:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
  updatedAt: string;
  vendor: string | null;
}>;

Revoke device Revoke a device and kill its credentials immediately.

Parameters#

ParameterType
deviceIdstring
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; appVersion: string | null; attachment: string | null; capabilities: | { [key: string]: unknown; } | null; clientKey: string | null; connectivity: string; createdAt: string; hostDeviceId: string | null; id: string; lastSeenAt: string | null; liveStatus: | { [key: string]: unknown; } | null; local: | { hostname: string | null; port: number | null; } | null; location: | { id: string; name: string; } | null; model: string | null; name: string; online: boolean; peripherals?: { id: string; name: string; type: string; }[]; platform: | { [key: string]: unknown; } | null; status: string; type: string; updatedAt: string; vendor: string | null; }>

Operation Id#

revokeDevice

rotateCredential()#

rotateCredential: (deviceId: string, request: {
  graceSeconds?: number;
}, requestOptions?: RequestOptions) => Promise<{
  credentialId: string;
  deviceSecret: string;
}>;

Rotate device credential Issue a new device secret; existing credentials grace-expire.

Parameters#

ParameterType
deviceIdstring
request{ graceSeconds?: number; }
request.graceSeconds?number
requestOptions?RequestOptions

Returns#

Promise<{ credentialId: string; deviceSecret: string; }>

Operation Id#

rotateDeviceCredential

update()#

update: (deviceId: string, request: {
  locationId?: any;
  name?: string;
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string;
  appVersion: string | null;
  attachment: string | null;
  capabilities:   | {
   [key: string]: unknown;
   }
     | null;
  clientKey: string | null;
  connectivity: string;
  createdAt: string;
  hostDeviceId: string | null;
  id: string;
  lastSeenAt: string | null;
  liveStatus:   | {
   [key: string]: unknown;
   }
     | null;
  local:   | {
     hostname: string | null;
     port: number | null;
   }
     | null;
  location:   | {
     id: string;
     name: string;
   }
     | null;
  model: string | null;
  name: string;
  online: boolean;
  peripherals?: {
     id: string;
     name: string;
     type: string;
  }[];
  platform:   | {
   [key: string]: unknown;
   }
     | null;
  status: string;
  type: string;
  updatedAt: string;
  vendor: string | null;
}>;

Update device Rename or relocate a device.

Parameters#

ParameterType
deviceIdstring
request{ locationId?: any; name?: string; }
request.locationId?any
request.name?string
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string; appVersion: string | null; attachment: string | null; capabilities: | { [key: string]: unknown; } | null; clientKey: string | null; connectivity: string; createdAt: string; hostDeviceId: string | null; id: string; lastSeenAt: string | null; liveStatus: | { [key: string]: unknown; } | null; local: | { hostname: string | null; port: number | null; } | null; location: | { id: string; name: string; } | null; model: string | null; name: string; online: boolean; peripherals?: { id: string; name: string; type: string; }[]; platform: | { [key: string]: unknown; } | null; status: string; type: string; updatedAt: string; vendor: string | null; }>

Operation Id#

updateDevice