export type UUIDSchema = string; export type GetApiInspectImageUuidDownloadArgs = {image_uuid: UUIDSchema, path: string, text?: boolean | undefined}; export type GetApiInspectImageUuidDownloadOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a file from image * * GET /inspect/{image_uuid}/download */ export const getApiInspectImageUuidDownload = async (args: GetApiInspectImageUuidDownloadArgs, options?: GetApiInspectImageUuidDownloadOptions) => { const {baseUrl = "https://api.tokenfactory.nebius.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.path != null) query.append("path", String(args.path)) if (args.text != null) query.append("text", String(args.text)) const url = `${baseUrl.replace(/\/+$/, '')}/inspect/${encodeURIComponent(String(args.image_uuid))}/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() };