export type CarrierUpdate = {source: 'EMAIL' | 'PHONE', driverName?: string | undefined, driverPhoneNumber?: string | undefined, truckNumber?: string | undefined, trailerNumber?: string | undefined, bolNumber?: string | undefined, notes?: string | undefined}; export type CarrierInfoUpdateEvent = {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: 'LOAD_CARRIER_UPDATE', data: CarrierUpdate}; export type CreateApiLOADCARRIERUPDATEArgs = {body: CarrierInfoUpdateEvent}; export type CreateApiLOADCARRIERUPDATEOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Carrier Info Update * * POST /LOAD_CARRIER_UPDATE */ export const createApiLOADCARRIERUPDATE = async (args: CreateApiLOADCARRIERUPDATEArgs, options: CreateApiLOADCARRIERUPDATEOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/LOAD_CARRIER_UPDATE${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 };