export type ImageDownloadRequest = {notes?: (string | null) | undefined, project_code?: (string | null) | undefined, size_name?: (string | null) | undefined, product_id?: (number | null) | undefined}; export type UpdateApiV3AiImageGenerationsGenerationRequestIdImagesIndexDownloadArgs = {generationRequestId: string, index: number, body: ImageDownloadRequest}; export type UpdateApiV3AiImageGenerationsGenerationRequestIdImagesIndexDownloadOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Begin the download process * * PUT /v3/ai/image-generations/{generationRequestId}/images/{index}/download * * Also accepts auth: OAuth2 */ export const updateApiV3AiImageGenerationsGenerationRequestIdImagesIndexDownload = async (args: UpdateApiV3AiImageGenerationsGenerationRequestIdImagesIndexDownloadArgs, options: UpdateApiV3AiImageGenerationsGenerationRequestIdImagesIndexDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/ai/image-generations/${encodeURIComponent(String(args.generationRequestId))}/images/${encodeURIComponent(String(args.index))}/download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };