export type GetApiApiNamespaceRepositoryTreeTreeDownloadTargzArgs = {namespace: string, repository: string, tree: string}; export type GetApiApiNamespaceRepositoryTreeTreeDownloadTargzOptions = {baseUrl: string, cookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Tarball * * GET /api/{namespace}/{repository}/tree/{tree}/download/targz */ export const getApiApiNamespaceRepositoryTreeTreeDownloadTargz = async (args: GetApiApiNamespaceRepositoryTreeTreeDownloadTargzArgs, options: GetApiApiNamespaceRepositoryTreeTreeDownloadTargzOptions) => { const {baseUrl, fetch: fetchFn = fetch, cookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/gzip") if (cookieAuth !== undefined) cookies.push("gitarena-session=" + encodeURIComponent(cookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.namespace))}/${encodeURIComponent(String(args.repository))}/tree/${encodeURIComponent(String(args.tree))}/download/targz${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() };