export type GetApiDiV1ModelsModelIdExportArgs = {model_id: unknown}; export type GetApiDiV1ModelsModelIdExportOptions = {baseUrl?: string | undefined, basicAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export the model definition. * * GET /di/v1/models/{model_id}/export * * Also accepts auth: watsonAuthToken, watsonAuthTokenQuery */ export const getApiDiV1ModelsModelIdExport = async (args: GetApiDiV1ModelsModelIdExportArgs, options?: GetApiDiV1ModelsModelIdExportOptions) => { const {baseUrl = "https://di.prophecis.com", fetch: fetchFn = fetch, basicAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (basicAuthToken !== undefined) headers.set("Authorization", basicAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/di/v1/models/${encodeURIComponent(String(args.model_id))}/export${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() };