export type StopUpdateLoadStatus = 'AT_PICKUP' | 'AT_DELIVERY' | 'IN_TRANSIT' | 'DELIVERED'; export type AccessorialsEnum = string; export type StopAddress = {company?: string | undefined, street1: string, street2?: string | undefined, city: string, stateOrProvince: string, postalCode: string, country: string}; export type StopUpdate = {stopSequenceNumber: number, stopId?: string | undefined, status: StopUpdateLoadStatus, arrivalTime?: string | undefined, departureTime?: string | undefined, unloadStartTime?: string | undefined, unloadEta?: string | undefined, timezone: string, accessorials?: Array | undefined, dockDoor?: string | undefined, notes?: string | undefined, address?: StopAddress | undefined}; export type StopUpdateEvent = {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: 'STOP_UPDATE', data: StopUpdate}; export type CreateApiSTOPUPDATEArgs = {body: StopUpdateEvent}; export type CreateApiSTOPUPDATEOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Stop Update * * POST /STOP_UPDATE */ export const createApiSTOPUPDATE = async (args: CreateApiSTOPUPDATEArgs, options: CreateApiSTOPUPDATEOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/STOP_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 };