Skip to content

API Quick Reference

Module Methods

ModuleMethodReturn TypeDescription
healthcheck()Promise<HealthResponse>Health check
benefitscheck()Promise<BenefitsResponse>Entitlement validation
printerslist()Promise<PrintersResponse>Printer list
templateslist()Promise<TemplatesListResponse>Template list
templatesschema(template)Promise<TemplateSchemaResponse>Template field definitions
printexecute(request)Promise<PrintResponse>Execute print
preflightrun(options?)Promise<PreflightResult>Preflight orchestration
launchtrigger()voidTrigger TopBridge App launch
launchensureRunning(fn, options?)Promise<T>Launch + retry orchestration

TopBridgeClientConfig

FieldTypeDefaultDescription
sourcestring'(internal)'SDK source identifier (set internally, do not configure manually)
debugbooleanfalseEnable console logging (prefix: [TopBridge])
loggerLoggerSilent (no-op)Custom logger implementation
timeouts.healthnumber (ms)3000Health check timeout
timeouts.preflightnumber (ms)10000Preflight / template query timeout
wssEnabledbooleanfalseEnable WSS secure connection mode
timeouts.printnumber (ms)60000Print execution timeout
typescript
import type { TopBridgeClientConfig } from '@appzgatenz/label-print-topbridge-js'

const client = new TopBridgeClient({
  debug: true,
  timeouts: { health: 5000, print: 120000 },
})

PrintExecuteRequest

typescript
interface PrintExecuteRequest {
  template: string             // Template ID or Code
  printer: string              // Printer name
  products: PrintProductInput[] // Product data array
}

PrintProductInput

typescript
interface PrintProductInput {
  [key: string]: string | number | Record<string, string | number | undefined> | undefined
  copies?: number  // Print copies, range [1, 9999], default 1
}

SyncedPrinter

typescript
interface SyncedPrinter {
  name: string               // Printer name (used as printer parameter)
  isDefault: boolean         // Whether this is the default printer
  protocol?: 'TSPL' | 'ZPL' // Label protocol
}

Response Types

TypeKey Fields
HealthResponsetype: 'pong', isRunning: true, data.isLoggedIn, data.version(optional), data.networkStatus(optional)
BenefitsResponsedata.isValid, data.remainingPrints, data.expiresAt, data.reason, data.hasPrintBenefit, data.hasSessionBenefit
PrintersResponsedata.count, data.defaultPrinter, data.printers[]
TemplatesListResponsedata.count, data.templates[]
TemplateSchemaResponsedata.fields[], data.code, data.name
PrintResponsemessage(top-level), data.printedCopies, data.jobId, data.templateName, data.userId(optional), details(optional), warnings(optional)
PreflightResulthealth, benefits, printers

SdkResponse<T>

All SDK methods return a unified response envelope:

typescript
interface SdkResponse<T> {
  status: 'ok' | 'warning'  // Request result status
  requestId?: string         // Request trace ID
  data: T                    // Business data
  message: string            // Human-readable status description
  details?: unknown          // Extended details (optional)
  warnings?: SdkWarning[]    // Non-fatal format hints (optional)
}
StatusBehavior
'ok'Request succeeded. Use data directly.
'warning'Request succeeded with hints. data is usable, check message and warnings for details.
(error)SDK throws a TopBridgeError subclass. No return value.

Export List

typescript
// Classes
import { TopBridgeClient } from '@appzgatenz/label-print-topbridge-js'
import { LaunchModule } from '@appzgatenz/label-print-topbridge-js'

// Error Classes (11 total)
import {
  TopBridgeError,
  TopBridgeConnectionError,
  TopBridgeAuthError,
  TopBridgeVersionError,
  TopBridgeQuotaError,
  TopBridgePrintError,
  TopBridgeConfigError,
  TopBridgeValidationError,
  TopBridgePrinterError,
  TopBridgeTemplateError,
  TopBridgeNetworkError,
  TopBridgeSourceError,
} from '@appzgatenz/label-print-topbridge-js'

// Types (import on demand)
import type {
  TopBridgeClientConfig,
  TopBridgeSource,
  Logger,
  SdkWarning,
  V2WarningCode,
  HealthResponse,
  HealthData,
  BenefitsResponse,
  BenefitsData,
  PrintersResponse,
  PrintersData,
  SyncedPrinter,
  TemplatesListResponse,
  TemplatesListData,
  TemplateItem,
  TemplateSchemaResponse,
  TemplateSchema,
  TemplateFieldSchema,
  PrintResponse,
  PrintData,
  PrintExecuteRequest,
  PrintProductInput,
  PreflightResult,
  PreflightOptions,
  PreflightStep,
  EnsureRunningOptions,
} from '@appzgatenz/label-print-topbridge-js'