export type Uuid4 = string; export type CreateApiDownloadsIdResumeArgs = {id: Uuid4}; export type CreateApiDownloadsIdResumeOptions = {baseUrl: string, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Resume download * * POST /downloads/{id}/resume */ export const createApiDownloadsIdResume = async (args: CreateApiDownloadsIdResumeArgs, options: CreateApiDownloadsIdResumeOptions) => { const {baseUrl, fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/downloads/${encodeURIComponent(String(args.id))}/resume${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 };