export type GetApiApiV4MeAssetsDownloadArgs = {name?: string | undefined}; export type GetApiApiV4MeAssetsDownloadOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download an asset by name * * GET /api/v4/me/assets/download * * Also accepts auth: QUERY, COOKIE */ export const getApiApiV4MeAssetsDownload = async (args: GetApiApiV4MeAssetsDownloadArgs, options?: GetApiApiV4MeAssetsDownloadOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.name != null) query.append("name", String(args.name)) if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/api/v4/me/assets/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() };