export type UpdateApiQuoteImageArgs = {quote_id: unknown, bgimage_id?: unknown | undefined, bg_color?: unknown | undefined, font_id?: unknown | undefined, text_color?: unknown | undefined, text_size?: unknown | undefined, halign?: unknown | undefined, valign?: unknown | undefined, width?: number | undefined, height?: number | undefined, branding?: boolean | undefined, include_transparent_layer?: boolean | undefined}; export type UpdateApiQuoteImageOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new quote image for a given quote. Choose background colors/images , choose different font styles and generate a beautiful quote image. Did you just had a feeling of being a god or what?! * * PUT /quote/image */ export const updateApiQuoteImage = async (args: UpdateApiQuoteImageArgs, options?: UpdateApiQuoteImageOptions) => { const {baseUrl = "https://quotes.rest", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.quote_id != null) query.append("quote_id", String(args.quote_id)) if (args.bgimage_id != null) query.append("bgimage_id", String(args.bgimage_id)) if (args.bg_color != null) query.append("bg_color", String(args.bg_color)) if (args.font_id != null) query.append("font_id", String(args.font_id)) if (args.text_color != null) query.append("text_color", String(args.text_color)) if (args.text_size != null) query.append("text_size", String(args.text_size)) if (args.halign != null) query.append("halign", String(args.halign)) if (args.valign != null) query.append("valign", String(args.valign)) if (args.width != null) query.append("width", String(args.width)) if (args.height != null) query.append("height", String(args.height)) if (args.branding != null) query.append("branding", String(args.branding)) if (args.include_transparent_layer != null) query.append("include_transparent_layer", String(args.include_transparent_layer)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/quote/image${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };