export type GetApiArticlesArticleIdVersionsVersionIdDownloadArgs = {article_id: number, version_id: number, folder_path?: string | undefined}; export type GetApiArticlesArticleIdVersionsVersionIdDownloadOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Public Article Version Download * * GET /articles/{article_id}/versions/{version_id}/download */ export const getApiArticlesArticleIdVersionsVersionIdDownload = async (args: GetApiArticlesArticleIdVersionsVersionIdDownloadArgs, options?: GetApiArticlesArticleIdVersionsVersionIdDownloadOptions) => { const {baseUrl = "https://api.figshare.com/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.folder_path != null) query.append("folder_path", String(args.folder_path)) const url = `${baseUrl.replace(/\/+$/, '')}/articles/${encodeURIComponent(String(args.article_id))}/versions/${encodeURIComponent(String(args.version_id))}/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 };