export type WorkRelationship = 'EMPLOYEE' | 'CONTRACTOR'; export type CourierUpsert = {externalIdentifier: string, phoneNumber: string, email?: (string | null) | undefined, firstName?: (string | null) | undefined, lastName?: (string | null) | undefined, vehicleInfo?: ({[key: string]: unknown} | null) | undefined, vehicleIds?: (Array | null) | undefined, storeLocationIds?: (Array | null) | undefined, firstVersionContractIds?: (Array | null) | undefined, addFirstVersionContractIds?: (Array | null) | undefined, removeFirstVersionContractIds?: (Array | null) | undefined, isShiftActive?: boolean | undefined, enabled?: (boolean | null) | undefined, dateOfBirth?: (string | null) | undefined, workRelationship?: (WorkRelationship | null) | undefined, driversLicense?: (string | null) | undefined}; export type UpdateApiV1FleetDriversUpsertArgs = {body: CourierUpsert}; export type UpdateApiV1FleetDriversUpsertOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upsert Driver * * PUT /v1/fleet/drivers/upsert */ export const updateApiV1FleetDriversUpsert = async (args: UpdateApiV1FleetDriversUpsertArgs, options?: UpdateApiV1FleetDriversUpsertOptions) => { const {baseUrl = "https://api.sandbox.usenash.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/fleet/drivers/upsert${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };