export type BidCreated = {bidId: string, createdAt: string, loadReference: string, internalLoadReference: string, carrier: {id: string | null, mcNumber?: (number | null) | undefined, dotNumber?: (number | null) | undefined} | {id?: (string | null) | undefined, mcNumber: number | null, dotNumber?: (number | null) | undefined} | {id?: (string | null) | undefined, mcNumber?: (number | null) | undefined, dotNumber: number | null}, offerAmount?: (number | null) | undefined, channel: {type: 'call' | 'email', phone: string | null, email?: (string | null) | undefined} | {type: 'call' | 'email', phone?: (string | null) | undefined, email: string | null}, truckEmpty: {city?: (string | null) | undefined, stateOrProvince?: (string | null) | undefined, country?: ('US' | 'CA' | 'MX' | 'null' | null) | undefined, dateTime?: (string | null) | undefined}, repId?: (string | null) | undefined}; export type BidCreatedEvent = {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: 'BID_CREATED', data: BidCreated}; export type CreateApiBIDCREATEDArgs = {body: BidCreatedEvent}; export type CreateApiBIDCREATEDOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Bid Created * * POST /BID_CREATED */ export const createApiBIDCREATED = async (args: CreateApiBIDCREATEDArgs, options: CreateApiBIDCREATEDOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/BID_CREATED${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 };