export type GetApiApiReposNamespaceRepoNameCommitsDbArgs = {namespace: string, repo_name: string}; export type GetApiApiReposNamespaceRepoNameCommitsDbOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download commits DB * * GET /api/repos/{namespace}/{repo_name}/commits_db */ export const getApiApiReposNamespaceRepoNameCommitsDb = async (args: GetApiApiReposNamespaceRepoNameCommitsDbArgs, options?: GetApiApiReposNamespaceRepoNameCommitsDbOptions) => { const {baseUrl = "https://hub.oxen.ai", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/repos/${encodeURIComponent(String(args.namespace))}/${encodeURIComponent(String(args.repo_name))}/commits_db${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 };