export type AgentContact = {name: string | null, externalId: string | null, email: string | null, phone: string | null, phoneExtension: string | null, role?: string | undefined}; export type HumanAssistanceRequestedData = {reasonCode: 'DIRECT_REQUEST' | 'LOAD_LOOKUP_FAILURE' | 'CARRIER_LOOKUP_FAILURE' | 'INSUFFICIENT_INFORMATION', contact: AgentContact}; export type HumanAssistanceRequestedEvent = {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: 'HUMAN_ASSISTANCE_REQUESTED', data: HumanAssistanceRequestedData}; export type CreateApiHUMANASSISTANCEREQUESTEDArgs = {body: HumanAssistanceRequestedEvent}; export type CreateApiHUMANASSISTANCEREQUESTEDOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Human Assistance Requested * * POST /HUMAN_ASSISTANCE_REQUESTED */ export const createApiHUMANASSISTANCEREQUESTED = async (args: CreateApiHUMANASSISTANCEREQUESTEDArgs, options: CreateApiHUMANASSISTANCEREQUESTEDOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/HUMAN_ASSISTANCE_REQUESTED${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 };