export type GetApiHubsHubHashIdProjectsProjectIdSharesDownloadArgs = {HubHashId: string, ProjectId: number, token?: string | undefined, isDirectDownload?: boolean | undefined}; export type GetApiHubsHubHashIdProjectsProjectIdSharesDownloadOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download shared documents * * GET /hubs/{HubHashId}/projects/{ProjectId}/shares/download */ export const getApiHubsHubHashIdProjectsProjectIdSharesDownload = async (args: GetApiHubsHubHashIdProjectsProjectIdSharesDownloadArgs, options?: GetApiHubsHubHashIdProjectsProjectIdSharesDownloadOptions) => { const {baseUrl = "https://docs.bimtrackapp.co", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.token != null) query.append("token", String(args.token)) if (args.isDirectDownload != null) query.append("isDirectDownload", String(args.isDirectDownload)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/hubs/${encodeURIComponent(String(args.HubHashId))}/projects/${encodeURIComponent(String(args.ProjectId))}/shares/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 };