export type CreateApiV1GenerateLucyImage2Args = {'x-api-key': string, 'User-Agent'?: (string | null) | undefined, body: BodyInit}; export type CreateApiV1GenerateLucyImage2Options = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Lucy Image 2 * * POST /v1/generate/lucy-image-2 */ export const createApiV1GenerateLucyImage2 = async (args: CreateApiV1GenerateLucyImage2Args, options: CreateApiV1GenerateLucyImage2Options) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/generate/lucy-image-2${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };