export type CreateApiV1GenerateLucyImageLatestArgs = {'x-api-key': string, 'User-Agent'?: (string | null) | undefined, body: BodyInit}; export type CreateApiV1GenerateLucyImageLatestOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Lucy Image Latest * * POST /v1/generate/lucy-image-latest */ export const createApiV1GenerateLucyImageLatest = async (args: CreateApiV1GenerateLucyImageLatestArgs, options: CreateApiV1GenerateLucyImageLatestOptions) => { 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-latest${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() };