export type UpdateApiApiV3LoadsIdPauseArgs = {id: number}; export type UpdateApiApiV3LoadsIdPauseOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pause a load * * PUT /api/v3/loads/{id}/pause * * Also accepts auth: cookieAuth */ export const updateApiApiV3LoadsIdPause = async (args: UpdateApiApiV3LoadsIdPauseArgs, options?: UpdateApiApiV3LoadsIdPauseOptions) => { const {baseUrl = "https://embedded.improvado.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/loads/${encodeURIComponent(String(args.id))}/pause${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };