export type CommunicationDirection = 'INBOUND' | 'OUTBOUND'; export type CallRecordingContact = {name: string, phone: string, phoneExtension?: string | undefined, role?: string | undefined}; export type CallRecordingData = {callId: string, direction: CommunicationDirection, callStatus?: string | undefined, timestamp: string, contact: CallRecordingContact, recording?: {downloadUrl: string, expiresAt: string} | undefined}; export type CallRecordingAvailableEvent = {id: string, workflow: 'TRACK_AND_TRACE' | 'CARRIER_SUPPORT' | 'POD_COLLECTION' | 'LOAD_BUILDING' | 'CARRIER_SELECTION' | 'SCHEDULING' | 'CUSTOMER_SUPPORT' | 'null' | null, occurredAt: string, loadNumber: string | null, customerLoadInternalId: string | null, eventType: 'CALL_RECORDING_AVAILABLE', data: CallRecordingData}; export type CreateApiCALLRECORDINGAVAILABLEArgs = {body: CallRecordingAvailableEvent}; export type CreateApiCALLRECORDINGAVAILABLEOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Call Recording Available * * POST /CALL_RECORDING_AVAILABLE */ export const createApiCALLRECORDINGAVAILABLE = async (args: CreateApiCALLRECORDINGAVAILABLEArgs, options: CreateApiCALLRECORDINGAVAILABLEOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/CALL_RECORDING_AVAILABLE${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };