export type GetApiApiProjectsProjectIdReleasesReleaseIdDownloadArgs = {transferMode?: ('buffered' | 'streamed') | undefined, projectId: string, releaseId: string}; export type GetApiApiProjectsProjectIdReleasesReleaseIdDownloadOptions = {baseUrl: string, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a release * * GET /api/projects/{projectId}/releases/{releaseId}/download * * Also accepts auth: internalAuth */ export const getApiApiProjectsProjectIdReleasesReleaseIdDownload = async (args: GetApiApiProjectsProjectIdReleasesReleaseIdDownloadArgs, options: GetApiApiProjectsProjectIdReleasesReleaseIdDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, personalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.transferMode != null) query.append("transferMode", String(args.transferMode)) if (personalAccessToken !== undefined) headers.set('authorization', `Bearer ${personalAccessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/projects/${encodeURIComponent(String(args.projectId))}/releases/${encodeURIComponent(String(args.releaseId))}/download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };