export type PublicCreateProducts = Array<{name: string, file_url?: string | undefined, description: string, type: 'shopify' | 'vambe' | 'woocommerce' | 'axis' | 'vtex' | 'jumpseller' | 'odoo' | 'tiendanube' | 'magento' | 'custom_app', currency: 'CLP' | 'USD' | 'MXN' | 'BRL' | 'UF' | 'ARS' | 'COP' | 'UYU' | 'PEN' | 'EUR' | 'HNL' | 'BOB' | 'PYG' | 'GTQ' | 'NIO' | 'PAB' | 'CRC' | 'DOP' | 'VES' | 'BZD' | 'SRD' | 'GYD', price: number, external_id: string, sku?: string | undefined, metadata: Array<{key: string, value: string}>}>; export type CreateApiApiPublicProductCreatePromptBlockIdArgs = {promptBlockId: string, 'x-api-key': string, body: PublicCreateProducts}; export type CreateApiApiPublicProductCreatePromptBlockIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create products * * POST /api/public/product/create/{promptBlockId} */ export const createApiApiPublicProductCreatePromptBlockId = async (args: CreateApiApiPublicProductCreatePromptBlockIdArgs, options?: CreateApiApiPublicProductCreatePromptBlockIdOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/public/product/create/${encodeURIComponent(String(args.promptBlockId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };