@vulog/aima-ticket
v1.2.48
Published
Support ticket management — create, list, and manage tickets.
Readme
@vulog/aima-ticket
Support ticket management — create, list, and manage tickets.
Installation
npm install @vulog/aima-ticket @vulog/aima-client @vulog/aima-coreUsage
import { getTickets, createTicket, getUserGroups } from '@vulog/aima-ticket';
import { getClient } from '@vulog/aima-client';
const client = getClient({ ... });
const tickets = await getTickets(client, { page: 0, size: 20 });
const ticket = await createTicket(client, {
subject: 'Vehicle issue',
status: 'NEW',
priority: 'MEDIUM',
categoryId: 42,
});API Reference
getTickets
getTickets(client: Client, options?: PaginableOptions<TicketFilters>): Promise<PaginableResponse<Ticket>>Returns a paginated list of tickets, optionally filtered by status or category.
| Param | Type | Description |
| --------- | --------------------------------- | -------------------------------- |
| client | Client | Authenticated AIMA client |
| options | PaginableOptions<TicketFilters> | Pagination and filter options |
Returns PaginableResponse<Ticket>.
getUserGroups
getUserGroups(client: Client, id: string): Promise<UserGroup[]>Returns the user groups associated with a given ID.
| Param | Type | Description |
| -------- | -------- | ------------------------- |
| client | Client | Authenticated AIMA client |
| id | string | Group or category ID |
Returns UserGroup[].
createTicket
createTicket(client: Client, data: CreateTicketParam): Promise<Ticket>Creates a new support ticket.
| Param | Type | Description |
| -------- | ------------------- | ------------------------- |
| client | Client | Authenticated AIMA client |
| data | CreateTicketParam | Ticket creation payload |
Returns the created Ticket.
Types
TicketFilters
{
status?: Status[];
categoryId?: number[];
}Status
'PENDING' | 'CLOSED' | 'RESOLVED' | 'ONGOING' | 'REJECTED' | 'NEW'Priority
'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'CreateTicketParam
{
subject: string;
description?: string;
status: Status; // defaults to 'NEW'
priority: Priority; // defaults to 'MEDIUM'
categoryId: number;
vehicleIds?: string[];
userIds?: string[];
tripId?: string;
}UserGroup
{
id: number;
name: string;
}Ticket
{
id, userId, vehicleId, fleetId, tripId, creatorId, modelId, assignedTo,
subject, status, priority, creationDate, updateDate, workedHours,
customerFault, categoryId, eventType, assignees, groupId, closeDate,
userIds, vehicleIds
}