export type CreateApiAbilitiesIdDependenciesDependencyIdDownloadOptions = {baseUrl: string, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start download * * POST /abilities/{id}/dependencies/{dependency_id}/download */ export const createApiAbilitiesIdDependenciesDependencyIdDownload = async (options: CreateApiAbilitiesIdDependenciesDependencyIdDownloadOptions) => { 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(/\/+$/, '')}/abilities/${encodeURIComponent(String(args.id))}/dependencies/${encodeURIComponent(String(args.dependency_id))}/download${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 };