Models
Printing Data Modelsβ
These are the data models used by the printing and ticket template endpoints.
PrintRequestβ
Used to send a print request.
@Serializable
data class PrintRequest(
val templateName: String? = null, // Template name (optional)
val ticketData: TicketData, // Ticket data to print
val printerType: PrinterType, // KITCHEN, CUSTOMER or BAR
val printerId: String? = null, // Printer config UUID (optional)
val broadcast: Boolean = false, // Send to all printers of the type
val forceTemplateName: Boolean = false // Force exact template with no fallback
)
PrinterType (Enum)β
Printer types / ticket destinations.
KITCHENCUSTOMERBAR
SetPrinterRequestβ
Used to assign a printer to a type.
@Serializable
data class SetPrinterRequest(
val printerType: PrinterType, // KITCHEN, CUSTOMER or BAR
val printerName: String // Printer name
)
PrinterConfigβ
Persisted printer configuration.
@Serializable
data class PrinterConfig(
val id: String,
val printerType: PrinterType,
val printerName: String,
val templateName: String? = null,
val isDefault: Boolean = false,
val enabled: Boolean = true,
val createdAt: String? = null
)
TicketTemplateβ
Defines the structure and content of a ticket template.
@Serializable
data class TicketTemplate(
val id: String,
val name: String, // Unique template name
val elements: List<TicketElement> // List of elements composing the ticket
)
In create/update requests (TicketTemplateRequest), each element is sent as a TicketElementCreateRequest (type, value, style?), without id, templateId, or order.
TicketElementβ
Represents an individual element within a ticket template.
@Serializable
data class TicketElement(
val id: String,
val templateId: String,
val order: Int,
val type: ElementType, // Element type (HEADER, TEXT, etc.)
val value: String, // Content or placeholder (e.g. {{ticket.total}})
val style: ElementStyle? = null // Optional element style
)
ElementType (Enum)β
Element types that can be used in a template.
HEADERTEXTLINE_BREAKSEPARATORTABLE_HEADERTABLE_ROWTOTAL_ROWFOOTERQRCODE
ElementStyleβ
Defines the style of a TicketElement.
@Serializable
data class ElementStyle(
val bold: Boolean = false,
val justification: Justification = Justification.LEFT,
val fontSize: FontSize = FontSize.NORMAL
)
Justification (Enum)β
LEFTCENTERRIGHT
FontSize (Enum)β
NORMALLARGEEXTRA_LARGE
TicketDataβ
Contains the specific data of a ticket to be printed.
@Serializable
data class TicketData(
val ticketId: String,
val tableName: String,
val roomName: String,
val date: String,
val items: List<TicketDataItem>,
val total: Double,
val invoice: String? = null
)
TicketDataItemβ
Represents an individual item in the TicketData list.
@Serializable
data class TicketDataItem(
val quantity: Int,
val name: String,
val price: Double,
val comments: List<String> = emptyList()
)