From 94d697646c89cc570a32ea5ef29f4a0a5fb4f898 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Mon, 16 Mar 2026 01:09:05 -0400 Subject: [PATCH] feat: add PSA context API client with TypeScript interfaces Defines TicketDetails, CompanyInfo, ContactInfo, ConfigItemInfo, TicketNote, RelatedTicket, and TicketContext interfaces matching backend psa_context.py schemas. Exports psaContextApi with getTicketContext(). Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/api/psaContext.ts | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 frontend/src/api/psaContext.ts diff --git a/frontend/src/api/psaContext.ts b/frontend/src/api/psaContext.ts new file mode 100644 index 00000000..e77a48eb --- /dev/null +++ b/frontend/src/api/psaContext.ts @@ -0,0 +1,70 @@ +import { apiClient } from './client' + +// TypeScript interfaces matching backend Pydantic schemas in psa_context.py + +export interface TicketDetails { + id: number + summary: string + status: string + priority: string + board: string + sla: string | null + date_entered: string + resources: string | null +} + +export interface CompanyInfo { + id: number + name: string + site: string | null + address: string | null + phone: string | null + type: string | null + territory: string | null +} + +export interface ContactInfo { + name: string + email: string | null + phone: string | null + title: string | null +} + +export interface ConfigItemInfo { + device_identifier: string + type: string | null + os_type: string | null + serial_number: string | null + ip_address: string | null + model_number: string | null +} + +export interface TicketNote { + text: string + member: string | null + date_created: string + internal_analysis_flag: boolean +} + +export interface RelatedTicket { + id: number + summary: string + status: string + priority: string + board: string +} + +export interface TicketContext { + ticket: TicketDetails + company: CompanyInfo + contact: ContactInfo | null + configurations: ConfigItemInfo[] + notes: TicketNote[] + related_tickets: RelatedTicket[] + fetched_at: string +} + +export const psaContextApi = { + getTicketContext: (ticketId: string | number): Promise => + apiClient.get(`/integrations/psa/tickets/${ticketId}/context`).then(r => r.data), +}