export type AiFillRequest = {tables?: (Array | null) | undefined, force_all?: boolean | undefined}; export type CreateApiConsumersConsumerIdSyncsSyncidAiFillArgs = {consumer_id: string, syncid: string, body: AiFillRequest | null}; export type CreateApiConsumersConsumerIdSyncsSyncidAiFillOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fill a consumer's mapping values * * POST /consumers/{consumer_id}/syncs/{syncid}/ai-fill */ export const createApiConsumersConsumerIdSyncsSyncidAiFill = async (args: CreateApiConsumersConsumerIdSyncsSyncidAiFillArgs, options?: CreateApiConsumersConsumerIdSyncsSyncidAiFillOptions) => { const {baseUrl = "https://api.chift.eu", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/consumers/${encodeURIComponent(String(args.consumer_id))}/syncs/${encodeURIComponent(String(args.syncid))}/ai-fill${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 };