export type GetApiMfV1ModelDownloadModelIdArgs = {modelId: string}; export type GetApiMfV1ModelDownloadModelIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download model by model id * * GET /mf/v1/modelDownload/{modelId} */ export const getApiMfV1ModelDownloadModelId = async (args: GetApiMfV1ModelDownloadModelIdArgs, options?: GetApiMfV1ModelDownloadModelIdOptions) => { const {baseUrl = "http://gateway.mlss.mf", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/mf/v1/modelDownload/${encodeURIComponent(String(args.modelId))}${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() };