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) <noreply@anthropic.com>
This commit is contained in:
70
frontend/src/api/psaContext.ts
Normal file
70
frontend/src/api/psaContext.ts
Normal file
@@ -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<TicketContext> =>
|
||||||
|
apiClient.get<TicketContext>(`/integrations/psa/tickets/${ticketId}/context`).then(r => r.data),
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user