Skip to main content

Tickets

The tickets model represents the structure of customer support tickets and their related entities in the system. This model enables tracking and management of customer inquiries and support requests.

Ticket Service

The TicketService provides methods to interact with ticket data.

getTicket

Retrieves a specific ticket by its ID.

getTicket(
params: GetTicketParams
): Observable<Tickets.Model.Ticket | undefined>

Parameters

ParameterTypeDescription
paramsGetTicketParamsParameters containing the ticket ID

Returns

An Observable that emits the requested ticket or undefined if not found.

Usage Example

ticketService
.getTicket({
id: 'ticket-123',
})
.subscribe((ticket) => {
if (ticket) {
console.log(`Ticket ID: ${ticket.id}`);
console.log(`Status: ${ticket.status}`);
console.log(`Topic: ${ticket.topic}`);
console.log(`Created: ${ticket.createdAt}`);
} else {
console.log('Ticket not found');
}
});

getTicketList

Retrieves a paginated list of tickets with optional filtering and sorting.

getTicketList(
query: GetTicketListQuery
): Observable<Tickets.Model.Tickets>

Parameters

ParameterTypeDescription
queryGetTicketListQueryQuery parameters for filtering and pagination

Query Parameters

ParameterTypeDescription
offsetnumberNumber of items to skip
limitnumberMaximum number of items to return
topicstringFilter by ticket topic
typestringFilter by ticket type
statusTicketStatusFilter by ticket status
dateFromDateFilter by creation date (from)
dateToDateFilter by creation date (to)
sortstringSorting criteria

Returns

An Observable that emits a paginated list of tickets.

Usage Example

ticketService
.getTicketList({
offset: 0,
limit: 10,
status: 'OPEN',
sort: 'createdAt',
})
.subscribe((tickets) => {
console.log(`Found ${tickets.total} tickets`);
console.log(`Showing ${tickets.data.length} tickets`);
tickets.data.forEach((ticket) => console.log(ticket.id));
});

createTicket

Creates a new ticket.

createTicket(
body: PostTicketBody
): Observable<Tickets.Model.Ticket>

Parameters

ParameterTypeDescription
bodyPostTicketBodyTicket creation data

Body Parameters

ParameterTypeDescription
titlestringTitle or subject of the ticket
descriptionstringDetailed description of the issue

Returns

An Observable that emits the created ticket.

Usage Example

ticketService
.createTicket({
title: 'New Feature Request',
description: 'Please add dark mode to the application',
})
.subscribe((ticket) => {
console.log(`Created ticket with ID: ${ticket.id}`);
console.log(`Status: ${ticket.status}`);
});

Data Model Structure

The tickets model is designed to support customer support operations:

  1. Tickets are the central entity representing customer inquiries
  2. Tickets have a status that changes as they progress through the support workflow
  3. Tickets can have attachments and comments for communication
  4. Tickets can have custom properties for additional metadata

This structure allows for:

  • Tracking the status of customer inquiries
  • Supporting communication through comments
  • Attaching relevant files to tickets
  • Adding custom metadata through properties

The pagination utility allows for efficient retrieval of large collections of tickets, supporting standard pagination parameters like offset and limit, as well as filtering by various criteria including date range, status, and type.

Types

Ticket

Represents a support ticket created by a customer or agent.

FieldTypeDescription
idstringUnique identifier for the ticket
createdAtstringISO timestamp when the ticket was created
updatedAtstringISO timestamp when the ticket was last updated
topicstringSubject or title of the ticket
typestringCategory or type of the ticket (e.g., "support", "feature")
statusTicketStatusCurrent status of the ticket
propertiesTicketProperty[]Additional custom properties for the ticket
attachmentsTicketAttachment[]Files attached to the ticket (optional)
commentsTicketComment[]Comments or messages on the ticket (optional)

TicketStatus

Enumeration of possible ticket statuses.

ValueDescription
OPENTicket is new or awaiting response
IN_PROGRESSTicket is being worked on
CLOSEDTicket has been resolved

TicketAttachment

Represents a file attached to a ticket.

FieldTypeDescription
namestringFilename of the attachment
urlstringURL to access the attachment
sizenumberFile size in bytes
authorAuthorPerson who uploaded the attachment
datestringISO timestamp when the attachment was added
ariaLabelstringAccessibility label for the attachment

TicketComment

Represents a message or comment on a ticket.

FieldTypeDescription
authorAuthorPerson who wrote the comment
datestringISO timestamp when the comment was posted
contentstringText content of the comment

Author

Represents a person interacting with a ticket.

FieldTypeDescription
namestringFull name of the person
emailstringEmail address (optional)
avatarstringURL to profile picture (optional)

TicketProperty

Represents a custom property or metadata for a ticket.

FieldTypeDescription
idstringProperty identifier (e.g., "priority")
valuestringProperty value (e.g., "high")

Tickets

Paginated list of tickets.

type Tickets = Pagination.Paginated<Ticket>;