export type CreateApiApiV4TlShipmentsIdEquipmentapprovalsRequestsArgs = {id: number}; export type CreateApiApiV4TlShipmentsIdEquipmentapprovalsRequestsOptions = {baseUrl?: string | undefined, oAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Request ad hoc equipment approval from the tracking provider * * POST /api/v4/tl/shipments/{id}/equipmentapprovals/requests */ export const createApiApiV4TlShipmentsIdEquipmentapprovalsRequests = async (args: CreateApiApiV4TlShipmentsIdEquipmentapprovalsRequestsArgs, options?: CreateApiApiV4TlShipmentsIdEquipmentapprovalsRequestsOptions) => { 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/tl/shipments/${encodeURIComponent(String(args.id))}/equipmentapprovals/requests${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };