export type DeleteApiApiV4LoadsLoadIdArgs = {loadId: string}; export type DeleteApiApiV4LoadsLoadIdOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a load. * * DELETE /api/v4/loads/{loadId} */ export const deleteApiApiV4LoadsLoadId = async (args: DeleteApiApiV4LoadsLoadIdArgs, options?: DeleteApiApiV4LoadsLoadIdOptions) => { const {baseUrl = "https://na12.api.project44.com", fetch: fetchFn = fetch, oAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oAuth2 !== undefined) headers.set('authorization', `Bearer ${oAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v4/loads/${encodeURIComponent(String(args.loadId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };