export type GetApiApiDevicesAppsUploadIdDownloadArgs = {uploadId: string}; export type GetApiApiDevicesAppsUploadIdDownloadOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download an app binary for a local device * * GET /api/devices/apps/{uploadId}/download */ export const getApiApiDevicesAppsUploadIdDownload = async (args: GetApiApiDevicesAppsUploadIdDownloadArgs, options: GetApiApiDevicesAppsUploadIdDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/devices/apps/${encodeURIComponent(String(args.uploadId))}/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 res.blob() };