export type GetApiV1OrgOrgIdFileFileIdDownloadArgs = {orgId: string, fileId: string}; export type GetApiV1OrgOrgIdFileFileIdDownloadOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a file * * GET /v1/org/{orgId}/file/{fileId}/download */ export const getApiV1OrgOrgIdFileFileIdDownload = async (args: GetApiV1OrgOrgIdFileFileIdDownloadArgs, options?: GetApiV1OrgOrgIdFileFileIdDownloadOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v1/org/${encodeURIComponent(String(args.orgId))}/file/${encodeURIComponent(String(args.fileId))}/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 };